summaryrefslogtreecommitdiff
path: root/src/csplit.c
AgeCommit message (Collapse)Author
2004-12-21(usage): Say the default names are `xx00, xx01, ...', not `xx01, xx02, ...'.Jim Meyering
Reported by Matt Kraai in http://bugs.debian.org/286605
2004-09-24(xalloc_die): Declare to be `extern', not `static'Jim Meyering
to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
2004-09-22(xalloc_die): Declare to be static.Jim Meyering
2004-09-21Remove unused "case 0".Paul Eggert
2004-08-09(xalloc_die): New function.Paul Eggert
(main): Remove now-obsolete initialization of xalloc_fail_func.
2004-08-03(struct line): Use size_t for sizes.Paul Eggert
(main): Remove unnecessary cast.
2004-06-21(main): Standardize on the diagnostics given when someone givesJim Meyering
too few operands ("missing operand after `xxx'") or too many operands ("extra operand `xxx'"). Include "quote.h" and/or "error.h" if it wasn't already being included.
2004-04-21 - csplit sometimes failed to remove files when interrupted.Jim Meyering
- csplit didn't clean up if two signals arrived nearly simultaneously. (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: Define. (filename_space, prefix, suffix, digits, files_created, remove_files): Now volatile. (caught_signals): New var. (cleanup): Block signals while deleting all files. (cleanup_fatal, handle_line_error, regexp_error): Mark with ATTRIBUTE_NORETURN. (create_output_file, close_output_file, interrupt_handler): Block signals while changing the number of output files, to fix some race conditions. (delete_all_files): Do nothing if remove_files is zero. Clear files_created. (main): Don't mess with signals until after argument processing is done. (main): Rewrite signal-catching code to make it similar to other coreutils programs. When processing signals, block all signals that we catch, but do not block signals that we don't catch. Avoid problems with unsigned int warnings. (interrupt_handler): Use void, not (obsolete) RETSIGTYPE. (interrupt_handler) [defined SA_NOCLDSTOP]: Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
2004-01-21(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(usage): Don't bother normalizing exit status since the arg is already the correct exit status now.
2004-01-04(new_control_record): Use x2nrealloc rather than xrealloc.Jim Meyering
2003-11-16Fix read-from-free'd-buffer error detected by valgrind.Jim Meyering
(remove_line): Don't return a pointer to data in a freed buffer. Instead, arrange to free the buffer on the subsequent call.
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings. Update the call to parse_long_options so that `AUTHORS, NULL' are the last parameters. * src/true.c (main): Append NULL to version_etc argument list. * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
2003-10-08(main): Remove obsolete FIXME.Jim Meyering
2003-10-08csplit cleanup.Jim Meyering
Be more careful about int widths. For example, remove some arbitrary limits by replacing 'unsigned' with 'size_t', 'uintmax_t', etc. Use standard bool rather than a homegrown type. (FALSE, TRUE, boolean): Remove. All uses changed to <stdbool.h> usage. (struct control): offset is now intmax_t, not int. repeat_forever is now bool, not int. (struct cstring): len is now size_t, not unsigned int. (struct buffer_record): bytes_alloc, bytes_used, num_lines are now size_t, not unsigned. start_line, first_available are now uintmax_t, not unsigned. (hold_count, control_used): Now size_t, not unsigned. (last_line_number, current_line, bytes_written): Now uintmax_t, not unsigned. (save_to_hold_area, red_input, keep_new_line, record_line_starts, create_new_buffer, get_new_buffer, load_buffer, find_line, process_regexp, split_file, new_control_record, extract_regexp, get_format_width, get_format_prec, max_out): size args, locals, and returned values are now size_t, not unsigned or int. (get_first_line_in_buffer, find_line, write_to_file, handle_line_error, process_line_count, regexp_error, process_regexp, split_file): File line, byte, and repetition counts are now uintmax_t, not unsigned. (check_for_offset): Don't require a sign before the offset. Use xstrtoimax to do the real work. (extract_regexp): Remove harmful cast of size to unsigned. 256 -> 1<<CHAR_BIT, for clarity. (get_format_flags): Return at most 3, to avoid worries about overflow. (bytes_to_octal_digits): Remove. (cleanup): Don't check whether output_stream is NULL, since close_output_file does that for us. (new_line_control, create_new_buffer): Use "foo *p = xmalloc (sizeof *p);" instead of the more long-winded alternatives. (get_new_buffer): Use O(1) algorithm for resizing a buffer to a much larger size, instead of an O(N) algorithm. (process_regexp): Use plain NULL rather than casted 0. (make_filename): Use %u, not %d, to format unsigned file number. (new_control_record): Use xrealloc exclusively, since it handles NULL reliably, (extract_regexp): Change misspelled word in diagnostic. (get_format_width): Even if a minimum field width is specified, allow room for enough octal digits to represent the value of the maximum representible integer. This fixes a potential buffer overrun. Calculate this room at compile-time, not at run-time; this removes the need for bytes_to_octal_digits. Check for overflow; this removes a FIXME. (get_format_prec): Don't allow precision to be signed; it's not ANSI. Check for overflow. Remove hardcoded "11" as default precision; this fixes a potential buffer overrun on hosts with wider size_t. (get_format_conv_type): Change local variable to be of type unsigned char, not int; this removes a potential subscript violation on hosts where char is signed. (max_out): Replace "for (;*p;)" with more-standard "while (*p)". Allow "%%" in format. Don't overflow when counting lots of percents. (usage): Default sprintf format is %02u, not %d.
2003-09-27Don't exhaust virtual memory when processing large inputs.Jim Meyering
Fix this by removing csplit's internal free-list management; instead rely on malloc for that. (free_list): Remove global. (clear_all_line_control): Remove function. (get_new_buffer): Always use create_new_buffer to obtain a new buffer, rather than searching free_list. (free_buffer): Just call free.
2003-09-23(close_output_file): Don't report bogus errno valueJim Meyering
after ferror discovers an output error. We don't know the proper errno value, since it might have been caused by any of a whole bunch of calls, and it might have been trashed in the meantime. Fixing this problem will require much more extensive changes; in the meantime just say "write error".
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-09-18revert previous changeJim Meyering
2003-09-18Update AUTHORS definition to be a comma-separated list of strings and/or updateJim Meyering
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-06-17(main): Call initialize_main.Jim Meyering
2003-04-11Remove anachronistic casts of xmalloc,Jim Meyering
xrealloc, and xcalloc return values and of xrealloc's first argument.
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-11-10(interrupt_handler): Use raise, rather than kill+getpid.Jim Meyering
2002-11-05(handle_line_error, parse_patterns):Jim Meyering
Use primitives from inttostr.h, not human.h, to print large numbers simply.
2002-10-12(struct cstring) [len]: Declare to be unsigned int,Jim Meyering
since that's how it's always used and avoids a new warning from gcc. (read_input): Adapt to new safe_read ABI.
2002-09-30Don't include stdlib.h here. It's already included via system.h.Jim Meyering
2002-09-26add a FIXME commentJim Meyering
2002-09-15(get_format_width): Add cast to avoidJim Meyering
warning about `signed and unsigned type in conditional expression'.
2002-08-31Change `exit (0)' to `exit (EXIT_SUCCESS)',Jim Meyering
`exit (1)' to `exit (EXIT_FAILURE)', and `usage (1)' to `usage (EXIT_FAILURE)'.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-01-21Don't include "xalloc.h", as system.h already does that via sys2.h.Jim Meyering
2001-12-01Reflect renaming to, and new usage of these macros:Jim Meyering
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
2001-12-01(usage): Use new macros, EMIT_HELP_DESCRIPTION and EMIT_VERSION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.
2001-11-23Factor out some common strings to make translation easier.Jim Meyering
Split usage strings so that --help and --version descriptions are alone in their own string. Likewise for the one that says: Mandatory arguments to long options are mandatory for short options too.
2001-11-22csplit could get a failed assertion: printf 'a\n\n'|csplit - '/^$/' 2Jim Meyering
No longer include assert.h. (process_line_count): Remove invalid assertion.
2001-11-11(usage): Split --help output into smaller pieces.Jim Meyering
Use fputs, not printf.
2001-11-04(usage): Say thatJim Meyering
``Mandatory arguments to long options are mandatory for short options too.\n\''
2001-08-13(AUTHORS): Mark string for translation, since it contains the English word ↵Jim Meyering
`and'.
2000-08-05(MAX): Remove definition (It's in sys2.h).Jim Meyering
2000-05-20Arrange to call close_stdout upon exit. Don't close stdout explicitly.Jim Meyering
2000-01-18(interrupt_handler, main):Jim Meyering
Don't use SA_INTERRUPT to decide whether to call sigaction, as POSIX.1 doesn't require SA_INTERRUPT and some systems (e.g. Solaris 7) don't define it. Use SA_NOCLDSTOP instead; it's been part of POSIX.1 since day 1 (in 1988).
1999-05-07(handle_line_error): Use %s, not %d, now that human_readableJim Meyering
converts it to a string.
1999-04-24Include new "xstrtol.h", not "xstrtoul.h".Jim Meyering
(struct control) [repeat]: Declare as uintmax_t, not int. (struct control) [lines_required]: Likewise. (handle_line_error): Use human_readable to print lines_required. (parse_repeat_count): Parse a uintmax_t. (parse_patterns): Parse a uintmax_t.
1999-04-04Standardize --help and --version processing.Jim Meyering
1999-04-03Use AUTHORS in place of string in parse_long_options call.Jim Meyering
1999-04-03Insert AUTHORS definition.Jim Meyering
1999-04-03Use PROGRAM_NAME in place of string in parse_long_options call.Jim Meyering
1999-04-03define PROGRAM_NAMEJim Meyering
1999-03-04Include long-options.hJim Meyering
[long_options]: Remove the "help" and "version" entries. Remove declarations of show_help and show_version. (main): Use parse_long_options, including author name(s). Remove the show_version and show_help blocks.