X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fgetopt.c;h=ef790b79e07af604046665d0187b1af4691ddb2f;hb=a10e3d19c8c812a60794c247ff6940a04ed51bea;hp=744f1156311593ada1deb34bcd1705ca2d787558;hpb=06ee59a585b78f1071e246c1a8c3e0d3731388b0;p=gnulib.git diff --git a/lib/getopt.c b/lib/getopt.c index 744f11563..ef790b79e 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -1154,10 +1154,19 @@ _getopt_internal (int argc, char **argv, const char *optstring, return result; } +/* glibc gets a LSB-compliant getopt. + Standalone applications get a POSIX-compliant getopt. */ +#if _LIBC +enum { POSIXLY_CORRECT = 0 }; +#else +enum { POSIXLY_CORRECT = 1 }; +#endif + int getopt (int argc, char *const *argv, const char *optstring) { - return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, 1); + return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, + POSIXLY_CORRECT); }