sbase/which.1
FRIGN b333176b8c Refactor and audit which(1)
Use the *at functions instead of building paths manually. We do
still have path-building in recurse() and other areas, but the
long-term goal is to rid most interfaces of that for practical
and security reasons.
In this case, it's more or less trivial.

Also, refactor the manpage to be more consistent with the others.

BUGFIX: Return exit status 3 on error.
2015-04-27 19:33:57 +01:00

45 lines
575 B
Groff

.Dd April 27, 2015
.Dt WHICH 1
.Os sbase
.Sh NAME
.Nm which
.Nd locate programs in the path
.Sh SYNOPSIS
.Nm
.Op Fl a
.Ar name ...
.Sh DESCRIPTION
.Nm
looks for each
.Ar name
in the
.Ev PATH
directories, stopping at the first match and printing
the full path to stdout.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl a
Don't stop at the first match and search all
.Ev PATH
directories.
.El
.Sh EXIT STATUS
.Bl -tag -width Ds
.It 0
Each
.Ar name
was found.
.It 1
At least one
.Ar name
was not found.
.It 2
No
.Ar name
was found.
.It 3
An error occurred.
.El
.Sh SEE ALSO
.Xr environ 7