#!/bin/sh
# On some GNU/Linux boxes (especially, a DHCP client), we can't resolve the local hostname.
# In such cases, we use a simple script to get the local IP address.

if test "$1" = "6"
then
    #IPV6
    LANG=C /sbin/ifconfig -a | sed -n '/.*inet6 addr: \([0-9a-z:]*\)\/\([0-9]*\).*/ {s//\1 \2/p;q;}'
else
    LANG=C /sbin/ifconfig -a | sed -n '/.*inet addr:\([0-9.]*\).*Mask:\([0-9.]*\)/ {s//\1 \2/p;q;}'
fi
