From 544f1a7f941301724f291cb2b61a92eff0d0157e Mon Sep 17 00:00:00 2001 From: johan Date: Wed, 24 Jul 2002 14:35:29 +0000 Subject: Teach whereis(1) about games. Approved by: joerg, sheldonh (mentor) --- usr.bin/whereis/pathnames.h | 5 +++-- usr.bin/whereis/whereis.1 | 3 ++- usr.bin/whereis/whereis.c | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/whereis/pathnames.h b/usr.bin/whereis/pathnames.h index 2ffe2f1..569c72e 100644 --- a/usr.bin/whereis/pathnames.h +++ b/usr.bin/whereis/pathnames.h @@ -34,7 +34,8 @@ "/usr/src/gnu/libexec:/usr/src/contrib:" \ "/usr/src/secure/bin:/usr/src/secure/usr.bin:" \ "/usr/src/secure/sbin:/usr/src/secure/usr.sbin:" \ -"/usr/src/secure/libexec:/usr/src/crypto" +"/usr/src/secure/libexec:/usr/src/crypto:" \ +"/usr/src/games" /* Each subdirectory of PATH_PORTS will be appended to PATH_SOURCES. */ #define PATH_PORTS "/usr/ports" @@ -43,7 +44,7 @@ #define MANPATHCMD "manpath -q" /* How to obtain the location of manpages, and how to match this result. */ -#define MANWHEREISCMD "man -S1:8 -w %s 2>/dev/null" +#define MANWHEREISCMD "man -S1:8:6 -w %s 2>/dev/null" #define MANWHEREISMATCH "^.* [(]source: (.*)[)]$" /* Command used to locate sources that have not been found yet. */ diff --git a/usr.bin/whereis/whereis.1 b/usr.bin/whereis/whereis.1 index c8257dd..12b9b98 100644 --- a/usr.bin/whereis/whereis.1 +++ b/usr.bin/whereis/whereis.1 @@ -68,7 +68,8 @@ The default path searched is the string returned by the utility for the .Dq user.cs_path string, with -.Pa /usr/libexec +.Pa /usr/libexec , +.Pa /usr/games and the current user's .Ev $PATH appended. Manual pages are searched by default along the diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c index 84584b2..b2a79d2 100644 --- a/usr.bin/whereis/whereis.c +++ b/usr.bin/whereis/whereis.c @@ -259,7 +259,8 @@ defaults(void) if (!opt_b && !opt_m && !opt_s) opt_b = opt_m = opt_s = 1; - /* -b defaults to default path + /usr/libexec + user's path */ + /* -b defaults to default path + /usr/libexec + + * /usr/games + user's path */ if (!bindirs) { if (sysctlbyname("user.cs_path", (void *)NULL, &s, (void *)NULL, 0) == -1) @@ -270,10 +271,11 @@ defaults(void) err(EX_OSERR, "sysctlbyname(\"user.cs_path\")"); nele = 0; decolonify(b, &bindirs, &nele); - bindirs = realloc(bindirs, (nele + 2) * sizeof(char *)); + bindirs = realloc(bindirs, (nele + 3) * sizeof(char *)); if (bindirs == NULL) abort(); bindirs[nele++] = "/usr/libexec"; + bindirs[nele++] = "/usr/games"; bindirs[nele] = NULL; if ((cp = getenv("PATH")) != NULL) { /* don't destroy the original environment... */ -- cgit v1.1