Age | Commit message (Collapse) | Author |
|
Rather than this: error (..., "...`%s'...", arg);
do this: error (..., "...%s...", quote (arg));
|
|
|
|
|
|
(input_desc): Remove unnecessary static initialization.
(set_input_file): Use STDIN_FILENO, not 0.
(create_output_file): Use fopen_safer.
|
|
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.
|
|
|
|
Reported by Matt Kraai in http://bugs.debian.org/286605
|
|
to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
|
|
|
|
|
|
(main): Remove now-obsolete initialization of xalloc_fail_func.
|
|
(main): Remove unnecessary cast.
|
|
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.
|
|
- 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.
|
|
(usage): Don't bother normalizing exit status
since the arg is already the correct exit status now.
|
|
|
|
(remove_line): Don't return a pointer to data in
a freed buffer. Instead, arrange to free the buffer on the
subsequent call.
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
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".
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
|
|
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
|
|
Don't include closeout.h.
|
|
|
|
xrealloc, and xcalloc return values and of xrealloc's first argument.
|
|
|
|
|
|
Use primitives from inttostr.h, not human.h, to print large numbers simply.
|
|
since that's how it's always used and avoids a new warning from gcc.
(read_input): Adapt to new safe_read ABI.
|
|
|
|
|
|
warning about `signed and unsigned type in conditional expression'.
|
|
`exit (1)' to `exit (EXIT_FAILURE)', and
`usage (1)' to `usage (EXIT_FAILURE)'.
|
|
|
|
|
|
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
|
|
instead of hard-coding --help and --version descriptions.
|
|
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.
|
|
No longer include assert.h.
(process_line_count): Remove invalid assertion.
|
|
Use fputs, not printf.
|
|
``Mandatory arguments to long options are mandatory for short options too.\n\''
|
|
`and'.
|
|
|
|
|
|
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).
|
|
converts it to a string.
|
|
(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.
|