File:  [CSRG BSD Unix] / 43BSDReno / contrib / isode-beta / snmp / gawk-2.11 / s-netstat / s-netstat.sh
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

: run this script through /bin/sh

P=/usr/local/lib/awk

F=mib.connections S= T=mib.protocols

agent= community= flags=

for A in $*
do
    case $A in
	-a)	flags="$flags -v aflag=1" ;;
	-n)	;;
	-o)	flags="$flags -v oflag=1" ;;
	-s)	S=1 flags="$flags -v sflag=1" ;;
	-t)	echo "$A: unimplemented (warning)" 1>&2 ;;
	-A)	echo "$A: unimplemented (warning)" 1>&2 ;;

	-m)	F=mib.mbufs T=mib.mbufs ;;
	-i)	F=mib.interfaces T=mib.interfaces ;;
	-h)	echo "hosts: no MIB-II support" 1>&2
		exit 1 ;;
	-r)	F=mib.routes T=mib.routes ;;
	-z)	F=mib.arp T=mib.arp ;;
	-Z)	F=mib.system T=mib.system ;;
	-e)	F=mib.egp T=mib.egp ;;

	-*)	echo "$A: unknown flag" 1>&2
		exit 1 ;;
	
	*)	if [ "x$agent" = "x" ]; then
		    agent="-v AGENT=$A"
		elif [ "x$community" = "x" ]; then
		    community="-v COMMUNITY=$A"
		else
		    echo "usage: s-netstat [switches] [agent [community]]" 1>&2
		    exit 1
		fi ;;
    esac
done

if [ "x$S" != "x" ]; then
    F="$T"
fi

if [ ! -f $F ]; then
    F="$P/$F"
fi

exec gawk $flags $agent $community -f $F

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.