#!/usr/bin/perl require 5.003; use Getopt::Std; use strict; my %opts; getopts('vw:', \%opts ); my $NDD = '/usr/sbin/ndd'; my $DEV = shift || die "Usage: $0 [-v] [-w #] tcp|udp|ip|icmp|hme|...\n" . "\n -v\talso display tabular values (messy).\n" . " -w #\tuse the specified width as minimum for indenting the keyname.\n\n"; my $max = $opts{w}; my @x; open( IN, "$NDD /dev/$DEV \\?|" ) || die "open: $!\n"; while () { next if /\?/; next if /write only/; $_ = $1 if /^([a-zA-Z0-9_]+)/; push @x, $_; $max = length if ( $max < length ); } close(IN); my ($x, @y); foreach $x ( sort @x ) { chomp(@y = `$NDD /dev/$DEV $x`); if ( $y[0] =~ /^\s*\d+/ ) { printf "%*s = %d\n", $max, $x, $y[0]; } else { if ( $opts{v} ) { print "*** $x ***:\n", join("\n",@y), "\n"; } else { printf "%*s = (tabular value skipped)\n", $max, $x; } } }