[illumos-Developer] webrev: printf
Nicholas George
nicholas.george.homeoffice at googlemail.com
Thu Oct 14 09:07:42 PDT 2010
On 14 October 2010 17:41, Garrett D'Amore <garrett at nexenta.com> wrote:
> So I did find one statement, which caused to add a few lines of code:
>
> Standard utilities that do not accept options,
> * but that do accept operands, shall recognize "--" as a
> * first argument to be discarded.
>
>
> So I added this to the program:
>
> /*
> * POSIX says: Standard utilities that do not accept options,
> * but that do accept operands, shall recognize "--" as a
> * first argument to be discarded.
> */
> if (strcmp(argv[0], "--") == 0) {
> argc--;
> argv++;
> }
>
> (Argv[0] here is after we've skipped past argv[0] for the program name
> itself.)
>
> Apart from that particular test, I can't imagine what kind of tests
> you'd have for - arguments.
>
> My testing shows that legacy printf also behaves the same way... it will
> discard -- but not -<letter>.
Yes, but this is a BUG and not allowed for a POSIX conforming utility.
You're merely repeating the argumentation we had in the bash list
[http://www.mail-archive.com/bug-bash@gnu.org/msg03483.html] which was
the prelude to the Austin discussion and interpretation request. But
it does not make Solaris10 /bin/printf nor your printf conform to the
standard.
You have to choose - standard conformance or a buggy legacy
implementation which breaks conforming scripts.
Nicholas
--
Nicholas George
MBDA System Integration (home office)
More information about the Developer
mailing list