Jim Meyering
9a3433a769
(mergefps): Do not allocate at least sort_size bytes for each merge buffer.
...
Instead, allocate at least sort_size bytes total.
2001-08-26 06:51:10 +00:00
Jim Meyering
1463ff6353
(nextarg): Use strcoll, not strcmp.
2001-08-26 05:40:46 +00:00
Jim Meyering
598382f216
(main): Fix a typo in the previous patch: missing
...
a bounds check for examples like `uniq a b c'.
2001-08-25 15:09:31 +00:00
Jim Meyering
ba2900b4aa
(main): Fix some more incompatibilities with POSIX.2,
...
(e.g. `uniq +3 --' did not work) by invoking getopt_long with
leading '-', resembling what was done to 'sort' on 2001-03-20.
Recognize an +N option only if it is an integer in range, and
(if POSIXLY_CORRECT) only if a file name argument has not been seen;
otherwise silently treat it as a file name.
If the user specifies too many operands, output the first one
in the error message, as a diagnostic aid.
2001-08-25 15:07:17 +00:00
Jim Meyering
b27c41df41
(main): Don't report an error when given the valid options `+3 -d'.
2001-08-25 13:50:41 +00:00
Jim Meyering
c1471b042b
(different): Don't assume that lengths can fit
...
into size_t. Tune code for the common case where the line
lengths differ: we avoid comparing them entirely in that case.
2001-08-25 09:19:59 +00:00
Jim Meyering
59d2dceb2c
Remove arbitrary restrictions on sizes, fixing a bug reported
...
by Geoff Whale.
(skip_fields, skip_chars, check_chars): Now size_t, not int.
(size_opt): New function. Do not arbitrarily reject size zero.
Change the wording of the error message slightly, for convenience.
(find_field): Use size_t, not int, to compute sizes.
(different, main): check_chars==0 is no longer a special case, as
it defaults to SIZE_MAX.
(main): Check for overflow with args like -234234234234234.
Use 'size_opt' to convert optional arguments to sizes.
2001-08-25 07:33:20 +00:00
Jim Meyering
81cb734910
(find_field): Don't count trailing newline to be
...
part of the field. This disagrees with POSIX.2, but it's
gotta be a bug in the standard. An interpretations request
has been submitted to PASC.
2001-08-25 05:42:46 +00:00
Jim Meyering
9c2368bab8
Use n_users' in place of argc - optind' in two more places.
2001-08-24 08:41:26 +00:00
Jim Meyering
815dafff5a
(main): Fail if -l is specified with no username.
2001-08-24 08:40:29 +00:00
Jim Meyering
b64b2719bc
(usage): Clarify description of -l. From Clark Morgan.
2001-08-24 08:31:02 +00:00
Jim Meyering
4bc8b66e3a
(posixly_correct): Remove; no longer needed.
...
(main): Do not worry about POSIXLY_CORRECT, as it's OK for
expr to have options (so long as they do not begin with digits).
2001-08-24 07:56:46 +00:00
Jim Meyering
9ee54a9b3a
(nextarg): Advance ARGS by one if the next token matches.
...
All callers changed.
2001-08-18 21:21:07 +00:00
Jim Meyering
2169593a4f
(isstring): Remove.
...
(eval2): Do comparisons as strings first, before trying to convert to
integer. This avoids loss of information and wrong result, e.g. for
"expr '00' '<' '0!'", where you don't want to convert '00' to '0'.
2001-08-18 20:45:59 +00:00
Jim Meyering
2dce4a36d9
Code cleanup to avoid tricky macros and old-style function declarations.
...
(cmpf, less_than, less_equal, equal, not_equal, greater_equal,
greater_than, arithf, arithdivf, plus, minus, multiply, divide, mod):
Remove.
(eval4, eval3, eval2): Rewrite to avoid the need for the above macros
and functions.
2001-08-18 20:23:01 +00:00
Jim Meyering
7012d1083e
(binary_operator): Move declarations of lt,rt `down'
...
into the scopes where they're actually used.
(unary_operator): Likewise for `fd'.
2001-08-18 17:48:20 +00:00
Jim Meyering
1c9af0041d
(isint, binary_operator, unary_operator):
...
Use intmax_t for argument integers, not long.
(age_of, binary_operator): Use time_t for times, not long.
(unary_operator): If N is out of int range, -t N now returns false.
2001-08-18 17:45:31 +00:00
Jim Meyering
a39a7f8ada
(main): Handle a leading "--" option as POSIX requires.
2001-08-18 17:10:32 +00:00
Jim Meyering
92b78195a1
(toarith): Don't accept plain "-" as a valid integer.
2001-08-18 16:39:33 +00:00
Jim Meyering
c6c2071280
Modify 'expr' so that it uses intmax_t, not int, to calculate
...
the value of integer expressions.
(struct valinfo.i): Now intmax_t, not int.
(docolon, int_value, str_value, isstring, nextarg, toarith,
freev, tostring, trace): Remove unnecessary forward decls.
(int_value, printv, tostring, toarith, arithf, arithdivf, docolon,
eval6, eval4, eval3): Do integer arithmetic using intmax_t, not int.
(docolon): Don't assume size_t fits in int.
2001-08-18 16:04:16 +00:00
Jim Meyering
6eb493e1db
Revert part of last change and solve the problem a better way.
...
(show_date) [--rfc-822]: Set LC_ALL=C just before
calling strftime and restore it just afterwards.
Suggestion from Ulrich Drepper.
2001-08-18 15:43:28 +00:00
Jim Meyering
88e4ad1d36
(show_date) [--rfc-822]: Don't space-pad the day of the month.
...
Set only LC_TYPE to the "C" locale. Setting LC_ALL is overkill,
and would have unwanted side effects if there is an error message.
2001-08-18 10:54:56 +00:00
Jim Meyering
215ba7757e
(head_bytes): Read no more than the specified number of bytes.
2001-08-18 10:10:56 +00:00
Jim Meyering
652303d907
(main): When there are too many non-option arguments,
...
include the first offending argument in the diagnostic.
Suggestion from Karl Berry.
2001-08-16 05:47:48 +00:00
Jim Meyering
727433f0db
(xputenv): Remove parameter's const qualifier.
2001-08-14 07:18:34 +00:00
Jim Meyering
1e4a6cbe1c
(AUTHORS): Mark string for translation, since it contains the English word `and'.
2001-08-14 07:10:10 +00:00
Jim Meyering
43a6f9d2d8
(AUTHORS): Mark string for translation, since it contains the English word `and'.
2001-08-14 06:54:27 +00:00
Jim Meyering
41a201e991
(AUTHORS): Mark string for translation, since it contains the English word `and'.
2001-08-13 10:33:28 +00:00
Jim Meyering
fdb24f917f
(cp_option_init): Adjust initialization of `interactive',
...
and initialize new member, stdin_tty.
2001-08-13 08:36:54 +00:00
Jim Meyering
2e91541147
(cp_option_init): Adjust initialization of `interactive',
...
and initialize new member, stdin_tty.
(main): Adjust initialization(s) of `interactive',
2001-08-13 08:36:16 +00:00
Jim Meyering
ebb48992c0
(cp_option_init): Adjust initialization of `interactive',
...
and initialize new member, stdin_tty.
(main): Adjust initialization(s) of `interactive',
2001-08-13 08:33:04 +00:00
Jim Meyering
3b21e822ac
(enum Interactive): New type.
...
(struct cp_options) [interactive]: Change type to Interactive.
(struct cp_options) [stdin_tty]: New member.
2001-08-13 08:32:10 +00:00
Jim Meyering
66c2f3a08a
(overwrite_prompt): New function.
...
(copy_internal): Separate the mv-specific and non-move_mode code
that determines whether to prompt the user.
[move_mode]: Don't make mv fail (i.e. don't return 1) just because
the user declined to remove one or more of the files.
2001-08-13 08:31:03 +00:00
Jim Meyering
4911e67aa8
Guard the above pathconf-using definitions with `#if HAVE_PATHCONF'
...
rather than with `#ifdef _POSIX_VERSION'.
2001-08-12 18:46:20 +00:00
Jim Meyering
4d94665d3d
(PATH_MAX_FOR): Use pathconf via wrapper.
...
(NAME_MAX_FOR): Likewise.
(pathconf_wrapper): New function.
(validate_path): Declare length variables to be `long', not `int'.
Adjust corresponding printf-style specs to use %ld.
2001-08-12 18:28:19 +00:00
Jim Meyering
2238faa8fd
Include gtod.h -- should have been part of preceding delta
2001-08-12 13:00:15 +00:00
Jim Meyering
3e4950247e
Include gtod.h.
...
(main): `Call' GETTIMEOFDAY_INIT, just in case the code ever changes
to make it necessary.
2001-08-12 08:47:35 +00:00
Jim Meyering
7292e5031b
Work around non-compliant gettimeofday on Mac OS X 10.0.4,
...
(aka Darwin 1.3.7) that caused the date of the first file listed
in long output to be the current time rather than the file's mtime.
The real work is in m4/gettimeofday.m4 and the wrapper function,
lib/gettimeofday.c.
Include gtod.h.
(main): `Call' GETTIMEOFDAY_INIT.
(print_long_format): Add a comment about gettimeofday.
2001-08-12 08:47:19 +00:00
Jim Meyering
bffeb8c5aa
(print_long_format): Simplify previous patch for
...
listing negative sizes, by adding OFF_T_MAX - OFF_T_MIN + 1
instead of doing a fancy conditional shift. This is simpler
and it avoids GCC's bogus compile-time warning about shift
counts. (As a bonus, it is portable to hosts that do not use
twos-complement arithmetic. :-)
2001-08-10 19:01:54 +00:00
Jim Meyering
97dcae2fb6
(print_long_format): Multiply the shift width by zero
...
to avoid a warning from gcc on hosts with an unsigned type for the
st_size member.
2001-08-10 08:13:03 +00:00
Jim Meyering
67ba4ac017
(print_long_format): If a file size is negative, assume
...
the typical case where it has wrapped around from a positive value.
2001-08-10 07:51:52 +00:00
Jim Meyering
0d1d166269
(cfcc_msg): Remove now-inaccurate part of comment.
...
From Bruno Haible.
2001-08-07 13:45:26 +00:00
Jim Meyering
01f160092e
(copy_internal): Set *rename_succeeded, so that
...
the caller (mv) doesn't remove the source file.
2001-08-06 17:29:15 +00:00
Jim Meyering
053a9d88ee
(usage): Correct the description of --update.
2001-08-06 17:28:37 +00:00
Jim Meyering
aecb3ebe6f
(quote_name): Pass 0 to mbsnwidth, since the default
...
got changed and we want the default now.
2001-08-04 17:08:37 +00:00
Jim Meyering
5f19438017
Include "unlocked-io.h", rather than hard-coding the HAVE_*_UNLOCKED macros.
2001-07-15 14:39:04 +00:00
Jim Meyering
89bef497fd
revert unrelated part of last delta -- coming soon with a separate log entry
2001-07-08 21:31:42 +00:00
Jim Meyering
8927e79a05
(usage): Reformat so help2man generates a properly indented man page.
2001-07-08 21:29:09 +00:00
Jim Meyering
c6d89f346a
(get_dest_mode): Clear set-user-ID and set-group-ID bits
...
when copying (i.e., not in move mode) and not preserving permissions.
2001-07-08 21:22:40 +00:00
Jim Meyering
cd88376b05
(do_link): Test the boolean symbolic_link, not the function, symlink.
...
Patch by Frederik Eaton.
2001-07-02 06:42:35 +00:00