Use basename(3).
This commit is contained in:
parent
a7a73b95d1
commit
987d3799f3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108443
@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fts.h>
|
#include <fts.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
#include <libgen.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -79,9 +80,7 @@ main(int argc, char **argv)
|
|||||||
int ch, fts_options, rval;
|
int ch, fts_options, rval;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
cp = strrchr(argv[0], '/');
|
ischown = (strcmp(basename(argv[0]), "chown") == 0);
|
||||||
cp = (cp != NULL) ? cp + 1 : argv[0];
|
|
||||||
ischown = (strcmp(cp, "chown") == 0);
|
|
||||||
|
|
||||||
Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
|
Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
|
||||||
while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
|
while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user