#!/bin/sh
# $NetBSD: script,v 1.3 2005/02/22 16:53:11 peter Exp $
INTFS=`ifconfig -l | sed -e \
 's/lo.//g;s/strip.//g;s/tun.//g;s/ipip.//g;s/eon.//g;s/gre.//g;s/gif.//g'`
echo "Intf#	State	Media    	IPv4 Addr.	IPv6 Addr."
echo "---------------------------------------------------------------------------"
(for i in $INTFS
do
	ifconfig $i | grep UP >/dev/null
	if [ "$?" = "0" ]; then
		FOO=`echo "$i	up"`
	else
		FOO=`echo "$i	down"`
	fi
	INET=`ifconfig $i | grep 'media:' | awk '{ print $2 }'`
	FOO=`echo "$FOO	$INET"`
	INET=`ifconfig $i | grep 'inet ' | awk '{ print $2 }'`
	FOO=`echo "$FOO	$INET"`
	INET=`ifconfig $i | grep 'inet6' | awk '{ print $2 }'`
	FOO=`echo "$FOO	$INET"`

	echo $FOO | sed -e 's/ /	/g'
done) | sort -k2r -k1
