-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMDLINE.PAS
101 lines (91 loc) · 1.75 KB
/
CMDLINE.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
unit CmdLine;
interface
uses
DOS;
const
TrkName: PathStr = '';
implementation
uses
CRT, Util, TTY, Castles;
var
f: text;
s, param: string;
function Clean( s: string): string;
var
i: byte;
begin
i := 1;
while i < length( s) do
if not ( s[i] in [#33..#126])
then delete(s, i, 1)
else inc( i);
clean := s;
end;
procedure Analyze( var id, param: string);
var
p: byte;
begin
id := upper( clean( id));
p := pos( ';', id);
if p <> 0
then delete( id, p, 255);
p := pos( '=', id);
if p = 0
then id := ''
else
begin
param := copy( id, p+1, 255);
delete( id, p, 255);
end
end;
var
i: byte;
begin
assign( f, 'FORT.INI');
reset( f);
if IOresult = 0
then
begin
while (not eof( f)) and (IOresult = 0) do
begin
readln( f, s);
Analyze( s, param);
if s <> ''
then
if copy(s, 1, 6) = 'USEEGA'
then
UseEGA := (param[1] = '1')
else
if copy(s, 1, 9) = 'CHECKSNOW'
then
CheckSnow := (param[1] = '1')
else
if copy(s, 1, 11) = 'VERBOSEEXEC'
then
VerboseExec := (param[1] = '1')
else
if (copy(s, 1, 9) = 'EXECTRACK')
then
if param = ''
then TrkName := ''
else TrkName := FExpand(param)
else {Ignore error};
end;
close( f)
end;
for i := 1 to ParamCount do
begin
s := upper( ParamStr( i));
if s[1] <> '/'
then
if s = ''
then TrkName := ''
else TrkName := FExpand(s)
else
case s[2] of
'I': VerboseExec := s[3] <> '-';
'S': CheckSnow := s[3] <> '-';
'E': UseEGA := s[3] <> '-';
end
end
end.