# Print network interface status


Eth_Ok(){
    local iface="$1"
    
    ip link show "$iface" &> /dev/null
    if [ $? != 0 ]; then
        echo "None"
        return 0
    fi
    
    ip link show "$iface" 2> /dev/null | grep NO-CARRIER > /dev/null
    if [ $? = 0 ]; then
        echo "Cable unplugged"
    else
        echo "OK"
    fi
}


PrintEth(){
    local iface="$1"
    local comment="$2"
    
    test -e /etc/init.d/network_"$iface" && {
        echo -n "| $comment     = $(Eth_Ok "$iface")"
    }
}

