xref: /freebsd/lib/libc/gen/setprogname.c (revision 559a218c9b257775fb249b67945fe4a05b7a6b9f)
1c45f3b47SRuslan Ermilov #include <stdlib.h>
280578ef3SJacques Vidrine #include <string.h>
380578ef3SJacques Vidrine 
44cd01193SMark Murray #include "libc_private.h"
5cd18ccdcSDima Dorfman 
6cd18ccdcSDima Dorfman void
setprogname(const char * progname)7cd18ccdcSDima Dorfman setprogname(const char *progname)
8cd18ccdcSDima Dorfman {
9c45f3b47SRuslan Ermilov 	const char *p;
10cd18ccdcSDima Dorfman 
1180578ef3SJacques Vidrine 	p = strrchr(progname, '/');
12ccbe8352SDima Dorfman 	if (p != NULL)
13ccbe8352SDima Dorfman 		__progname = p + 1;
14ccbe8352SDima Dorfman 	else
15ccbe8352SDima Dorfman 		__progname = progname;
16cd18ccdcSDima Dorfman }
17