New module 'uniconv/u16-strconv-from-locale'.
[gnulib.git] / lib / argp-parse.c
index c3f1ad8..a7de729 100644 (file)
@@ -79,11 +79,11 @@ static volatile int _argp_hang;
 
 static const struct argp_option argp_default_options[] =
 {
-  {"help",       '?',          0, 0,  N_("Give this help list"), -1},
-  {"usage",      OPT_USAGE,    0, 0,  N_("Give a short usage message"), 0},
-  {"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("Set the program name"), 0},
+  {"help",       '?',          0, 0,  N_("give this help list"), -1},
+  {"usage",      OPT_USAGE,    0, 0,  N_("give a short usage message"), 0},
+  {"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("set the program name"), 0},
   {"HANG",       OPT_HANG,    N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
-     N_("Hang for SECS seconds (default 3600)"), 0},
+     N_("hang for SECS seconds (default 3600)"), 0},
   {NULL, 0, 0, 0, NULL, 0}
 };
 
@@ -140,7 +140,7 @@ static const struct argp argp_default_argp =
 \f
 static const struct argp_option argp_version_options[] =
 {
-  {"version",    'V',          0, 0,  N_("Print program version"), -1},
+  {"version",    'V',          0, 0,  N_("print program version"), -1},
   {NULL, 0, 0, 0, NULL, 0}
 };
 
@@ -877,6 +877,20 @@ __argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags,
      to be parsed (which in some cases isn't actually an error).  */
   int arg_ebadkey = 0;
 
+#ifndef _LIBC
+  if (!(flags & ARGP_PARSE_ARGV0))
+    {
+#ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME
+      if (!program_invocation_name)
+       program_invocation_name = argv[0];
+#endif
+#ifdef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+      if (!program_invocation_short_name)
+       program_invocation_short_name = __argp_base_name (argv[0]);
+#endif
+    }
+#endif
+       
   if (! (flags & ARGP_NO_HELP))
     /* Add our own options.  */
     {