summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/setprogname.c
blob: 8a04211b06a86258df932dd39686c05dd18b1f40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#if defined(LIBC_RCS) && !defined(lint)
static const char rcsid[] =
  "$FreeBSD$";
#endif /* LIBC_RCS and not lint */

#include <stdlib.h>
#include <string.h>

extern const char *__progname;

void
setprogname(const char *progname)
{
	const char *p;

	p = strrchr(progname, '/');
	__progname = p != NULL ? p + 1 : progname;
}
OpenPOWER on IntegriCloud