Jim Meyering [Thu, 4 Apr 1996 23:08:30 +0000 (23:08 +0000)]
The following commands all failed unnecessarily.
tr -cs '[:upper:]' '[X*]'
tr -dcs '[:lower:]' n-rs-z
tr -ds '[:xdigit:]' [:alnum:]'
tr -dcs '[:alnum:]' [:digit:]'
tr -dc '[:upper:]'
Reported by Ross Ridge (ross@worf.mks.com).
(validate): Add missing conjunct (translating) in test for
`translating and complementing character classes' error. Before,
valid uses of tr could fail. E.g. `tr -dcs '[:cntrl:]' '[:alnum:]''.
(homogeneous_spec_list): New function.
(validate): Use it to relax the old (overly restrictive) restriction
that prohibited use of complemented character classes when translating.
Now, that is allowed as long as the translation maps many to one.
(get_spec_stats): Rename and redefine global has_char_class from
has_upper_or_lower.
Jim Meyering [Wed, 3 Apr 1996 05:42:14 +0000 (05:42 +0000)]
Include assert.h (disabled).
(path_concat): New function.
(do_copy): Use path_concat instead of open-coding part of its
functionality in two places. This has the additional benefit
of avoiding forming destination names like `D//file' when the
destination directory D includes a trailing slash -- as would
happen when cp is used like this:
mkdir D; touch file D/file; cp -i file D/
Reported by François Pinard.
Jim Meyering [Sun, 24 Mar 1996 17:50:09 +0000 (17:50 +0000)]
Make parameters const where appropriate.
Rename global FROM to START.
(print_numbers): Rewrite loops to avoid incrementing. Instead,
use `x = first + i * increment' paradigm. Otherwise, with inexact
increment, you could miss the last value.
Jim Meyering [Sun, 24 Mar 1996 02:26:21 +0000 (02:26 +0000)]
[SORT_FAILURE]: New macro.
Be careful to exit with 1 only when -c is used and the
input is not properly sorted. In all other cases, use
SORT_FAILURE as required by POSIX.
(main): Change some `error (1, ...' to use SORT_FAILURE.
Upon successful termination, exit with EXIT_SUCCESS instead of `0'.
Replace all uses of `2' (as exit code) with SORT_FAILURE.
Jim Meyering [Fri, 22 Mar 1996 04:54:46 +0000 (04:54 +0000)]
Include assert.h, but disable assertions.
(process_line_count): Replace if-abort with a slightly relaxed
assertion. Before, `echo |csplit - 1 1' would abort.
Reported by Samuli.Karkkainen@hut.fi.
(parse_patterns): Disallow uses like `csplit FILE 0' with zero
line number, `csplit FILE 2 1' with decreasing line numbers, and
warn about uses like `csplit FILE 3 3' that have equal line numbers.
Jim Meyering [Sat, 16 Mar 1996 05:42:53 +0000 (05:42 +0000)]
Remove __P-protected prototype for basename.
Reported by François Pinard.
(remove_suffix): Move to precede use. Remove prototype.
Declare formal parameter SUFFIX to be const.