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 20:37:11 -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

> > It shouldn't be too hard to modify the example to find out for sure...
> 
> Could you? I need an example to file a FreeBSD problem report.
> 
> Thanks!

Cygwin includes this version of BSD getopt:
/*      $OpenBSD: getopt_long.c,v 1.16 2004/02/04 18:17:25 millert Exp $        
*/
/*      $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $      */

$ cat foo.c
#include <stdio.h>
#include "getopt.h"

int main (int argc, char **argv)
{
  int c = 3;
  char *v[4] = {"test", "-r", "foo", NULL};
  struct option l[] = {{NULL}};
  getopt_long (c, v, "r::", l, NULL);

  if (optarg == NULL)
    printf("GNU getopt\n");
  else
    printf("OpenBSD getopt\n");
  return 0;
}
$ ./foo
GNU getopt
$ POSIXLY_CORRECT=1 ./foo
OpenBSD getopt

The same test with gnulib's getopt prints "GNU getopt" both times.

And, as Paul Eggert pointed out, if getopt_long is used to implement pr
- -e, which POSIX requires to take an optional argument, then the behavior
of BSD getopt_long when POSIXLY_CORRECT violates POSIX.

So, unless FreeBSD is more up-to-date than cygwin, the BSD
flavor is still non-compliant to the GNU interface, and the gnulib
configure test is still filtering correctly and providing the
replacement when it is needed.

- --
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

iD8DBQFFE0xX84KuGfSFAYARAoQOAKDCM74b3GDTOjxI0XwMUgo+sOdxXQCffHIR
loSqfbQoUOOjv+Ld/w7K+1Q=
=eQOE
-----END PGP SIGNATURE-----




reply via email to

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