Use basename(3) to derive the name of the binary from argv[0].

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
Submitted by:	green
This commit is contained in:
Robert Watson 2002-10-10 16:37:12 +00:00
parent d61e0656e1
commit 7522ecb37f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104796

View File

@ -40,6 +40,7 @@
#include <sys/uio.h>
#include <sys/extattr.h>
#include <libgen.h>
#include <libutil.h>
#include <stdio.h>
#include <stdlib.h>
@ -111,7 +112,7 @@ main(int argc, char *argv[])
visbuflen = buflen = 0;
visbuf = buf = NULL;
p = strrchr(argv[0], '/');
p = basename(argv[0]);
if (p == NULL)
p = argv[0];
if (!strcmp(p, "getextattr")) {