-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPR.PAS
65 lines (58 loc) · 1.34 KB
/
PR.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ @author: Sylvain Maltais ([email protected])
@created: 2023
@website(https://www.gladir.com/linux-0)
@abstract(Target: Turbo Pascal, Free Pascal)
}
Program PR;
Uses DOS,Printer;
Var
Mode:(_None,_C);
I:Integer;
Function StrToUpper(S:String):String;
Var
I:Byte;
Begin
For I:=1 to Length(S)do Begin
If S[I] in['a'..'z']Then S[I]:=Chr(Ord(S[I])-32);
End;
StrToUpper:=S;
End;
Procedure SubmitFileForPrinting(FileName:String);
Var
FilePrt:Text;
Err:Integer;
CurrLine:String;
Begin
{$I-}Assign(FilePrt,FileName);
Reset(FilePrt);{$I+}
If IOResult<>0 Then Begin
WriteLn('Impossible de lire le fichier ',FileName);
Halt(1);
End;
While Not EOF(FilePrt)do Begin
ReadLn(FilePrt,CurrLine);
{$I-}WriteLn(Lst,CurrLine);{$I+}
Err:=IOResult;
If Err<>0 Then Begin
WriteLn('Erreur d''impression : ',Err);
Halt(2);
End;
End;
Close(FilePrt);
End;
BEGIN
Mode:=_None;
If(ParamStr(1)='/?')or(ParamStr(1)='--help')or(ParamStr(1)='-h')or
(ParamStr(1)='/h')or(ParamStr(1)='/H')Then Begin
WriteLn('PR: Cette commande permet d''afficher un/des ficiher(s) ',
'pour l''impression.');
WriteLn;
WriteLn('Syntaxe: PRINT [fichier]');
WriteLn;
WriteLn(' fichier Permet d''indiquer le fichier … imprimer');
End
Else
If ParamCount>0Then For I:=1 to ParamCount do Begin
SubmitFileForPrinting(ParamStr(I));
End;
END.