1#ifdef HAVE_CONFIG_H 2#include "config.h" 3#endif 4#include <string.h> 5 6extern char *__progname; 7 8const char * 9getprogname(void) 10{ 11 return __progname; 12} 13 14void 15setprogname(char *p) 16{ 17 char *q; 18 if (p == NULL) 19 return; 20 if ((q = strrchr(p, '/')) != NULL) 21 __progname = ++q; 22 else 23 __progname = p; 24} 25