summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/setprogname.c
blob: 2ddceef9cf95bb61fe9206a49e2fc766534add56 (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 ? p + 1 : progname;
}
OpenPOWER on IntegriCloud