-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCAT.PAS
44 lines (41 loc) · 916 Bytes
/
CAT.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
{ @author: Sylvain Maltais ([email protected])
@created: 2021
@website(https://www.gladir.com/kix-0)
@abstract(Target: Free Pascal)
}
Program CAT(Input,Output);
Var
I:Integer;
Handle:Text;
CurrLine:String;
BEGIN
If(ParamStr(1)='/?')or(ParamStr(1)='--help')or(ParamStr(1)='-h')or
(ParamStr(1)='/h')or(ParamStr(1)='/H')Then Begin
WriteLn('CAT : Cette commande permet d''afficher le contenu du fichier.');
WriteLn;
WriteLn('Syntaxe : CAT [fichier]');
End
Else
If ParamCount>0Then Begin
For I:=1 to ParamCount do Begin
Assign(Handle,ParamStr(I));
{$I-}Reset(Handle);{$I+}
If IOResult=0Then Begin
While NOT EOF(Handle)do Begin
ReadLn(Handle,CurrLine);
WriteLn(CurrLine);
End;
Close(Handle);
End
Else
WriteLn('Impossible de lire ',ParamStr(I));
End;
End
Else
Begin
Repeat
ReadLn(Input,CurrLine);
WriteLn(CurrLine);
Until EOF;
End;
END.