diff options
author | nectar <nectar@FreeBSD.org> | 2001-08-21 16:55:34 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2001-08-21 16:55:34 +0000 |
commit | 43702240bb053b5cc8f6c5d064d7294987865733 (patch) | |
tree | 45447fe30c83bfd37501a17e40198babf499d592 /lib/libc/gen/setprogname.c | |
parent | d280a62e1c10e4f24b154b5c3b59c0c1b92f739f (diff) | |
download | FreeBSD-src-43702240bb053b5cc8f6c5d064d7294987865733.zip FreeBSD-src-43702240bb053b5cc8f6c5d064d7294987865733.tar.gz |
setprogname() should set __progname to the last component of the given
path.
Diffstat (limited to 'lib/libc/gen/setprogname.c')
-rw-r--r-- | lib/libc/gen/setprogname.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/setprogname.c b/lib/libc/gen/setprogname.c index 6c56013..da791f8 100644 --- a/lib/libc/gen/setprogname.c +++ b/lib/libc/gen/setprogname.c @@ -8,6 +8,8 @@ extern const char *__progname; void setprogname(const char *progname) { + char *p; - __progname = progname; + p = strrchr('/', progname); + __progname = p ? p+1 : progname; } |