diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-02-16 14:42:43 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-02-16 14:42:43 +0000 |
commit | 7548e75065063dae256d94e6c7f4f9f43bd7f210 (patch) | |
tree | f23b000f8822f6eb70249c1106a3275deaa03bac /src/csplit.c | |
parent | ddefcddae2e97579f82320f4fd70d0ba14a52392 (diff) | |
parent | 974ab3dd887985e3aa347f3c6521f819296396a0 (diff) | |
download | coreutils-7548e75065063dae256d94e6c7f4f9f43bd7f210.tar.gz |
Merge tag 'upstream/8.21'
Upstream version 8.21
Diffstat (limited to 'src/csplit.c')
-rw-r--r-- | src/csplit.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/csplit.c b/src/csplit.c index fb43350a..22f3ad4b 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -1,5 +1,5 @@ /* csplit - split a file into sections determined by context lines - Copyright (C) 1991-2012 Free Software Foundation, Inc. + Copyright (C) 1991-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -425,6 +425,7 @@ free_buffer (struct buffer_record *buf) free (l); l = n; } + buf->line_start = NULL; free (buf->buffer); buf->buffer = NULL; } @@ -499,8 +500,6 @@ load_buffer (void) b->bytes_used += read_input (p, bytes_avail); lines_found = record_line_starts (b); - if (!lines_found) - free_buffer (b); if (lines_found || have_read_eof) break; @@ -515,7 +514,10 @@ load_buffer (void) if (lines_found) save_buffer (b); else - free (b); + { + free_buffer (b); + free (b); + } return lines_found != 0; } @@ -1453,11 +1455,10 @@ Usage: %s [OPTION]... FILE PATTERN...\n\ fputs (_("\ Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ...,\n\ and output byte counts of each piece to standard output.\n\ -\n\ -"), stdout); - fputs (_("\ -Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); + + emit_mandatory_arg_note (); + fputs (_("\ -b, --suffix-format=FORMAT use sprintf FORMAT instead of %02d\n\ -f, --prefix=PREFIX use PREFIX instead of 'xx'\n\ |