Revision 23095,
1.1 KB
checked in by ghudson, 16 years ago
(diff) |
Import the moira package from SIPB Debathena.
|
Line | |
---|
1 | #!/usr/athena/bin/perl |
---|
2 | |
---|
3 | while ($_ = <STDIN>) { |
---|
4 | if (/^\s/) { |
---|
5 | $members{$who} = $members{$who} . $_; |
---|
6 | $mcount{$who}++; |
---|
7 | next; |
---|
8 | } |
---|
9 | ($f,$f,$who,$own) = split(/\s+/, $_); |
---|
10 | $data{$who} = $_; |
---|
11 | } |
---|
12 | |
---|
13 | # Do system:authuser@cell groups |
---|
14 | for (keys %data) { |
---|
15 | next unless ($data{$_} =~ /^system:authuser@/); |
---|
16 | ($name, $attr, $id, $oid, $cid) = split(/\s+/, $data{$_}); |
---|
17 | ($flags, $mcount) = split(/\//, $attr); |
---|
18 | $mcount += $mcount{$_}; |
---|
19 | print "$name $flags/$mcount $id $oid $cid\n"; |
---|
20 | delete $data{$_}; |
---|
21 | } |
---|
22 | |
---|
23 | # Do users |
---|
24 | for (keys %data) { |
---|
25 | next if ($_ < 0); |
---|
26 | print $data{$_}; |
---|
27 | delete $data{$_}; |
---|
28 | } |
---|
29 | |
---|
30 | # Now do all the lists |
---|
31 | $x = 1; |
---|
32 | while ((@keys = keys %data)+0 && $x) { |
---|
33 | $x = 0; |
---|
34 | for $key (keys %data) { |
---|
35 | ($f,$f,$who,$own) = split(/\s+/, $data{$key}); |
---|
36 | next if ($who!=$own && $data{$own}); |
---|
37 | $x = 1; |
---|
38 | print $data{$key}; |
---|
39 | print $members{$key} if ($members{$key}); |
---|
40 | delete $data{$key}; |
---|
41 | delete $members{$key} if ($members{$key}); |
---|
42 | } |
---|
43 | } |
---|
44 | if (@keys+0) { |
---|
45 | print STDERR "Unprocessed:\n"; |
---|
46 | for (keys %data) { |
---|
47 | $f = split(/\s+/, $data{$_}); |
---|
48 | print STDERR "\t$f ($_)\n"; |
---|
49 | } |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.