From 656b79b51e0f0a0c26e73b8b7c61e7cca8cbb600 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 11 Mar 2008 00:04:49 +0000 Subject: Fix getting MAC address on NetBSD. --- net.BSD/ifconfig.sh | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/net.BSD/ifconfig.sh b/net.BSD/ifconfig.sh index d56ba259..6f961776 100644 --- a/net.BSD/ifconfig.sh +++ b/net.BSD/ifconfig.sh @@ -18,24 +18,6 @@ _exists() fi } -_get_mac_address() -{ - local proto= address= foo= - LC_ALL=C ifconfig "${IFACE}" | while read proto address foo; do - case "${proto}" in - ether) - case "${address}" in - 00:00:00:00:00:00);; - 44:44:44:44:44:44);; - FF:FF:FF:FF:FF:FF);; - *) echo "${address}";; - esac - return 0 - ;; - esac - done -} - _up() { ifconfig "${IFACE}" up @@ -79,11 +61,30 @@ _ifconfig_ent() { LC_ALL=C ifconfig "${IFACE}" 2>/dev/null | while read ent rest; do case "${ent}" in - "$1") echo "${rest}";; + $1) echo "${rest}";; esac done } +_get_mac_address() +{ + local ent="ether" + case "${RC_UNAME}" in + NetBSD|OpenBSD) ent="address:";; + esac + + case $(_ifconfig_ent "${ent}") in + 00:00:00:00:00:00);; + 44:44:44:44:44:44);; + FF:FF:FF:FF:FF:FF);; + "") return 1;; + *) echo "${address}";; + esac + + return 0; +} + + _is_wireless() { case "$(_ifconfig_ent "media:")" in -- cgit v1.2.3