]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- return val doc for check_{mii_tool,ethtool,iwconfig}
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 24 Mar 2008 19:16:03 +0000 (19:16 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Mon, 24 Mar 2008 19:16:03 +0000 (19:16 +0000)
- code readability

svn-id: @9667

sysconfig/network-scripts/functions.network

index 4c8c7446277f3737b11ab4c12ea0a9be85f1e7e8..db7b136571597a590162c1f405facc3bfc98364c 100644 (file)
@@ -41,7 +41,7 @@ do_netreport ()
 {
        # Notify programs that have requested notification
        ( cd /var/run/netreport || exit
-       for i in * ; do
+       for i in *; do
                [ -f $i ] && kill -SIGIO $i >/dev/null 2>&1 || \
                        rm -f $i >/dev/null 2>&1
        done
@@ -51,8 +51,7 @@ do_netreport ()
 need_hostname()
 {
        local hostname=$(hostname)
-       if [ "$hostname" = "(none)" -o "$hostname" = "localhost" -o \
-            "$hostname" = "localhost.localdomain" ]; then
+       if [ "$hostname" = "(none)" -o "$hostname" = "localhost" -o "$hostname" = "localhost.localdomain" ]; then
                NEEDHOSTNAME=yes
        else
                unset NEEDHOSTNAME
@@ -72,7 +71,8 @@ set_hostname()
        fi
 
        if [ "$domain" ]; then
-               >/etc/resolv.conf.new
+               # XXX umask and possible /etc/resolv.conf symlink breakage
+               > /etc/resolv.conf.new
                if ! grep -q "search $domain" /etc/resolv.conf ; then
                        echo "search $domain" >> /etc/resolv.conf.new
                fi
@@ -562,28 +562,48 @@ wireless_param()
        fi
 }
 
+# returns
+# 0 - no link
+# 1 - link ok
+# 2 - unsupported, unknown return
 check_mii_tool ()
 {
        [ -x /sbin/mii-tool ] || return 2
        output=$(LC_ALL=C mii-tool $1 2>&1)
        echo $output | grep -q "link ok" && return 1
-       echo $output | grep -q "no link" && return 0 || return 2
+       echo $output | grep -q "no link" && return 0
+       return 2
 }
 
+# returns
+# 0 - link off
+# 1 - link on
+# 2 - unsupported, unknown return
 check_ethtool ()
 {
        [ -x /sbin/ethtool ] || return 2
        output=$(LC_ALL=C ethtool $1 2>&1)
        echo $output | grep -q "Link detected: yes" && return 1
-       echo $output | grep -q "Link detected: no" && return 0 || return 2
+       echo $output | grep -q "Link detected: no" && return 0
+       return 2
 }
 
+# returns
+# 0 - radio off
+# 1 - radio on
+# 2 - unsupported
 check_iwconfig ()
 {
        [ -x /sbin/iwconfig ] || return 2
-       LC_ALL=C iwconfig "$1" 2>&1 | grep -q "radio off" && return 0 || return 2
+       output=$(LC_ALL=C iwconfig "$1" 2>&1)
+       echo "$output" | grep -q "radio off" && return 0
+       # XXX why no 'radio on' check?
+       return 2
 }
 
+# returns
+# 0 - link down
+# 1 - link up
 check_link_down ()
 {
        if [ -x /sbin/mii-tool -o -x /sbin/ethtool -o -x /sbin/iwconfig ]; then
This page took 0.226851 seconds and 4 git commands to generate.