summaryrefslogtreecommitdiffstats
path: root/usr.bin/which
diff options
context:
space:
mode:
authorasami <asami@FreeBSD.org>1995-07-31 04:22:07 +0000
committerasami <asami@FreeBSD.org>1995-07-31 04:22:07 +0000
commit1fd348a456d0d3e1a8304bd1aaaf358849de586d (patch)
tree3d02154d923b7aaf52fee41e05a7e908501e9a91 /usr.bin/which
parentb9255f3bd351f87a67addee21c295a255262d9a7 (diff)
downloadFreeBSD-src-1fd348a456d0d3e1a8304bd1aaaf358849de586d.zip
FreeBSD-src-1fd348a456d0d3e1a8304bd1aaaf358849de586d.tar.gz
Submitted by: Torbjorn Granlund <tege@matematik.su.se>
* /usr/bin/which doesn't work if a complete path is passed to it. This is incompatible with other flavours of Unix, Here is a suggested patch:
Diffstat (limited to 'usr.bin/which')
-rwxr-xr-xusr.bin/which/which.pl19
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/which/which.pl b/usr.bin/which/which.pl
index c6ebc06..678466b 100755
--- a/usr.bin/which/which.pl
+++ b/usr.bin/which/which.pl
@@ -31,7 +31,7 @@
#
# [whew!]
#
-# $Id: which.pl,v 1.3 1995/01/30 17:49:19 asami Exp $
+# $Id: which.pl,v 1.4 1995/01/30 22:21:29 jkh Exp $
$all = 0;
$silent = 0;
@@ -47,13 +47,18 @@ if ($ARGV[0] eq "-a") {
}
foreach $prog (@ARGV) {
- foreach $e (@path) {
- if (-x "$e/$prog") {
- print "$e/$prog\n" unless $silent;
+ if (-x "$prog") {
+ print "$prog\n" unless $silent;
$found = 1;
- last unless $all;
- }
- }
+ } else {
+ foreach $e (@path) {
+ if (-x "$e/$prog") {
+ print "$e/$prog\n" unless $silent;
+ $found = 1;
+ last unless $all;
+ }
+ }
+ }
}
exit (!$found);
OpenPOWER on IntegriCloud