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