diff options
Diffstat (limited to 'libc/misc')
-rw-r--r-- | libc/misc/assert/__assert.c | 6 | ||||
-rw-r--r-- | libc/misc/ctype/ctype.c | 4 | ||||
-rw-r--r-- | libc/misc/error/err.c | 4 | ||||
-rw-r--r-- | libc/misc/internals/__uClibc_main.c | 30 |
4 files changed, 18 insertions, 26 deletions
diff --git a/libc/misc/assert/__assert.c b/libc/misc/assert/__assert.c index 2949b75f0..c55f0b6ae 100644 --- a/libc/misc/assert/__assert.c +++ b/libc/misc/assert/__assert.c @@ -41,10 +41,6 @@ #define ASSERT_SHOW_PROGNAME 1 -#ifdef ASSERT_SHOW_PROGNAME -extern const char *__progname; -#endif - static int in_assert; /* bss inits to 0. */ void __assert(const char *assertion, const char * filename, @@ -55,7 +51,7 @@ void __assert(const char *assertion, const char * filename, fprintf(stderr, #ifdef ASSERT_SHOW_PROGNAME - "%s: %s: %d: %s: Assertion `%s' failed.\n", __progname, + "%s: %s: %d: %s: Assertion `%s' failed.\n", __uclibc_progname, #else "%s: %d: %s: Assertion `%s' failed.\n", #endif diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index 0a7e1bf84..69b4c1a6d 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -156,11 +156,9 @@ int CTYPE_NAME(NAME) (int c) \ #ifdef L___ctype_assert #ifdef __UCLIBC_HAS_CTYPE_ENFORCED__ -extern const char *__progname; - void __isctype_assert(int c, int mask) { - fprintf(stderr, "%s: __is*{_l}(%d,%#x {locale})\n", __progname, c, mask); + fprintf(stderr, "%s: __is*{_l}(%d,%#x {locale})\n", __uclibc_progname, c, mask); abort(); } diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c index ddb8786b0..43fe60cc6 100644 --- a/libc/misc/error/err.c +++ b/libc/misc/error/err.c @@ -19,10 +19,8 @@ #endif #ifdef __UCLIBC_MJN3_ONLY__ -#warning REMINDER: Need a centralized __progname prototype. #warning REMINDER: Deal with wide oriented stderr case. #endif -extern const char *__progname; static void vwarn_work(const char *format, va_list args, int showerr) { @@ -41,7 +39,7 @@ static void vwarn_work(const char *format, va_list args, int showerr) __STDIO_AUTO_THREADLOCK(stderr); - fprintf(stderr, fmt, __progname); + fprintf(stderr, fmt, __uclibc_progname); if (format) { vfprintf(stderr, format, args); f -= 2; /* At 5 (showerr) or 9. */ diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 424d066bb..3876c7606 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -63,13 +63,15 @@ extern void weak_function _locale_init(void) attribute_hidden; #ifdef __UCLIBC_HAS_THREADS__ extern void weak_function __pthread_initialize_minimal(void); #endif + +attribute_hidden const char *__uclibc_progname = NULL; +#ifdef __UCLIBC_HAS___PROGNAME__ +strong_alias (__uclibc_progname, __progname) +#endif #ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ -char *program_invocation_name = (char *) ""; -char *program_invocation_short_name = (char *) ""; -hidden_strong_alias (program_invocation_name, __progname_full) -hidden_strong_alias (program_invocation_short_name, __progname) -#else -attribute_hidden const char *__progname = NULL; +attribute_hidden const char *__progname_full = NULL; +strong_alias (__uclibc_progname, program_invocation_short_name) +strong_alias (__progname_full, program_invocation_name) #endif /* @@ -261,16 +263,14 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, #endif #ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ - if (likely(argv && argv[0])) { - __progname_full = *argv; - __progname = __strrchr(*argv, '/'); - if (__progname != NULL) - ++__progname; - else - __progname = __progname_full; - } + __progname_full = *argv; + __progname = __strrchr(*argv, '/'); + if (__progname != NULL) + ++__progname; + else + __progname = __progname_full; #else - __progname = *argv; + __uclibc_progname = *argv; #endif #ifdef __UCLIBC_CTOR_DTOR__ |