History log of /openbsd-current/usr.bin/which/which.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.27 25-Jan-2019 millert

I am retiring my old email address; replace it with my OpenBSD one.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.26 28-Oct-2016 schwarze

Delete some useless setlocale(3) calls in /usr/bin, no functional change.
Patches from Jan Stary <hans at stare dot cz>, tweaked by me and tb@.
While here, apply some simple style improvements:
Sort headers, static void __dead usage(), return from main(),
zap case '?', drop /* NOTREACHED */, drop break after usage(), ...
OK tb@ millert@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.25 14-Jan-2016 millert

Check the return value of snprintf() for potential overflow instead
of doing a manual check beforehand.


# 1.24 14-Jan-2016 millert

Avoid potential read of one byte before the start of a malloc()ed
buffer. From Max Fillinger.


# 1.23 14-Jan-2016 millert

Use _PATH_DEFPATH if no PATH in the environment when invoked as which.


# 1.22 29-Dec-2015 gsoares

fix exit status on pledge(2) failure.

OK tb@ jsg@


# 1.21 10-Oct-2015 deraadt

pledge "stdio rpath"
ok beck doug


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.20 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.19 20-May-2014 guenther

Use errc/warnc to simplify code.
Also, in 'ftp', always put the error message last, after the hostname/ipaddr.

ok jsing@ krw@ millert@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.18 10-Apr-2013 guenther

Get the standard path from _PATH_STDPATH instead of
sysctl({CTL_USER,USER_CS_PATH}). Expand that into the manpage
too.

_PATH_STDPATH suggested by miod@
Corrections from schwarze@ and jmc@
ok millert@ miod@ schwarze@ jmc@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.17 11-Mar-2011 guenther

The -a option shouldn't change the exit status
Patch from David Julio (david.a.julio at gmail.com)


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.16 31-May-2010 sobrado

stderr should be used for error messages; this diff makes which(1)
output not only more standard but also more predictable, as it now
matches the behavior of the csh(1)'s built-in command.

diff from Tobias Ulmer.

ok millert@


Revision tags: OPENBSD_4_7_BASE
# 1.15 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.14 14-Aug-2007 sobrado

the ellipsis is not an optional argument; document the "-a" flag in whereis(1)

help and feedback by jmc@ and otto@

ok deraadt@, jmc@ and otto@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.13 24-Sep-2004 fgsch

save a copy of the pointer before strsep; fixes an abort on free.
ok by millert, otto & pedro.


# 1.12 23-Sep-2004 millert

Add missing free on error; Alison Winters
Also KNF the return statements and make usage() __dead while I am here.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.11 17-Jun-2003 millert

Sync with share/misc/license.template and add missing DARPA credit
where applicable.


# 1.10 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.9 03-Jun-2003 millert

Use an ISC-tyle license for all my code; it is simpler and more permissive.


# 1.8 04-Apr-2003 millert

snprintf() is simpler than multiple strlcpy() and manual fiddling.
Also convert to C89 while I'm at it.


# 1.7 04-Apr-2003 deraadt

snprintf & strlcpy; tedu ok


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.6 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.5 21-Jun-1998 millert

Remove the advertising clause in my old license, it impedes free use
of the code as a large number of similar clauses makes it impossible
to write an ad for a product using the code...


# 1.4 07-May-1998 deraadt

fix err() use


Revision tags: OPENBSD_2_3_BASE
# 1.3 28-Jan-1998 millert

Add -a flag. Idea from bgrayson@ece.utexas.edu


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 08-Apr-1997 millert

which(1) and whereis(1) are now the same program (hard linked).


# 1.1 21-Feb-1997 millert

which(1) is now a binary that works in any shell since csh(1) has a
which built-in.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.26 28-Oct-2016 schwarze

Delete some useless setlocale(3) calls in /usr/bin, no functional change.
Patches from Jan Stary <hans at stare dot cz>, tweaked by me and tb@.
While here, apply some simple style improvements:
Sort headers, static void __dead usage(), return from main(),
zap case '?', drop /* NOTREACHED */, drop break after usage(), ...
OK tb@ millert@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.25 14-Jan-2016 millert

Check the return value of snprintf() for potential overflow instead
of doing a manual check beforehand.


# 1.24 14-Jan-2016 millert

Avoid potential read of one byte before the start of a malloc()ed
buffer. From Max Fillinger.


# 1.23 14-Jan-2016 millert

Use _PATH_DEFPATH if no PATH in the environment when invoked as which.


# 1.22 29-Dec-2015 gsoares

fix exit status on pledge(2) failure.

OK tb@ jsg@


# 1.21 10-Oct-2015 deraadt

pledge "stdio rpath"
ok beck doug


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.20 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_6_BASE
# 1.19 20-May-2014 guenther

Use errc/warnc to simplify code.
Also, in 'ftp', always put the error message last, after the hostname/ipaddr.

ok jsing@ krw@ millert@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.18 10-Apr-2013 guenther

Get the standard path from _PATH_STDPATH instead of
sysctl({CTL_USER,USER_CS_PATH}). Expand that into the manpage
too.

_PATH_STDPATH suggested by miod@
Corrections from schwarze@ and jmc@
ok millert@ miod@ schwarze@ jmc@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.17 11-Mar-2011 guenther

The -a option shouldn't change the exit status
Patch from David Julio (david.a.julio at gmail.com)


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.16 31-May-2010 sobrado

stderr should be used for error messages; this diff makes which(1)
output not only more standard but also more predictable, as it now
matches the behavior of the csh(1)'s built-in command.

diff from Tobias Ulmer.

ok millert@


Revision tags: OPENBSD_4_7_BASE
# 1.15 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.14 14-Aug-2007 sobrado

the ellipsis is not an optional argument; document the "-a" flag in whereis(1)

help and feedback by jmc@ and otto@

ok deraadt@, jmc@ and otto@


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.13 24-Sep-2004 fgsch

save a copy of the pointer before strsep; fixes an abort on free.
ok by millert, otto & pedro.


# 1.12 23-Sep-2004 millert

Add missing free on error; Alison Winters
Also KNF the return statements and make usage() __dead while I am here.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.11 17-Jun-2003 millert

Sync with share/misc/license.template and add missing DARPA credit
where applicable.


# 1.10 10-Jun-2003 deraadt

mostly ansi cleanup; pval ok


# 1.9 03-Jun-2003 millert

Use an ISC-tyle license for all my code; it is simpler and more permissive.


# 1.8 04-Apr-2003 millert

snprintf() is simpler than multiple strlcpy() and manual fiddling.
Also convert to C89 while I'm at it.


# 1.7 04-Apr-2003 deraadt

snprintf & strlcpy; tedu ok


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.6 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE
# 1.5 21-Jun-1998 millert

Remove the advertising clause in my old license, it impedes free use
of the code as a large number of similar clauses makes it impossible
to write an ad for a product using the code...


# 1.4 07-May-1998 deraadt

fix err() use


Revision tags: OPENBSD_2_3_BASE
# 1.3 28-Jan-1998 millert

Add -a flag. Idea from bgrayson@ece.utexas.edu


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.2 08-Apr-1997 millert

which(1) and whereis(1) are now the same program (hard linked).


# 1.1 21-Feb-1997 millert

which(1) is now a binary that works in any shell since csh(1) has a
which built-in.