+# by ddzeko, Mon, 21 Mar 2005 07:00:22 +0100
+cp_get_ifdefault() {
+ [ "$CP_SCRIPT_DEBUG" ] && set -vx
+ RET=""
+ case $1 in
+ dev) RET=`route -n | awk '/^0.0.0.0/{print $8}'` ;;
+ addr) RET=`route -n | awk '/^0.0.0.0/{print $2}'` ;;
+ *) echo "cp_get_ifdefault: Argument required (dev or addr)" >&2 ;;
+ esac
+ [ -z "$RET" -a "$1" -a "$CP_VERBOSE" ] && echo "cp_get_ifdefault: No default route" >&2
+ [ -z "$CP_ECHO_RETURN" ] || echo $RET
+ [ -z "$RET" ] && return 1
+}