summaryrefslogtreecommitdiff
path: root/src/csplit.c
AgeCommit message (Collapse)Author
2006-08-10(struct control): Remove fastmap member.Paul Eggert
(extract_regexp): Allocate fastmap separately, since otherwise it might move due to a realloc.
2006-07-09Adjust to today's renaming changes in system.h.Paul Eggert
2006-04-12Clear the RE_NO_EMPTY_RANGES re syntax option, as this is a less intrusivePaul Eggert
change from the old (Emacs) behavior, and POSIX allows us to treat [z-a] as an empty range.
2006-04-12(extract_regexp): Set re_syntax_options to aPaul Eggert
value that is compatible with what POSIX requires.
2006-04-11Update copyright year.Paul Eggert
2006-04-11(struct control): Put re_compiled member at thePaul Eggert
end, since it's large. Change regexpr member from char * to bool; all uses changed. Add new member fastmap. (extract_regexp): regexp arg is now char const *, not char *. Don't bother duplicating the regular expression; it's not needed. Set fastmap from new fastmap member. Don't bother allocating a buffer, as the regexp code does a better job than we do.
2005-09-10csplit could produce corrupt output, given input lines longer than 8KBJim Meyering
(load_buffer): Don't read from free'd memory when handling lines longer than the initial buffer length. (save_to_hold_area): Don't leak the previous hold_area buffer. Reported by Tristan Miller and Luke Kendall. * NEWS: Mention this. (load_buffer): Avoid integer overflow in buffer size calculations for very long lines.
2005-09-09(process_regexp): Store match length in regoff_t,Paul Eggert
not int. Assume that negative return values less than -2 represent regoff_t overflow.
2005-08-12Cosmetic: use X2NREALLOC (only two arguments) rather than x2nrealloc (with ↵Jim Meyering
three).
2005-07-09Don't include stdio.h; no longer needed.Paul Eggert
2005-07-03Include fd-reopen.h.Paul Eggert
Include stdio--.h, not stdio-safer.h. (input_desc): Remove. All uses changed to STDIN_FILENO. (set_input_file): Reopen stdin, to simplify code. (create_output_file): Use fopen, not fopen_safer.
2005-06-16Don't embed `this'-style quotes in format strings.Jim Meyering
Rather than this: error (..., "...`%s'...", arg); do this: error (..., "...%s...", quote (arg));
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-04-11Include stdio-safer.h.Paul Eggert
(input_desc): Remove unnecessary static initialization. (set_input_file): Use STDIN_FILENO, not 0. (create_output_file): Use fopen_safer.
2005-04-09(SA_NOCLDSTOP): Define to 0 if not defined.Paul Eggert
All uses changed. (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro. (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined behavior when called from a signal handler. All uses changed. (main) [!defined SA_NOCLDSTOP]: Use siginterrupt to specify that system calls should be interrupted.
2005-03-28(extract_regexp): Use NULL, not `0'.Jim Meyering
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.