diff options
author | Bo Borgerson <gigabo@gmail.com> | 2008-04-20 21:24:16 -0400 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-06-12 19:38:43 +0200 |
commit | 98a96822d9dac92de719fa340fe326e1fe0427fe (patch) | |
tree | b34410f3fa4b6053fae1d1934d666aeb8b63b06e /doc/coreutils.texi | |
parent | 5f47278372465f15b13803cd5a1702c264a95fdf (diff) | |
download | coreutils-98a96822d9dac92de719fa340fe326e1fe0427fe.tar.xz |
comm: ensure that input files are sorted
* NEWS: List new behavior.
* doc/coreutils.texi (checkOrderOption) New macro for
describing `--check-order' and `--nocheck-order', used in
both join and comm.
* src/comm.c (main): Initialize new options.
(usage): Describe new options.
(compare_files): Keep an extra pair of buffers for the previous
line from each file to check the internal order.
(check_order): If an order-check is required, compare and handle
the result appropriately.
(copylinebuffer): Copy a linebuffer; used for copy before read.
* tests/misc/Makefile.am: List new test.
* tests/misc/comm: Tests for the comm program, including the
new order-checking functionality and attendant command-line options.
Diffstat (limited to 'doc/coreutils.texi')
-rw-r--r-- | doc/coreutils.texi | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index a626b4563..3bedd73c7 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -4449,6 +4449,32 @@ status that does not depend on the result of the comparison. Upon normal completion @command{comm} produces an exit code of zero. If there is an error it exits with nonzero status. +@macro checkOrderOption{cmd} +If the @option{--check-order} option is given, unsorted inputs will +cause a fatal error message. If the option @option{--nocheck-order} +is given, unsorted inputs will never cause an error message. If +neither of these options is given, wrongly sorted inputs are diagnosed +only if an input file is found to contain unpairable lines. If an +input file is diagnosed as being unsorted, the @command{\cmd\} command +will exit with a nonzero status (and the output should not be used). + +Forcing @command{\cmd\} to process wrongly sorted input files +containing unpairable lines by specifying @option{--nocheck-order} is +not guaranteed to produce any particular output. The output will +probably not correspond with whatever you hoped it would be. +@end macro +@checkOrderOption{comm} + +@table @samp + +@item --check-order +Fail with an error message if either input file is wrongly ordered. + +@item --nocheck-order +Do not check that both input files are in sorted order. + +@end table + @node tsort invocation @section @command{tsort}: Topological sort @@ -5290,18 +5316,7 @@ c c1 c2 b b1 b2 @end example -If the @option{--check-order} option is given, unsorted inputs will -cause a fatal error message. If the option @option{--nocheck-order} -is given, unsorted inputs will never cause an error message. If -neither of these options is given, wrongly sorted inputs are diagnosed -only if an input file is found to contain unpairable lines. If an -input file is diagnosed as being unsorted, the @command{join} command -will exit with a nonzero status (and the output should not be used). - -Forcing @command{join} to process wrongly sorted input files -containing unpairable lines by specifying @option{--nocheck-order} is -not guaranteed to produce any particular output. The output will -probably not correspond with whatever you hoped it would be. +@checkOrderOption{join} The defaults are: @itemize |