net.lo: Add the ability to find the full path of a binary

Some of the networking tools, such as iproute2, can be stored in one of
several locations. This function gives us a standard way to find these
tools.

I would like to thankRobin Johnson <robbat2@gentoo.org> for his input on
this function.
This commit is contained in:
William Hubbs 2012-01-07 13:09:17 -06:00
parent adde73141f
commit f2e404ab66

View File

@ -169,6 +169,18 @@ _configure_variables()
done done
} }
_which()
{
local i OIFS
[ -z "$1" ] && return
OIFS="$IFS"
IFS=:
for i in $PATH ; do
[ -x $i/$1 ] && echo $i/$1 && break
done
IFS=$OIFS
}
_show_address() _show_address()
{ {
einfo "received address $(_get_inet_address "${IFACE}")" einfo "received address $(_get_inet_address "${IFACE}")"