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 $hasse; 10*0Sstevel@tonic-gate eval { my @n = getservbyname "echo", "tcp" }; 11*0Sstevel@tonic-gate $hasse = 1 unless $@ && $@ =~ /unimplemented|unsupported/i; 12*0Sstevel@tonic-gate unless ($hasse) { print "1..0 # Skip: no getservbyname\n"; exit 0 } 13*0Sstevel@tonic-gate use Config; 14*0Sstevel@tonic-gate $hasse = 0 unless $Config{'i_netdb'} eq 'define'; 15*0Sstevel@tonic-gate unless ($hasse) { 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 @servent = getservbyname "echo", "tcp"; # This is the function getservbyname. 20*0Sstevel@tonic-gate unless (@servent) { print "1..0 # Skip: no echo service\n"; exit 0 } 21*0Sstevel@tonic-gate} 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gateprint "1..3\n"; 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gateuse Net::servent; 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gateprint "ok 1\n"; 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gatemy $servent = getservbyname "echo", "tcp"; # This is the OO getservbyname. 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gateprint "not " unless $servent->name eq $servent[0]; 32*0Sstevel@tonic-gateprint "ok 2\n"; 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gateprint "not " unless $servent->port == $servent[2]; 35*0Sstevel@tonic-gateprint "ok 3\n"; 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate# Testing pretty much anything else is unportable. 38*0Sstevel@tonic-gate 39