Age | Commit message (Collapse) | Author |
|
so that commands like "sort -k 18446744073709551616" no longer fail merely
because 18446744073709551616 doesn't fit in uintmax_t. The trick is that
these fields can all be treated as effectively infinity; their exact
values don't matter, since no internal buffer can be that long.
* src/join.c (string_to_join_field): Verify that SIZE_MAX <= ULONG_MAX
if the code assumes this. Silently truncate too-large values to SIZE_MAX,
as the remaining code will do the right thing in this case.
* src/sort.c (parse_field_count): Likewise.
* src/uniq.c (size_opt, main): Likewise.
* tests/join/Test.pm (bigfield): New test.
* tests/sort/Test.pm (bigfield): New test.
* tests/uniq/Test.pm (121): New test.
Signed-off-by: Jim Meyering <jim@meyering.net>
|
|
replaced by isblank (to_uchar (...)).
|
|
|
|
--first-only option string from its description, so help2man formats
the derived man page properly.
|
|
three).
|
|
|
|
(main): Use fopen, not fopen_safer.
|
|
Rather than this: error (..., "...`%s'...", arg);
do this: error (..., "...%s...", quote (arg));
|
|
`error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
about variables being used uninitialized.
|
|
|
|
|
|
(obsolete_usage): Remove.
(join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
they haven't been set yet.
(tab): Now int, not char. Initialize to -1 to indicate white space
separates columns, so that we can use NUL as a separator.
All uses changed.
(OBSOLETE_LONG_OPTIONS, get_option): Remove.
(string_to_join_field): Remove ERR_MSG_FMT arg; a single format
suffices. Use xstrtoul for sizes; it suffices.
(decode_field_spec): Report an error and exit on failure. Return void,
not bool.
(add_field_list): Likewise.
(set_join_field): New function.
(enum operand_status): New enum.
(add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
possibilities with obsolete option parsing.
(main): Use it. Do not depend on POSIX version.
Check for conflicting options. Parse obsolete options -j1 and -j2
so that it is a pure extension to POSIX 1003.1-2001.
Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
|
|
(main): Use fopen_safer. Simplify the resulting code.
|
|
|
|
|
|
|
|
|
|
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.
(add_file_name, main): Likewise.
|
|
|
|
|
|
(string_to_join_field): Report that a non-numeric field
number is invalid, rather than `so large that it is not representable'.
|
|
(usage): Don't bother normalizing exit status
since the arg is already the correct exit status now.
|
|
(obsolete_usage): New var.
(longopts): Put obsolete options first.
(OBSOLETE_LONG_OPTIONS): New constant.
(get_option, add_file_name): New functions.
(main): Use them to support new behavior.
(usage): Remove documentation for -j1 FIELD and -j2 FIELD.
Do not mark -j FIELD as obsolescent; it is longstanding
UNIX tradition and is a valid extension to POSIX.
|
|
|
|
size; just modify the argument, which is no longer const *.
Various other minor cleanups, mostly to avoid the need for casts.
(extract_field): Renamed from ADD_FIELD, as it's now a function.
(struct field.beg): Now char *, not unsigned char const *. All
uses changed. It shouldn't be const since xmemcoll writes on its
arguments.
(extract_field): Likewise, for 2nd arg.
(keycmp): Remove now-unnecessary cast of xmemcoll args.
(is_blank): New function, to avoid need to cast arg to unsigned char.
(extract_field): Use it.
(xfields): Rewrite pretty much from scratch.
(hard_LC_COLLATE): Now bool, not int.
(get_line, getseq, add_field_list): Now returns bool, not int.
(decode_field_spec, add_field_list): Return true on success (not
false), for consistency with the rest of the code. All uses changed.
(tab): Now char, not unsigned char. This wasn't 100% necessary
but is slightly cleaner.
(prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
(empty_filler): Now const *.
(make_blank): Remove; wasn't needed. Remove all calls.
(main): Don't set uni_blank.nfields; zero is fine.
|
|
(min, max): Remove definitions.
Make a few function parameters and corresponding
locals `const'. Use bool for boolean variables.
Use size_t (not int) for all counters and related index variables.
(prjoin): Remove now-useless assertion.
(string_to_join_field): New function.
(main): Accept join fields as large as SIZE_MAX.
(keycmp): Rename `min' to MIN and max to MAX.
|
|
from `int' to `size_t'.
|
|
on the join fields. Suggestion from Bruce Robertson.
|
|
|
|
than `sizeof EXPLICIT_TYPE'.
The former is more maintainable and usually shorter.
|
|
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.
|
|
|
|
so that the proper errno value is used.
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
Don't include closeout.h.
|
|
|
|
|
|
|
|
xrealloc, and xcalloc return values and of xrealloc's first argument.
|
|
use FILENUM instead of `SIDE' and say what FILENUM means.
|
|
`exit (1)' to `exit (EXIT_FAILURE)', and
`usage (1)' to `usage (EXIT_FAILURE)'.
|
|
|
|
(hard_LC_COLLATE): Define even if ! ENABLE_NLS.
(main): Always initialize hard_LC_COLLATE.
Put initialization next to other locale-related stuff.
|
|
Use xmemcoll instead of memcoll.
|
|
stored in an int; this doesn't work, for example, on 64-bit Solaris.
Also, fix the type of two locals to be size_t instead of int.
|
|
|
|
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.
|
|
(prfield): Declare local to be of type size_t, not int.
|