win32_stat() fixes (2nd try)
[p5sagit/p5-mst-13.2.git] / t / op / groups.t
CommitLineData
fe14fcc3 1#!./perl
2
eafe3453 3if (! -x ($groups = '/usr/ucb/groups') &&
4 ! -x ($groups = '/usr/bin/groups') &&
5 ! -x ($groups = '/bin/groups')
6) {
fe14fcc3 7 print "1..0\n";
8 exit 0;
9}
10
988174c1 11print "1..2\n";
12
13$pwgid = $( + 0;
14($pwgnam) = getgrgid($pwgid);
15@basegroup{$pwgid,$pwgnam} = (1,1);
16
17$seen{$pwgid}++;
fe14fcc3 18
19for (split(' ', $()) {
20 next if $seen{$_}++;
6e21c824 21 ($group) = getgrgid($_);
22 if (defined $group) {
23 push(@gr, $group);
24 }
25 else {
26 push(@gr, $_);
27 }
fe14fcc3 28}
988174c1 29
30$gr1 = join(' ', sort @gr);
31
85fe63ca 32$gr2 = join(' ', grep(!$basegroup{$_}++, sort split(' ',`$groups`)));
988174c1 33
34if ($gr1 eq $gr2) {
35 print "ok 1\n";
36}
37else {
38 print "#gr1 is <$gr1>\n";
39 print "#gr2 is <$gr2>\n";
40 print "not ok 1\n";
41}
42
43# multiple 0's indicate GROUPSTYPE is currently long but should be short
44
45if ($pwgid == 0 || $seen{0} < 2) {
46 print "ok 2\n";
47}
48else {
49 print "not ok 2 (groupstype should be type short, not long)\n";
50}