10 eval { my @n = getpwuid 0 };
11 $haspw = 1 unless $@ && $@ =~ /unimplemented/;
12 unless ($haspw) { print "1..0 # Skip: no getpwuid\n"; exit 0 }
14 # VMS's pwd.h struct passwd conflicts with the one in vmsish.h
15 $haspw = 0 unless ( $Config{'i_pwd'} eq 'define' || $^O eq 'VMS' );
16 unless ($haspw) { print "1..0 # Skip: no pwd.h\n"; exit 0 }
21 # On VMS getpwuid(0) may return [$gid,0] UIC info (which may not exist).
22 # It is better to use the $< uid for testing on VMS instead.
23 if ( $^O eq 'VMS' ) { $uid = $< ; }
24 our @pwent = getpwuid $uid; # This is the function getpwuid.
25 unless (@pwent) { print "1..0 # Skip: no uid $uid\n"; exit 0 }
34 my $pwent = getpwuid $uid; # This is the OO getpwuid.
36 my $uid_expect = $uid;
37 if ( $^O eq 'cygwin' ) { $uid_expect = 500; } # go figure
39 print "not " unless $pwent->uid == $uid_expect ;
42 print "not " unless $pwent->name eq $pwent[0];
47 unless not defined $pwent->passwd &&
48 $pwent[1] eq '0'; # go figure
50 print "not " unless $pwent->passwd eq $pwent[1];
54 print "not " unless $pwent->uid == $pwent[2];
57 print "not " unless $pwent->gid == $pwent[3];
60 # The quota and comment fields are unportable.
62 print "not " unless $pwent->gecos eq $pwent[6];
65 print "not " unless $pwent->dir eq $pwent[7];
68 print "not " unless $pwent->shell eq $pwent[8];
71 # The expire field is unportable.
73 # Testing pretty much anything else is unportable:
74 # there maybe more than one username with uid 0;
75 # uid 0's home directory may be "/" or "/root' or something else,