.
[gnulib.git] / lib / getopt.c
index c7ddad0..e852127 100644 (file)
 #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 <libintl.h>
-#  define _(msgid)     gettext (msgid)
+#  ifndef _
+#   define _(msgid)    gettext (msgid)
+#  endif
 # else
 #  define _(msgid)     (msgid)
 # endif
@@ -671,7 +672,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
                pfound = p;
                indfound = option_index;
              }
-           else if (pfound->has_arg != p->has_arg
+           else if (long_only
+                    || pfound->has_arg != p->has_arg
                     || pfound->flag != p->flag
                     || pfound->val != p->val)
              /* Second or later nonexact match found.  */