home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
BBS
/
PAGER104.ZIP
/
PAGER.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1991-12-22
|
2KB
|
81 lines
Program Joke; { notice: you don't need (input,output) for turbo pascal }
Uses Dos,Crt;
Type
String12 = String[12];
String60 = String[60];
Var
InFile,OutFile:Text;
Message:String60;
Cnt:Integer;
Procedure OpenFiles(S1,S2:String12);
Begin
Assign(InFile,S1);
{$I-} Reset(InFile); {$I+}
If IOResult <> 0 Then
Begin
WriteLn(S2,' not found! Aborting...');
Halt(0);
End;
Assign(OutFile,S2);
Rewrite(OutFile);
End;
Function Name(Str:String):String12;
Var
Tmp:String;
I:Integer;
Begin
I := 1;
While UpCase(Str[I]) In ['A'..'Z','0'..'9'] Do Inc(I);
Tmp := Copy(Str,1,I-1);
For I := 1 To Length(Tmp) Do Tmp[I] := UpCase(Tmp[I]);
Name := Tmp;
End;
Procedure ParseJokeFile(Msg:String60);
Var OneLine:String[80];
Begin
While Not Eof(InFile) Do
Begin
ReadLn(InFile,OneLine);
If UpCase(OneLine[1]) In ['A'..'Z','0'..'9'] Then {Include 69er.. heh}
Begin
If (UpCase(OneLine[1]) In ['A'..'Z','0'..'9']) And (OneLine[0] <> #0) Then
WriteLn(OutFile,'/p '+Name(OneLine)+' '+Msg);
End;
End;
End;
Procedure Title;
Begin
TextColor(3);
WriteLn('Pager Plus v1.04 -- Copyright (c) 1991 Prankware');
WriteLn;
TextColor(13);
End;
Begin
Title;
If (ParamCount < 2) Then
Begin
WriteLn('Usage: JOKE <infile> <outfile> [<message>]');
Halt(0);
End;
OpenFiles(ParamStr(1),ParamStr(2));
If ParamCount = 2 Then
ParseJokeFile('')
Else
Begin
Message := '';
For Cnt := 3 To ParamCount Do
Message := Message + ' ' + ParamStr(Cnt);
ParseJokeFile(Message);
End;
Close(OutFile);
WriteLn('Joke file created! <snicker>');
End.