* Refactor: add utility routine to handle command-line changes

This commit is contained in:
Michael VAN CANNEYT 2023-05-19 11:30:11 +02:00 committed by Pierre Muller
parent 41a1230044
commit 68e09b35f5

View File

@ -258,6 +258,14 @@ program fpc;
ppccommandlinelen : longint;
i : longint;
errorvalue : Longint;
Procedure AddToCommandLine(S : String);
begin
PPCCommandLine [PPCCommandLineLen] := S;
Inc(PPCCommandLineLen);
end;
begin
setlength(ppccommandline,paramcount);
ppccommandlinelen:=0;
@ -269,8 +277,7 @@ program fpc;
if ParamCount = 0 then
begin
SetLength (PPCCommandLine, 1);
PPCCommandLine [PPCCommandLineLen] := '-?F' + ParamStr (0);
Inc (PPCCommandLineLen);
AddToCommandLine('-?F' + ParamStr (0));
end
else
for i:=1 to paramcount do
@ -305,12 +312,11 @@ program fpc;
else
begin
if pos('-h',s)=1 then
ppccommandline[ppccommandlinelen] := '-hF' + ParamStr (0)
AddToCommandLine('-hF'+ParamStr(0))
else if pos('-?',s)=1 then
ppccommandline[ppccommandlinelen] := '-?F' + ParamStr (0)
AddToCommandLine('-?F'+ParamStr(0))
else
ppccommandline[ppccommandlinelen]:=s;
inc(ppccommandlinelen);
AddToCommandLine(S);
end;
end;
end;
@ -330,3 +336,4 @@ program fpc;
error(ppcbin+' returned an error exitcode');
halt(errorvalue);
end.