#
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1980 Regents of the University of California.
# All rights reserved. The Berkeley Software License Agreement
# specifies the terms and conditions for redistribution.
#
#ident "%Z%%M% %I% %E% SMI"
#
# which : tells you which program you get
#
# Set prompt so .cshrc will think we're interactive and set aliases.
# Save and restore path to prevent .cshrc from messing it up.
set _which_saved_path_ = ( $path )
set prompt = ""
set path = ( $_which_saved_path_ )
unset prompt _which_saved_path_
set noglob
set exit_status = 0
switch ( $#alius )
case 0 :
case 1 :
default :
continue
unset found
if ( -e $arg ) then # just do simple lookup
echo $arg
else
set exit_status = 1
continue
else
foreach i ( $path )
echo $i/$arg
set found
break
end
if ( ! $?found ) then
set exit_status = 1
end
exit ${exit_status}