svn commit: trunk/uClibc: extra/Configs include libc/misc/internal etc...
vapier at uclibc.org
vapier at uclibc.org
Tue Jan 3 06:55:54 UTC 2006
Author: vapier
Date: 2006-01-02 22:55:52 -0800 (Mon, 02 Jan 2006)
New Revision: 13042
Log:
add optional support for program_invocation_name/program_invocation_short_name
Modified:
trunk/uClibc/extra/Configs/Config.in
trunk/uClibc/include/errno.h
trunk/uClibc/include/libc-internal.h
trunk/uClibc/libc/misc/internals/__uClibc_main.c
Changeset:
Modified: trunk/uClibc/extra/Configs/Config.in
===================================================================
--- trunk/uClibc/extra/Configs/Config.in 2006-01-03 06:24:22 UTC (rev 13041)
+++ trunk/uClibc/extra/Configs/Config.in 2006-01-03 06:55:52 UTC (rev 13042)
@@ -446,6 +446,20 @@
Answer N if you do not need shadow password support.
Most people will answer Y.
+config UCLIBC_HAS_PROGRAM_INVOCATION_NAME
+ bool "Support for program_invocation_name"
+ default n
+ help
+ Support for the GNU-specific program_invocation_name and
+ program_invocation_short_name strings. Some GNU packages
+ (like tar and coreutils) utilize these for extra useful
+ output, but in general are not required.
+
+ At startup, these external strings are automatically set
+ up based on the value of ARGV[0].
+
+ If unsure, just answer N.
+
config UNIX98PTY_ONLY
bool "Support only Unix 98 PTYs"
default y
Modified: trunk/uClibc/include/errno.h
===================================================================
--- trunk/uClibc/include/errno.h 2006-01-03 06:24:22 UTC (rev 13041)
+++ trunk/uClibc/include/errno.h 2006-01-03 06:55:52 UTC (rev 13042)
@@ -49,7 +49,7 @@
# endif
#endif
-#if 0 /*def __USE_GNU uClibc note: not supported */
+#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
/* The full and simple forms of the name with which the program was
invoked. These variables are set up automatically at startup based on
Modified: trunk/uClibc/include/libc-internal.h
===================================================================
--- trunk/uClibc/include/libc-internal.h 2006-01-03 06:24:22 UTC (rev 13041)
+++ trunk/uClibc/include/libc-internal.h 2006-01-03 06:55:52 UTC (rev 13042)
@@ -238,6 +238,7 @@
extern char *__strncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) attribute_hidden;
extern char *__strchr (__const char *__s, int __c) attribute_hidden;
+extern char *__strrchr (__const char *__s, int __c) attribute_hidden;
extern int __strncmp (__const char *__s1, __const char *__s2, size_t __n) attribute_hidden;
extern char *__strdup (__const char *__s) attribute_hidden;
extern int __strcasecmp (__const char *__s1, __const char *__s2) attribute_hidden;
Modified: trunk/uClibc/libc/misc/internals/__uClibc_main.c
===================================================================
--- trunk/uClibc/libc/misc/internals/__uClibc_main.c 2006-01-03 06:24:22 UTC (rev 13041)
+++ trunk/uClibc/libc/misc/internals/__uClibc_main.c 2006-01-03 06:55:52 UTC (rev 13042)
@@ -63,6 +63,14 @@
#ifdef __UCLIBC_HAS_THREADS__
extern void weak_function __pthread_initialize_minimal(void);
#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;
+#endif
/*
* Declare the __environ global variable and create a weak alias environ.
@@ -73,7 +81,6 @@
weak_alias(__environ, environ)
size_t __pagesize = 0;
-const char *__progname = 0;
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
@@ -253,7 +260,18 @@
}
#endif
+#ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
+ if (argv && argv[0]) {
+ __progname_full = *argv;
+ __progname = __strrchr(*argv, '/');
+ if (likely(__progname != NULL))
+ ++__progname;
+ else
+ __progname = __progname_full;
+ }
+#else
__progname = *argv;
+#endif
#ifdef __UCLIBC_CTOR_DTOR__
/* Arrange for the application's dtors to run before we exit. */
More information about the uClibc-cvs
mailing list