diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-04-14 15:30:22 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:36 +0200 |
commit | 508b20ead1710e8c295630d096960e51a65b7e5d (patch) | |
tree | 932f692c5724193e6d17100e758c2271e0dfb2b9 /libc/misc | |
parent | 135083090268acd6983a5d43e96c9183009c5290 (diff) |
make UCLIBC_HAS_PROGRAM_INVOCATION_NAME and UCLIBC_HAS___PROGNAME independent options
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/internals/__uClibc_main.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index f2290b32a..d120fa22e 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -140,14 +140,19 @@ extern void (*__fini_array_end []) (void) attribute_hidden; # endif #endif -attribute_hidden const char *__uclibc_progname = ""; -#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ -const char *program_invocation_short_name = ""; -const char *program_invocation_name = ""; +const char *__uclibc_progname = ""; +#if !defined __UCLIBC_HAS___PROGNAME__ && defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +# define __progname program_invocation_short_name +# define __progname_full program_invocation_name #endif -#ifdef __UCLIBC_HAS___PROGNAME__ -weak_alias (program_invocation_short_name, __progname) -weak_alias (program_invocation_name, __progname_full) +#if defined __UCLIBC_HAS___PROGNAME__ || (defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__) +const char *__progname = ""; +/* psm: why have a visible __progname_full? */ +const char *__progname_full = ""; +# if defined __UCLIBC_HAS___PROGNAME__ && defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +weak_alias (__progname, program_invocation_short_name) +weak_alias (__progname_full, program_invocation_name) +# endif #endif /* @@ -380,14 +385,14 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, #endif __uclibc_progname = *argv; -#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ +#if defined __UCLIBC_HAS___PROGNAME__ || (defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__) if (*argv != NULL) { - program_invocation_name = *argv; - program_invocation_short_name = strrchr(*argv, '/'); - if (program_invocation_short_name != NULL) - ++program_invocation_short_name; + __progname_full = *argv; + __progname = strrchr(*argv, '/'); + if (__progname != NULL) + ++__progname; else - program_invocation_short_name = program_invocation_name; + __progname = *argv; } #endif |