Minor updates to sort ?
Robert Elz <kre <at> munnari.OZ.AU>
2016-05-29 05:04:02 GMT
Inspired by Paul Goyette's question (on netbsd-users) I took a look at sort,
and I'd like to commit the following updates if no-one objects.
The only changes that should affect anything are the addition of the posix
C option, which is identical to c, but doesn't write messages to stderr
if the input file is not sorted, and fixing bugs in the processing of -R
such that if -R is used (and without setting it to \n - the processing of
which is also fixed in case it is set that wat using -R 10) \n does not
become a field separator regardless of what might be set later with -t (if
-t preceded -R it would have worked correctly, but not the other way.)
Aside from that the changes are more or less cosmetic - they enforce using
only one of -c -C and -m (which make no sense used together), make the
usage() reflect reality (including formatting it to stop assuming it
is outputting to an 80 column display..., and reflect the man page changes
mentioned next), and fix a minor bug in a comment, removed the unused 'x'
option (what was that?) from SORT_OPTS (no effect, generates usage() either
way) and sorted the option processing (R comes before S...)
In the man page, -C is documented, the synopsis is split to show the
(only one file allowed) different usage for -C or -c, and perhaps most
importantly, the names "field1" and "filed2" are changed to "kstart" and
"kend" to make it (a little more) clear that the -k argument does not specify
or use a field as such, but designates the start and end of the sort keys
(with the designators using fields as an addressing object - which is all
fields are used for in sort, unlike awk, cut, etc.) and -R is fully documented.
There are no changes (at all) to anything actually related to sorting...
Anyone object to these changes? (patch appended)