aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/which
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1993-11-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1993-11-01 08:00:00 +0000
commit8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (patch)
treec5b2ce776438e0a52b492a2ab6ab41360b8ba1f6 /usr.bin/which
This commit was manufactured to restore the state of the 1.0-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
Diffstat (limited to 'usr.bin/which')
-rw-r--r--usr.bin/which/Makefile9
-rw-r--r--usr.bin/which/which.172
-rw-r--r--usr.bin/which/which.csh75
3 files changed, 156 insertions, 0 deletions
diff --git a/usr.bin/which/Makefile b/usr.bin/which/Makefile
new file mode 100644
index 000000000000..1e17feb11298
--- /dev/null
+++ b/usr.bin/which/Makefile
@@ -0,0 +1,9 @@
+# @(#)Makefile 5.5 (Berkeley) 7/1/90
+
+MAN1= which.1
+
+beforeinstall:
+ install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ ${.CURDIR}/which.csh ${DESTDIR}${BINDIR}/which
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/which/which.1 b/usr.bin/which/which.1
new file mode 100644
index 000000000000..beb3c148fd98
--- /dev/null
+++ b/usr.bin/which/which.1
@@ -0,0 +1,72 @@
+.\" Copyright (c) 1980, 1991 Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)which.1 6.3 (Berkeley) 4/23/91
+.\"
+.Dd April 23, 1991
+.Dt WHICH 1
+.Os BSD 3
+.Sh NAME
+.Nm which
+.Nd "locate a program file including aliases and paths"
+.Pq Xr csh 1
+only)
+.Sh SYNOPSIS
+.Nm which
+.Op Ar name
+.Ar ...
+.Sh DESCRIPTION
+.Nm Which
+takes a list of names and looks for the files which would be
+executed had these names been given as commands.
+Each argument is expanded if it is aliased,
+and searched for along the user's path.
+Both aliases and path are taken from the user's
+.Pa \&.cshrc
+file.
+.Sh FILES
+.Bl -tag -width ~/\&.cshrc
+.It Pa ~/\&.cshrc
+source of aliases and path values
+.El
+.Sh DIAGNOSTICS
+A diagnostic is given for names which are aliased to more than a single
+word,
+or if an executable file with the argument name was not found in the path.
+.Sh BUGS
+Must be executed by a
+.Xr csh 1 ,
+or some other shell which knows about aliases.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 3.0 .
diff --git a/usr.bin/which/which.csh b/usr.bin/which/which.csh
new file mode 100644
index 000000000000..5295deb24578
--- /dev/null
+++ b/usr.bin/which/which.csh
@@ -0,0 +1,75 @@
+#!/bin/csh
+#
+# DO NOT USE "csh -f"
+#
+# Copyright (c) 1983 The Regents of the University of California.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the University of
+# California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# @(#)which.csh 5.5 (Berkeley) 4/18/91
+#
+
+# which : tells you which program you get
+#
+set prompt = "% "
+set noglob
+foreach arg ( $argv )
+ set alius = `alias $arg`
+ switch ( $#alius )
+ case 0 :
+ breaksw
+ case 1 :
+ set arg = $alius[1]
+ breaksw
+ default :
+ echo ${arg}: " " aliased to $alius
+ continue
+ endsw
+ unset found
+ if ( $arg:h != $arg:t ) then
+ if ( -e $arg ) then
+ echo $arg
+ else
+ echo $arg not found
+ endif
+ continue
+ else
+ foreach i ( $path )
+ if ( -x $i/$arg && ! -d $i/$arg ) then
+ echo $i/$arg
+ set found
+ break
+ endif
+ end
+ endif
+ if ( ! $?found ) then
+ echo no $arg in $path
+ endif
+end