date and time created 83/02/14 18:02:59 by mckusick
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 15 Feb 1983 10:02:59 +0000 (02:02 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 15 Feb 1983 10:02:59 +0000 (02:02 -0800)
SCCS-vsn: old/which/which.csh 4.1

usr/src/old/which/which.csh [new file with mode: 0644]

diff --git a/usr/src/old/which/which.csh b/usr/src/old/which/which.csh
new file mode 100644 (file)
index 0000000..67e806d
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/csh
+#
+#      @(#)which.csh   4.1     (Berkeley)      83/02/14
+#
+#      which : tells you which program you get
+#      hacked to do aliases (from .cshrc file only!)
+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