Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libc / gen / setprogname.c
1 #if defined(LIBC_RCS) && !defined(lint)
2 static const char rcsid[] =
3   "$FreeBSD: src/lib/libc/gen/setprogname.c,v 1.1.2.4 2002/02/11 01:18:35 dd Exp $";
4 #endif /* LIBC_RCS and not lint */
5
6 #include <stdlib.h>
7 #include <string.h>
8
9 extern const char *__progname;
10
11 void
12 setprogname(const char *progname)
13 {
14         const char *p;
15
16         p = strrchr(progname, '/');
17         if (p != NULL)
18                 __progname = p + 1;
19         else
20                 __progname = progname;
21 }