summaryrefslogtreecommitdiffstats
path: root/usr.bin/whereis/whereis.c
diff options
context:
space:
mode:
authorjohan <johan@FreeBSD.org>2002-07-03 19:19:54 +0000
committerjohan <johan@FreeBSD.org>2002-07-03 19:19:54 +0000
commit7e4388a823be62c64ca5ebf8302f2bc7900ae6da (patch)
treeefdbdbf0fd2090e5aeed8e6c1926db8d081d675d /usr.bin/whereis/whereis.c
parentb45df6b9b5be84f2c48e3390856b4a90822f179b (diff)
downloadFreeBSD-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/whereis.c')
-rw-r--r--usr.bin/whereis/whereis.c42
1 files changed, 16 insertions, 26 deletions
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);
}
OpenPOWER on IntegriCloud