Home | History | Annotate | Download | only in whereis
History log of /src/usr.bin/whereis/whereis.c
RevisionDateAuthorComments
 1.22  01-Jun-2025  jschauma PR bin/59449: use setregid(2)/setreuid(2) instead of setgid(2)/setuid(2)

This allows the calls to succeed when a non-root user runs
with e[gu]id != [gu]id and then produce the correct output.

Fix suggested by @kre.
 1.21  17-Oct-2008  apb branches: 1.21.72;
Fix a bug in which which(1) would check only the first element of the
path for all args except the first. So "which cp vi" found /bin/cp
using the first entry in the path, but failed to find /usr/bin/vi
using the second entry in the path, although "whereis cp vi" worked.
Restoring the ":" was done in the wrong place.

Also fix a bug in which an arg beginning with "/" would cause all
subsequent args to be ignored. A "break" should have been "continue".
Add comments to all break and continue statements saying what they are
intended to do.

Also add braces around the body of a for loop which contained only one
multi-line statement.
 1.20  21-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.19  15-Dec-2007  perry branches: 1.19.6;
convert __attribute__s to applicable cdefs.h macros
 1.18  30-Jul-2006  martin branches: 1.18.10;
Apply patch from Michael van Elst to fix PR bin/34114:
which doesn't handle commands given as absolute pathnames.
 1.17  23-May-2004  christos branches: 1.17.2; 1.17.4;
PR/25680: Christian Biere: whereis/which return invalid information with
huge path
 1.16  01-Apr-2004  christos Set our uid and gid to the effective user and group id's of the current
process so that access(2) DTRT's (from Peter Postma).
 1.15  01-Apr-2004  christos Fix const problem.
 1.14  01-Apr-2004  christos - add which(1) functionality.
- fix bug where if a program appeared in more than one place it would
erroneously exit(2)
- fix error messages to use err and errx as appropriate.
- made sure we don't pick up directories or non executable files.
 1.13  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.12  03-Apr-2003  perry Return non-zero exit status if the listed programs aren't found.
Submitted by Gabriel Gonzalez in PR bin/20984
I deviated from the patch by returning 2 if only some programs were
located and 3 if none were. The submitted patch returned 1 and 2,
respectively, and 1 is already used for general error.
 1.11  11-Jun-2002  itojun err/errx/warn/warnx do not need \n at the end
 1.10  09-Nov-1999  drochner Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
 1.9  11-Mar-1999  fair branches: 1.9.6;
Apply patch, KNF'd, from PR#3363 to add a "-p" option to whereis.
 1.8  20-Oct-1997  mrg WARNSify; clean up .Nm usage
 1.7  23-Jan-1997  mikel return 0 on successful exit, compare getopt() result to -1 instead of EOF.
 1.6  31-Aug-1995  jtc Sync with 44lite2
 1.5  18-Sep-1994  mycroft 4.4-Lite version, slightly edited.
 1.4  04-Dec-1993  jtc Use <dirent.h> instead of <sys/dir.h>.
 1.3  01-Aug-1993  mycroft Add RCS identifiers.
 1.2  22-Jun-1993  mycroft /usr/src/usr.lib --> /usr/src/lib, and add some /usr/src/gnu paths.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  31-Aug-1995  jtc imported from 44lite2
 1.1.1.2  18-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.9.6.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.4.1  10-Aug-2006  tron Pull up following revision(s) (requested by cube in ticket #1456):
usr.bin/whereis/whereis.c: revision 1.18
Apply patch from Michael van Elst to fix PR bin/34114:
which doesn't handle commands given as absolute pathnames.
 1.17.2.1  10-Aug-2006  tron Pull up following revision(s) (requested by cube in ticket #1456):
usr.bin/whereis/whereis.c: revision 1.18
Apply patch from Michael van Elst to fix PR bin/34114:
which doesn't handle commands given as absolute pathnames.
 1.18.10.1  09-Jan-2008  matt sync with HEAD
 1.19.6.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.21.72.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed