> Why are there 2 separate binaries for /usr/bin/sort
> and
> /usr/xpg4/bin/sort? From looking at it the only
> difference is option
> -c.
> sort(1) says:
>   /usr/bin/sort
> -c    Checks that the single input file is ordered
>  as speci-
> fied  by  the  arguments and the collating
> sequence of
> the current locale. The exit code is set
>  and no output
>           is produced unless the file is out of sort.
> pg4/bin/sort
> -c              Same as /usr/bin/sort except  no
>   output  is
>                    produced under any circumstances.
> problem? I thought error messages are
> notaninterface? Or is this the exception of the
> common rule?

The code in question is at
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/sort/common/check.c#203

which looks like it enables messages for the non-xpg4 in the case of either
-c
or
-c -u
options.

http://www.opengroup.org/onlinepubs/9699919799/utilities/sort.html

shows something new: -c for error messages and -C (capital C) same but with
no error messages:
>-c
>   Check that the single input file is ordered as specified by the arguments
>and the collating sequence of the current locale. Output shall not be sent
>to standard output. The exit code shall indicate whether or not disorder
>was detected or an error occurred. If disorder (or, with -u, a duplicate key)
>is detected, a warning message shall be sent to standard error indicating
>where the disorder or duplicate key was found.
>-C
>    Same as -c, except that a warning message shall not be sent to standard
>error if disorder or, with -u, a duplicate key is detected.

As far as I can tell, the current code does not implement the -C (capital C)
option.

The availability of both those options would comply with the latest standard,
AFAIK, and would resolve the difference between /usr/bin/sort and
/usr/xpg4/bin/sort (by allowing both behaviors by command line option, and
with the existing /usr/bin/sort behavior effectively the default (i.e. if one
uses -c rather than the new -C).

That's my take, anyway...
-- 
This message posted from opensolaris.org
_______________________________________________
shell-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/shell-discuss

Reply via email to