-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 9/20/2006 7:24 PM:
> Yes.  This program demonstrates why the m4 testsuite fails when compiled
> with a BSD-flavored getopt_long:
> 
> #include <stdio.h>
> #include "getopt.h"
> 
> int main(int argc, char **argv) {
> 
>   int c = 3;
>   char *v[3] = {"test", "-r", "foo"};

Since POSIX requires that the arguments to getopt match what could be
passed to main(), that line should read:
char *v[4] = {"test", "-r", "foo", NULL};

>   getopt(c, v, "r::");

...even though the "::" in this line is what makes this test program leave
the realm of POSIX-specified behavior (and why GNU and BSD differ on
opinion on what should happen).

> 
>   if (optarg == NULL) {
>     printf("GNU getopt\n");
>   } else {
>     printf("OpenBSD getopt\n");
>   }
> }
> 

- --
Life is short - so eat dessert first!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFEoaY84KuGfSFAYARAqWiAJ9nyBf4FuCNDWs9rpdxZEMfUA5xIACguIpp
SD03oCz/8FfQ1foJ1I5yLlo=
=64hQ
-----END PGP SIGNATURE-----


Reply via email to