bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating FreeBSD port


From: Eric Blake
Subject: Re: Updating FreeBSD port
Date: Thu, 21 Sep 2006 06:33:30 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666

-----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             address@hidden
-----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

[Prev in Thread] Current Thread [Next in Thread]