summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorFelix Kuehling <fxkuehl@gmx.de>2004-07-10 11:25:02 +0000
committerFelix Kuehling <fxkuehl@gmx.de>2004-07-10 11:25:02 +0000
commit486e5c26dc3164493b4f045b533fc1b9e1847581 (patch)
tree8ff9319ae0c56a8eca250b0df70d44c5d7eff2b5 /src/mesa
parent368f3c551befc29051d0061c33f408249c88b1f8 (diff)
Make GET_PROGRAM_NAME work with uCLibc using the __progname hack.
Improved that hack to remove leading directory names.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/xmlconfig.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c
index 308f415b87..aa7df8ded3 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -48,7 +48,7 @@
#undef GET_PROGRAM_NAME
-#if defined(__GNU_LIBRARY__) || defined(__GLIBC__)
+#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__)
# define GET_PROGRAM_NAME() program_invocation_short_name
#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2)
# include <osreldate.h>
@@ -62,12 +62,17 @@
#endif
#if !defined(GET_PROGRAM_NAME)
-# if defined(OpenBSD) || defined(NetBSD)
-/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. It's
+# if defined(OpenBSD) || defined(NetBSD) || defined(__UCLIBC__)
+/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU.
+ * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's
* used as a last resort, if there is no documented facility available. */
static const char *__getProgramName () {
extern const char *__progname;
- return progname;
+ char * arg = strrchr(__progname, '/');
+ if (arg)
+ return arg+1;
+ else
+ return __progname;
}
# define GET_PROGRAM_NAME() __getProgramName()
# else