#!/bin/sh -
#
# pccardether interfacename [ifconfig option]
#
# example: pccardether nep0 link1
#
# HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
#

# Suck in the /etc/sysconfig variables
if [ -f /etc/sysconfig ]; then
	. /etc/sysconfig
fi

interface=$1
shift

if [ "x$pccard_ether" != "xNO" ] ; then
	eval ifconfig_args=\$ifconfig_${interface}
	if [ "x$ifconfig_args" = "xDHCP" ] ; then
		/usr/local/sbin/dhcpc $interface
	else
		ifconfig $interface $ifconfig_args $*
	fi
fi

if [ -n "$defaultrouter" -a "x$defaultrouter" != "xNO" ] ; then
        static_routes="default ${static_routes}"
        route_default="default ${defaultrouter}"
fi

# Set up any static routes.  This should be done before router discovery.
if [ "x${static_routes}" != "x" ]; then
	route -n flush
        for i in ${static_routes}; do
                eval route_args=\$route_${i}
                route add ${route_args}
        done
fi
