From: Sergey Poznyakoff Date: Sun, 10 Sep 2006 11:49:28 +0000 (+0000) Subject: (__argp_parse) [!_LIBC]: Make sure program_invocation_name and program_invocation_sho... X-Git-Tag: cvs-readonly~1904 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=a1c20fb216d4392ee19b34dcee718d0dffe8873c;p=gnulib.git (__argp_parse) [!_LIBC]: Make sure program_invocation_name and program_invocation_short_name are initialized. --- diff --git a/lib/argp-parse.c b/lib/argp-parse.c index 0813afc82..a7de72902 100644 --- a/lib/argp-parse.c +++ b/lib/argp-parse.c @@ -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. */ {