diff options
Diffstat (limited to 'lib/libc/gen/setprogname.c')
-rw-r--r-- | lib/libc/gen/setprogname.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libc/gen/setprogname.c b/lib/libc/gen/setprogname.c new file mode 100644 index 0000000..29a6cd0 --- /dev/null +++ b/lib/libc/gen/setprogname.c @@ -0,0 +1,19 @@ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <stdlib.h> +#include <string.h> + +#include "libc_private.h" + +void +setprogname(const char *progname) +{ + const char *p; + + p = strrchr(progname, '/'); + if (p != NULL) + __progname = p + 1; + else + __progname = progname; +} |