home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
bbs_mail
/
mpi100.arj
/
MPI.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-03-20
|
5KB
|
219 lines
program MPI;
uses Parse;
var
NetHex : array[1..4] of char;
NetNum : array[1..4] of longint;
NodeHex : array[1..4] of char;
NodeNum : array[1..4] of longint;
MatrixNum : string;
Line : string;
Str1 : string;
Str2 : string;
Str3 : string;
FType : string;
Lnt1 : longint;
Lnt2 : longint;
A : integer;
code : word;
TempNet : word;
TempNode : word;
Count : shortint;
OkFile : boolean;
Archive : boolean;
const
Version : string[5] = '1.00a';
Net : word = 0;
Node : word = 0;
Processed : boolean = False;
function AllCaps(S:string) : string;
var
S2 : string;
T : integer;
begin
for T := 1 to Length(S) do
S2[T] := UpCase(S[T]);
S2[0] := S[0];
AllCaps := S2;
end;
procedure TestExt;
begin
OkFile := False;
Archive := False;
Term[2] := AllCaps(Term[2]);
if Term[2] = 'FLO' then
begin
FType := ' Regular Attach ';
OkFile := True;
end;
if Term[2] = 'CLO' then
begin
FType := ' Crash Attach ';
OkFile := True;
end;
if Term[2] = 'HLO' then
begin
FType := ' Hold Attach ';
OkFile := True;
end;
if Term[2] = 'DLO' then
begin
FType := ' Direct Attach ';
OkFile := True;
end;
if Term[2] = 'OUT' then
begin
FType := ' Regular Bundle ';
OkFile := True;
end;
if Term[2] = 'CUT' then
begin
FType := ' Crash Bundle ';
OkFile := True;
end;
if Term[2] = 'HUT' then
begin
FType := ' Hold Bundle ';
OkFile := True;
end;
if Term[2] = 'DUT' then
begin
FType := ' Direct Bundle ';
OkFile := True;
end;
if Term[2] = 'REQ' then
begin
FType := ' File Request ';
OkFile := True;
end;
if Copy(Term[2],1,2) = 'MO' then
begin
FType := ' Compressed PKT ';
if ParamCount = 2 then OkFile := True;
Archive := True;
end;
if Copy(Term[2],1,2) = 'TU' then
begin
FType := ' Compressed PKT ';
if ParamCount = 2 then OkFile := True;
Archive := True;
end;
if Copy(Term[2],1,2) = 'WE' then
begin
FType := ' Compressed PKT ';
if ParamCount = 2 then OkFile := True;
Archive := True;
end;
if Copy(Term[2],1,2) = 'TH' then
begin
FType := ' Compressed PKT ';
if ParamCount = 2 then OkFile := True;
Archive := True;
end;
if Copy(Term[2],1,2) = 'FR' then
begin
FType := ' Compressed PKT ';
if ParamCount = 2 then OkFile := True;
Archive := True;
end;
if Copy(Term[2],1,2) = 'SA' then
begin
FType := ' Compressed PKT ';
if ParamCount = 2 then OkFile := True;
Archive := True;
end;
if Copy(Term[2],1,2) = 'SU' then
begin
FType := 'Compressed PKT ';
if ParamCount = 2 then OkFile := True;
Archive := True;
end;
end;
procedure NodeCode;
begin
TempNet := Net;
TempNode := Node;
Str1 := AllCaps(Copy(Term[1],1,8));
for Count := 1 to 4 do
begin
NetHex[Count] := Str1[Count];
NodeHex[Count] := Str1[Count+4];
Val(NetHex[Count],NetNum[Count],code);
Val(NodeHex[Count],NodeNum[Count],code);
case NetHex[Count] of
'A' : NetNum[Count] := 10;
'B' : NetNum[Count] := 11;
'C' : NetNum[Count] := 12;
'D' : NetNum[Count] := 13;
'E' : NetNum[Count] := 14;
'F' : NetNum[Count] := 15;
end; {case NetHex[Count]}
case NodeHex[Count] of
'A' : NodeNum[Count] := 10;
'B' : NodeNum[Count] := 11;
'C' : NodeNum[Count] := 12;
'D' : NodeNum[Count] := 13;
'E' : NodeNum[Count] := 14;
'F' : NodeNum[Count] := 15;
end; {case NodeHex[Count]}
end;
Lnt1 := (NetNum[1]*4096)+(NetNum[2]*256)+(NetNum[3]*16)+NetNum[4];
Lnt2 := (NodeNum[1]*4096)+(NodeNum[2]*256)+(NodeNum[3]*16)+NodeNum[4];
if Archive then
begin
Dec(TempNet,Lnt1);
Lnt1 := TempNet;
Dec(TempNode,Lnt2);
Lnt2 := TempNode;
end;
Str(Lnt1,Str2);
Str(Lnt2,Str3);
MatrixNum := Str2+'/'+Str3;
while Length(MatrixNum)<12 do MatrixNum := MatrixNum + #32;
end;
begin
Writeln('Message Packet Identifier, version ',Version);
Writeln('Placed in the public domain by Bill Auclair, FidoNet 1:141/545');
Writeln('---------------------------------------------------------------');
if ParamCount = 2 then
begin
Val(ParamStr(1),Net,code);
Val(ParamStr(2),Node,code);
end;
repeat
Readln(Input,Line);
if Line <> '' then
begin
Parseln(Line);
if Pos('.',Term[1])>0 then
begin
Term[5] := Term[4];
Term[4] := Term[3];
Term[3] := Term[2];
Term[2] := Copy(Term[1],(Pos('.',Term[1])+1),3);
Term[1] := Copy(Term[1],1,8);
end;
TestExt;
if (OkFile=True) and (Length(Term[1])=8) then
begin
Processed := True;
NodeCode;
while Length(Term[3])<9 do Term[3] := #32+Term[3];
while Length(Term[4])<8 do Term[4] := Term[4]+#32;
while Length(Term[5])<6 do Term[5] := Term[5]+#32;
Writeln(Term[1],'.',Term[2],' ',Term[3],' ',Term[4],' ',Term[5],' ',
FType,'for ',MatrixNum);
end;
end;
until Eof(Input);
if not Processed then Writeln('No qualified files to process');
end.