changeset 7289:ec5559fba282

(__argp_parse) [!_LIBC]: Make sure program_invocation_name and program_invocation_short_name are initialized.
author Sergey Poznyakoff <gray@gnu.org.ua>
date Sun, 10 Sep 2006 11:49:28 +0000
parents ac08c25fd65a
children 44ae9a87568c
files lib/argp-parse.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/argp-parse.c
+++ b/lib/argp-parse.c
@@ -877,6 +877,20 @@
      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.  */
     {