Trailing-Edge
-
PDP-10 Archives
-
decuslib10-11
-
43,50527/whois.bli
There are no other files named whois.bli in the archive.
Module Whois(Entries=(Whois),Reserve(1,2,3,4))=
Begin
Require MACHOP.BLI;
Require MACROS.BLI;
Require EXTERN.BLI;
External Finuname;
ROUTINE Addgroup(name)=
Begin
Own grpptr;
If (.name EQL 0) then Return 0;
grpptr _ 0;
While (.grpblk[.grpptr] NEQ 0)AND(.grpptr LSS grplen) do
Begin
If (.grpblk[.grpptr] EQL .name) then
Begin
grpblk[.grpptr+1] _ .grpblk[.grpptr+1] + 1;
Return 0;
End
Else grpptr _ .grpptr + 2;
End;
If (.grpptr GEQ grplen-3) then
Begin
Print('?M?J?G%Maximum number of groups exceeded - Bump GRPMAX!?M?J');
Return 0;
End;
grpblk[.grpptr] _ .name;
grpblk[.grpptr+1] _ 1;
grpblk[.grpptr+2] _ 0;
End;
Global ROUTINE Whois(uname1,uname2)=
BEGIN
OWN tmp[2],lokblk[4],a,accarray[accmax],wrd,fancy,grp,found;
Routine OUTACCT(uname1,uname2,group)=
BEGIN
LOCAL flg,sgrp;
a _ accnm2+1;
accarray[accnm1]_.uname1;
accarray[accnm2]_.uname2;
wrd _ 0;
UNTIL .wrd EQL -1 DO
BEGIN
wrd _ Infile("IN");
If .wrd EQL "EOF" THEN
BEGIN
Print('?M?J??MAIAFC Accounting file is corrupt?M?J?G');
Stop;
END;
IF .a EQL accmax THEN
BEGIN
Print('?M?J??MAIMRE Maximum record size exceeded?M?J?G');
Stop;
END;
accarray[.a] _ .wrd;
a _ .a + 1;
END;
flg _ False;
Select .group of
NSET
-1:Begin
Addgroup(.accarray[accgp1]);
Addgroup(.accarray[accgp2]);
Addgroup(.accarray[accgp3]);
Addgroup(.accarray[accgp4]);
Addgroup(.accarray[accgp5]);
End;
.accarray[accgp1]:flg _ True;
.accarray[accgp2]:flg _ True;
.accarray[accgp3]:flg _ True;
.accarray[accgp4]:flg _ True;
.accarray[accgp5]:flg _ True;
0:flg _ True;
TESN;
If NOT(.flg) then Return(FALSE);
Sixout(.uname1,6);
Sixout(.uname2,3);
Tab;
If ((Outst(ADDRESS(accarray[accfnm]),20)) GEQ 21) then fancy _ 10;
If (prvbit(pvgrp)) then
Begin
Sgrp _ False;
Fancy _ -1;
Crlf;
Tab;
Tab;
Print('Groups: ');
If (.accarray[accgp1] NEQ 0) then
Begin
If (.Sgrp) then
Outc(",");
Sixout(.accarray[accgp1],-1);
Sgrp _ True;
End;
If (.accarray[accgp2] NEQ 0) then
Begin
If (.Sgrp) then
Outc(",");
Sixout(.accarray[accgp2],-1);
Sgrp _ True;
End;
If (.accarray[accgp3] NEQ 0) then
Begin
If (.Sgrp) then
Outc(",");
Sixout(.accarray[accgp3],-1);
Sgrp _ True;
End;
If (.accarray[accgp4] NEQ 0) then
Begin
If (.Sgrp) then
Outc(",");
Sixout(.accarray[accgp4],-1);
Sgrp _ True;
End;
If (.accarray[accgp5] NEQ 0) then
Begin
If (.Sgrp) then
Outc(",");
Sixout(.accarray[accgp5],-1);
Sgrp _ True;
End;
If NOT(.sgrp) then Print('(none)');
End;
If (prvbit(pvpass) OR prvbit(pvppn) OR prvbit(pvpriv)) then
Begin
Fancy _ -1;
Crlf;
Tab;
Tab;
IF Prvbit(Pvppn) THEN
Begin
Print('PPN: ');
Outppn(.accarray[accppn]);
End;
IF Prvbit(Pvpass) THEN
Begin
Print(' Pass: ');
If .accarray[accpas] EQL 0 then print('(none)')
else Sixout(.accarray[accpas],-1);
End;
IF Prvbit(Pvpriv) THEN
Begin
Print(' Priv: ');
Outprv(.accarray[accprv]);
End;
Crlf;
End;
If (prvbit(pvunam) OR prvbit(pvfile)) then
Begin
Fancy _ -1;
Tab; Tab;
IF Prvbit(Pvunam) THEN
BEGIN
Print('User: ');
Sixout(.accarray[accus1],-1);
Sixout(.accarray[accus2],-1);
END;
IF Prvbit(Pvfile) THEN
BEGIN
Print(' File: ');
Sixout(.accarray[accmfd],-1);
Outc(":");
Sixout(.accarray[accmlf],-1);
Outc(".");
Sixout(.accarray[accmfe],-1);
END;
Crlf;
End;
If (.fancy GEQ 0) then
Begin
If (.fancy GEQ 1) then
Begin
Crlf;
Fancy _ -1;
End
Else Tab;
Fancy _ .Fancy + 1;
End
Else Crlf;
Return(True);
END;
Filblock(lokblk,'.ACCT.',mlrext,#777^27,Mlrppn);
fancy _ tmp[0] _ tmp[1] _ 0;
grpblk _ 0;
Reset;
IFSKIP OPEN(IN,PLIT(12,mlrdev,address(ibufhdr),0)) THEN
IFSKIP Lookup(IN,ADDRESS(lokblk)) THEN
begin
If (.uname1 EQL sixbit'*') then uname1 _ 0;
IF (.uname1 EQL 0) OR (.uname1 EQL sixbit'GROUP') THEN
BEGIN
IF (.uname1 EQL sixbit'GROUP')AND(.uname2 EQL 0) then
Begin
Until (uname1_Infile("IN");uname2_Infile("IN")) EQL "EOF" DO
OUTACCT(.uname1,.uname2,-1);
Print('?M?JDefined groups?I# of members?M?J');
Found _ 0;
Until (.grpblk[.found] EQL 0) do
Begin
Print(' ');
Sixout(.grpblk[.found],6);
Print('?I ');
Outdec(.grpblk[.found+1]);
Crlf;
found _ .found + 2;
End;
Crlf;
Return(0);
End;
grp _ .uname2;
found _ False;
UNTIL (uname1_Infile("IN");uname2_Infile("IN")) EQL "EOF" DO
if (OUTACCT(.uname1,.uname2,.grp)) then found _ TRUE;
If NOT(.found) AND (.grp NEQ 0) Then print('?M?J?G%Group not found?M?J');
END
ELSE
BEGIN
tmp[0] _ Infile("IN");
tmp[1] _ Infile("IN");
UNTIL (Usern(.tmp[0],.tmp[1],.uname1,.uname2) OR (.tmp[0] EQL "EOF")) do
Begin
Until (.tmp[0] EQL -1) OR (.tmp[0] EQL "EOF") OR (.tmp[1] EQL -1) do
tmp[0] _ infile("IN");
tmp[0] _ infile("IN");
tmp[1] _ infile("IN");
End;
If (.tmp[0] EQL "EOF") then
Begin
Print('?M?J?G%Uname not found?M?J');
Return 0;
End
Else Outacct(.uname1,.uname2,0);
End;
END
ELSE
BEGIN
ERROR(.LOKBLK[1]<righthalf>);
RELEAS(IN);
RETURN 0;
END
ELSE
BEGIN
PRINT('?M?J??MAIDNA Mailer device is not available?M?J');
RETURN 0;
END;
CLOSE(IN);
RELEAS(IN);
Crlf;
END;