diff options
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\ |