Age | Commit message (Collapse) | Author |
|
* src/csplit.c (prefix): Likewise.
* src/printf.c (cfcc_msg): Likewise.
* src/tail.c (valid_file_spec): Likewise.
* src/cut.c (cut_file): Likewise, for a parameter.
* src/expr.c (str_value): Likewise.
* src/fold.c (fold_file): Likewise.
* src/pr.c (init_header): Likewise.
* src/dircolors.c (dc_parse_stream): Likewise, for a local.
* src/tr.c (make_printable_str): Likewise.
* src/nl.c (body_type, header_type, footer_type, current_type):
(separator_str, build_type_arg, nl_file): Likewise, for many.
* src/paste.c (main): Don't assign a read-only string to 'optarg'.
* src/tac.c (separator, tac_seekable, copy_to_temp): Likewise.
|
|
initialize an object to zero. This is easier to read and is less
likely to introduce an runtime error due to a mixup. It causes
gcc -W to issue a warning, but you can work around this by
appending -Wno-missing-field-initializers.
* src/pathchk.c (portable_chars_only): Likewise.
* src/shred.c (main): Likewise.
* src/stty.c (main): Likewise.
* src/tr.c (card_of_complement): Likewise.
* src/wc.c (wc): Likewise.
|
|
booleans (needed for pre-C99 hosts).
|
|
|
|
|
|
do this: error (..., "...%s...", quote (arg));
|
|
|
|
|
|
|
|
|
|
(is_char_class_member): Use bool when appropriate.
|
|
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.
|
|
would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
|
|
|
|
The POSIX SYNOPSIS does not allow this option combination.
|
|
we need to test this in just one place now.
(usage): Mention -C.
(unquote): Note that \055, \n, etc are escaped.
Do not worry about POSIXLY_CORRECT when warning about ambiguous
escape sequences.
\ at end of string stands for itself.
Do not diagnose invalid backslash escapes: POSIX says the behavior
is unspecified in this case, so we don't need to diagnose it.
(main): Add support for -C (currently an alias for -c).
Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
a diagnostic here.
|
|
buffer; that initialization triggered the same compiler bug as above.
|
|
Remove all casts.
Here are examples of the failures:
$ echo a | tr a '[x*][y*2147483646][y*2147483646][y*4]'
x
$ echo abcd | tr abc '[b*\9]'
bbbd
$ echo abcd | tr abc '[b*0]'
tr: invalid repeat count `0' in [c*n] construct
$ echo abcd | tr -c '[a*65536]\n' '[b*]'
tr: ../../coreutils-5.2.1/src/tr.c:1942: main: Assertion `get_next (s2, ((void *)0)) == -1 || truncate_set1' failed.
Aborted
(N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
This is safe since the code already assumes N_CHARS fits in int.
(Filter): Remove: we want to prototype everything.
(ORD, CHR): Remove. All uses removed. Some replaced with:
(uchar): New function. All places where a char must be converted
to an unsigned char are now done this way, not by ad-hoc methods.
(count): New type. Use it whenever counts or states are needed.
(BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
since we used it in an unsigned int context) to UINTMAX_MAX - 1.
(REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
whenever appropriate.
(NOT_A_CHAR): Remove global macro; now a local enum.
(UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
the rest of the code no longer depends on them.
(class_ok): Remove; all uses changed to use inline comparisons.
(RE_NO_TYPE): Remove; wasn't used or needed.
(struct List_element): normal_char and equiv_code are now unsigned
char, not int.
first_char, last_char, and the_repeated_char are now unsigned char,
not unsigned int. repeat_count is now count, not size_t.
All uses changed.
(struct Spec_list): state is now count, not unsigned int.
lengthis now count, not size_t.
n_indefinite_repeats is now size_t, not int.
has_equiv_class, has_char_class, and has_restricted_char_class
are now bool, not int. All uses changed.
(struct E_string): s is now char *, not unsigned char *.
escaped is now bool *, not int *. All uses changed.
(ES_MATCH): Remove macro, replacing with:
(es_match): New inline function. All uses changed.
(squeeze_repeats, complement, posix_pedantic, truncate_set1,
translating): Now bool, not int.
(io_buf): Now char array, not unsigned char.
(SET_TYPE): Remove. All uses replaced with bool.
(is_equiv_class_member, unquote, append_range, append_char_class,
append_equiv_class, find_closing_delim, star_digits_closebracket,
build_spec_list, parse_str, homogeneous_spec_list):
Now returns bool, not int. All uses changed.
(is_equiv_class_member): Now inline.
(is_equiv_class_member, is_char_class_member, make_printable_str,
append_normal_char, append_range, append_repeated_char,
get_s2_spec_stats):
Args are now of proper integer type.
(unquote, look_up_char_class, make_printable_str,
append_equiv_class, build_spec_list, squeeze_filter):
Avoid unsigned char *p; gently convert *p to unsigned char instead.
(unquote, get_spec_stats): Do not jump past declarations and then
use them; C doesn't allow this in portable programs.
(make_printable_str): Check for overflow in size calculations.
(xmemdup): Remove. All uses rewritten.
(find_bracketed_repeat): Args are now of proper pointer-to-integer
type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
(find_bracketed_repeat, star_digits_closebracket): Check that the
digits are not escaped.
(build_spec_list): Don't bother to copy opnd_str; not needed.
(build_spec_list, get_next): Simplify internal logic a bit.
(card_of_complement): Fix bug due to char overflow.
(get_spec_stats): Don't assume len fits into int.
Check for integer overflow. Use abort() rather than assert(0).
(string2_extend): Fix subscript error: is_char_class_member (..., 255)
was being invoked.
(squeeze_filter): READER is never null now; simplify code.
READER arg now has a simpler type. Remove unnecessary casts.
(squeeze_filter, main): Calls to fwrite improperly checked result
against zero, rather than against requested size.
(plain_read): New function.
(read_and_delete, read_and_xlate):
Remove unused filter arg, and don't worry about hit_eof.
Simplify by using plain_read.
(set_initialize): Args are bool and bool *, not int and SET_TYPE *.
(main): Always pass a non-null procedure to squeeze_filter.
Rewrite so that class_ok isn't needed.
|
|
(card_of_complement): Use cleaner `sizeof in_set'
rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
(aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
system, those two expressions are not the same (256 vs. 1024).
The effect of this problem was that `tr -c x y' would fail:
tr: when not truncating set1, string2 must be non-empty
|
|
for portability to EBCDIC hosts.
|
|
a loop initializing the just-allocated memory to zero.
|
|
(usage): Don't bother normalizing exit status
since the arg is already the correct exit status now.
(FATAL_ERROR, main): Exit with status EXIT_FAILURE, not 2, on errors.
|
|
|
|
(append_repeated_char, append_equiv_class, spec_init): Use more maintainable
and usually-shorter `sizeof *var' rather than `sizeof EXPLICIT_TYPE'.
|
|
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.
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
(BUFSIZ) [!defined BUFSIZ]: Don't define.
(IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
(io_buf): IO_BUF_SIZE -> BUFSIZ.
|
|
Don't include closeout.h.
|
|
Don't include errno.h.
|
|
|
|
xrealloc, and xcalloc return values and of xrealloc's first argument.
|
|
|
|
|
|
expression to avoid warning from gcc.
|
|
|
|
|
|
including the mention of SET1.
|
|
|
|
|
|
(xmemdup): Rename from `substr' and rewrite to
take only pointer/length parameters.
(build_spec_list): Update sole caller.
Properly diagnose the invalid specs [::] and [==].
Pawel Prokop reported that `tr [::] _' elicits a failed assertion.
|
|
|
|
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.
|
|
Use fputs, not printf.
|
|
|
|
|
|
|
|
|
|
(Filter): Rename from PFL.
(non_neg_strtol): Remove function.
(find_bracketed_repeat): Use xstrtoul instead of non_neg_strtol.
(squeeze_filter, set_initialize, main): Use size_t and ssize_t in
place of long and int in several decls.
(read_and_delete, read_and_xlate): Likewise, and remove assertion.
|