diff options
author | johan <johan@FreeBSD.org> | 2002-07-03 19:19:54 +0000 |
---|---|---|
committer | johan <johan@FreeBSD.org> | 2002-07-03 19:19:54 +0000 |
commit | 7e4388a823be62c64ca5ebf8302f2bc7900ae6da (patch) | |
tree | efdbdbf0fd2090e5aeed8e6c1926db8d081d675d /usr.bin/whereis | |
parent | b45df6b9b5be84f2c48e3390856b4a90822f179b (diff) | |
download | FreeBSD-src-7e4388a823be62c64ca5ebf8302f2bc7900ae6da.zip FreeBSD-src-7e4388a823be62c64ca5ebf8302f2bc7900ae6da.tar.gz |
Remove -p flag.
OpenBSD's implementation lacks -p, and we don't want to
support the option now, only to lose it if/when we later
switch to OpenBSD's implementation.
This functionality is provided by which(1).
Approved by: sheldonh (mentor)
Diffstat (limited to 'usr.bin/whereis')
-rw-r--r-- | usr.bin/whereis/whereis.1 | 7 | ||||
-rw-r--r-- | usr.bin/whereis/whereis.c | 42 |
2 files changed, 16 insertions, 33 deletions
diff --git a/usr.bin/whereis/whereis.1 b/usr.bin/whereis/whereis.1 index 2a03b92..9cbb7fc 100644 --- a/usr.bin/whereis/whereis.1 +++ b/usr.bin/whereis/whereis.1 @@ -42,7 +42,6 @@ .Nd locate programs .Sh SYNOPSIS .Nm -.Op Fl p .Ar program .Op Ar program ... .Sh DESCRIPTION @@ -56,12 +55,6 @@ The default path searched is the string returned by the utility for the .Dq user.cs_path string. -If the -.Op Fl p -option is specified, then the value of the environment -variable -.Ev PATH -is used instead. .Sh SEE ALSO .Xr which 1 , .Xr sysctl 8 diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c index 0bea8f8..27c0079 100644 --- a/usr.bin/whereis/whereis.c +++ b/usr.bin/whereis/whereis.c @@ -65,14 +65,9 @@ main(argc, argv) size_t len; int ch, sverrno, mib[2]; char *p, *t, *std, path[MAXPATHLEN]; - int useenvpath = 0; - while ((ch = getopt(argc, argv, "p")) != -1) + while ((ch = getopt(argc, argv, "")) != -1) switch (ch) { - case 'p': - useenvpath = 1; /* use environment for PATH */ - break; - case '?': default: usage(); @@ -83,25 +78,20 @@ main(argc, argv) if (argc == 0) usage(); - if (useenvpath) { - if ((std = getenv("PATH")) == NULL) - err(1, "getenv: PATH" ); - } else { - /* Retrieve the standard path. */ - mib[0] = CTL_USER; - mib[1] = USER_CS_PATH; - if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1) - return (-1); - if (len == 0) - err(1, "user_cs_path: sysctl: zero length"); - if ((std = malloc(len)) == NULL) - err(1, NULL); - if (sysctl(mib, 2, std, &len, NULL, 0) == -1) { - sverrno = errno; - free(std); - errno = sverrno; - err(1, "sysctl: user_cs_path"); - } + /* Retrieve the standard path. */ + mib[0] = CTL_USER; + mib[1] = USER_CS_PATH; + if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1) + return (-1); + if (len == 0) + err(1, "user_cs_path: sysctl: zero length"); + if ((std = malloc(len)) == NULL) + err(1, NULL); + if (sysctl(mib, 2, std, &len, NULL, 0) == -1) { + sverrno = errno; + free(std); + errno = sverrno; + err(1, "sysctl: user_cs_path"); } /* For each path, for each program... */ @@ -129,6 +119,6 @@ void usage() { - (void)fprintf(stderr, "usage: whereis [-p] program [...]\n"); + (void)fprintf(stderr, "usage: whereis program [...]\n"); exit (1); } |