Optimize f_which() to be slightly faster still.

This commit is contained in:
Devin Teske 2014-08-24 16:40:31 +00:00
parent c83655f334
commit 36fb8bfcd3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270505

View File

@ -263,10 +263,10 @@ f_which()
{
local __name="$1" __var_to_set="$2"
case "$__name" in */*|'') return $FAILURE; esac
local __p IFS=":" __found=
local __p __exec IFS=":" __found=
for __p in $PATH; do
local __exec="$__p/$__name"
[ -f "$__exec" -a -x "$__exec" ] && __found=1 && break
__exec="$__p/$__name"
[ -f "$__exec" -a -x "$__exec" ] && __found=1 break
done
if [ "$__found" ]; then
if [ "$__var_to_set" ]; then