X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgetopt.c;h=e852127f626003de9d997f6c16b6490449334dd3;hb=911955d8c72adfdba2d2ff7bb3d727e0f18a559e;hp=8aa1353684e2cb54a50cdaf60db814885a5a0aa6;hpb=618f09f72ba36d7c43802fa5fc07aca28172e6fd;p=gnulib.git diff --git a/lib/getopt.c b/lib/getopt.c index 8aa135368..e852127f6 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -27,13 +27,13 @@ #ifdef HAVE_CONFIG_H # include -#else -# if !defined __STDC__ || !__STDC__ +#endif + +#if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ -# ifndef const -# define const -# endif +# ifndef const +# define const # endif #endif @@ -75,11 +75,12 @@ #endif #ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H +/* This is for other GNU distributions with internationalized messages. */ +# if defined HAVE_LIBINTL_H || defined _LIBC # include -# define _(msgid) gettext (msgid) +# ifndef _ +# define _(msgid) gettext (msgid) +# endif # else # define _(msgid) (msgid) # endif @@ -671,7 +672,10 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) pfound = p; indfound = option_index; } - else + else if (long_only + || pfound->has_arg != p->has_arg + || pfound->flag != p->flag + || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; }