Age | Commit message (Collapse) | Author |
|
* src/join.c (prevline): Make prevline module-level static, so that
the allocated items can be freed at exit.
(free_prevline): new atexit function; frees items in prevline[].
Use ARRAY_CARDINALITY, so include "argmatch.h" to get that.
(main): Arrange for free_prevline to be called during exit.
(get_line): Free prevline[which - 1] also, as that
will have been allocated by dup_line.
|
|
* src/join.c: Support --check-order and --nocheck-order.
New variables check_input_order, seen_unpairable and
issued_disorder_warning[]. For --check-order, verify that the
input files are in sorted order. For the default case, check the
order only if there are unpairable lines.
(join): Perform ordering checks after reaching EOF on either
input.
(usage): Mention --check-order and --nocheck-order.
(dupline): Save a copy of the previously-read input line so that
we can detect disorder on the input.
(get_line): Temporarily save a copy of the previous line (by
calling dupline) and check relative ordering (by calling
checkorder) before returning the newly-read line.
(getseq, join): Tell get_line which file we are reading from.
(advance_seq): New function, factoring out some of the code
commonly surrounding calls to getseq.
(checkorder): New function. Verifies that a pair of consecutive
input lines are in sorted order.
* doc/coreutils.texi (join invocation): Document the new options
--check-order and --nocheck-order.
* tests/join/Test.pm (tv): Added tests for --check-order and
--nocheck-order.
* NEWS: Mention this new feature.
|
|
|
|
|
|
* src/system.h (emit_bug_reporting_address): New function.
* src/base64.c: Use it rather than a literal printf.
* src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c:
* src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c:
* src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c:
* src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c:
* src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c:
* src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c:
* src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c:
* src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c:
* src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c:
* src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c:
* src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c:
* src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c:
* src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c:
* src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c:
* src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c:
* src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c:
* src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c:
* src/who.c, src/whoami.c, src/yes.c: Likewise.
|
|
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.
|