summaryrefslogtreecommitdiff
path: root/system.h
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-09-26 15:04:03 +0000
committerjbj <devnull@localhost>1999-09-26 15:04:03 +0000
commite60094b302720378ca194db760e51299b32e0a70 (patch)
tree67e66c20dcff947fef2fa59563d364627fd1a539 /system.h
parent0464b19302bcceafe0c597f1feb693f69ab9b12d (diff)
downloadrpm-e60094b302720378ca194db760e51299b32e0a70.tar.gz
rpm-e60094b302720378ca194db760e51299b32e0a70.tar.bz2
rpm-e60094b302720378ca194db760e51299b32e0a70.zip
Retrofit glibc __progname.
CVS patchset: 3330 CVS date: 1999/09/26 15:04:03
Diffstat (limited to 'system.h')
-rw-r--r--system.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/system.h b/system.h
index 7d6f9747b..39b7ecad3 100644
--- a/system.h
+++ b/system.h
@@ -203,20 +203,25 @@ void *vmefail(void);
#endif
-#if HAVE_MCHECK_H && defined(__GNUC__)
-
/* Memory allocation via macro defs to get meaningful locations from mtrace() */
-
+#if HAVE_MCHECK_H && defined(__GNUC__)
#define xmalloc(_size) (malloc(_size) ? : vmefail())
-
#define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail())
-
#define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail())
-
#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
-
#endif /* HAVE_MCHECK_H && defined(__GNUC__) */
+/* Retrofit glibc __progname */
+char *__progname;
+#if defined __GLIBC__ && __GLIBC__ >= 2
+#define setprogname(pn)
+#else
+#define setprogname(pn) \
+ { if ((__progname = strrchr(pn, '/')) __progname++; \
+ else __progname = pn; \
+ }
+#endif
+
#if HAVE_NETDB_H
#ifndef __LCLINT__
#include <netdb.h>