1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateBEGIN { 4*0Sstevel@tonic-gate chdir 't' if -d 't'; 5*0Sstevel@tonic-gate @INC = '../lib'; 6*0Sstevel@tonic-gate} 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gateBEGIN { 9*0Sstevel@tonic-gate our $hasne; 10*0Sstevel@tonic-gate eval { my @n = getnetbyname "loopback" }; 11*0Sstevel@tonic-gate $hasne = 1 unless $@ && $@ =~ /unimplemented|unsupported/i; 12*0Sstevel@tonic-gate unless ($hasne) { print "1..0 # Skip: no getnetbyname\n"; exit 0 } 13*0Sstevel@tonic-gate use Config; 14*0Sstevel@tonic-gate $hasne = 0 unless $Config{'i_netdb'} eq 'define'; 15*0Sstevel@tonic-gate unless ($hasne) { print "1..0 # Skip: no netdb.h\n"; exit 0 } 16*0Sstevel@tonic-gate} 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gateBEGIN { 19*0Sstevel@tonic-gate our @netent = getnetbyname "loopback"; # This is the function getnetbyname. 20*0Sstevel@tonic-gate unless (@netent) { print "1..0 # Skip: no loopback net\n"; exit 0 } 21*0Sstevel@tonic-gate} 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gateprint "1..2\n"; 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gateuse Net::netent; 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gateprint "ok 1\n"; 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gatemy $netent = getnetbyname "loopback"; # This is the OO getnetbyname. 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gateprint "not " unless $netent->name eq $netent[0]; 32*0Sstevel@tonic-gateprint "ok 2\n"; 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate# Testing pretty much anything else is unportable; 35*0Sstevel@tonic-gate# e.g. the canonical name of the "loopback" net may be "loop". 36*0Sstevel@tonic-gate 37