Commit Graph

21 Commits

Author SHA1 Message Date
apb 4de4994446 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.
2008-10-17 10:53:26 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
martin ef30089df2 Apply patch from Michael van Elst to fix PR bin/34114:
which doesn't handle commands given as absolute pathnames.
2006-07-30 11:50:29 +00:00
christos dbf34104b4 PR/25680: Christian Biere: whereis/which return invalid information with
huge path
2004-05-23 02:24:06 +00:00
christos 54c7540419 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).
2004-04-01 22:14:48 +00:00
christos 60a197ff0e Fix const problem. 2004-04-01 21:41:14 +00:00
christos 745a6d0f0e - 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.
2004-04-01 20:50:32 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
perry df28067f6e 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.
2003-04-03 18:16:45 +00:00
itojun f51456c273 err/errx/warn/warnx do not need \n at the end 2002-06-11 06:06:18 +00:00
drochner 85cbf55d16 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.
1999-11-09 15:06:30 +00:00
fair 64b1551844 Apply patch, KNF'd, from PR#3363 to add a "-p" option to whereis. 1999-03-11 10:42:43 +00:00
mrg 9998247baa WARNSify; clean up .Nm usage 1997-10-20 02:22:55 +00:00
mikel f5a8ade241 return 0 on successful exit, compare getopt() result to -1 instead of EOF. 1997-01-23 06:29:05 +00:00
jtc be667101f6 Sync with 44lite2 1995-08-31 21:54:51 +00:00
mycroft dd831dd13a 4.4-Lite version, slightly edited. 1994-09-18 02:14:32 +00:00
jtc 0ff865f224 Use <dirent.h> instead of <sys/dir.h>. 1993-12-04 01:08:35 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
mycroft 2da3166a31 /usr/src/usr.lib --> /usr/src/lib, and add some /usr/src/gnu paths. 1993-06-22 00:53:15 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00