02 ��� 01 17:21, Peter Vreman wrote to me:
We have a nice program 'fpc' in compiler/util. But we can not get a FPC help if we call 'fpc' utility without any parameter. There is a patch:
....
PV> This is a hack, not a real solution. ParamStr(1) being empty and PV> paramcount=1 means that you call things like 'ppc386 ""'. Maybe not PV> all platforms support that even correctly. So it needs to be fixed in PV> fpc.pas and not in options.pas
I wrote small test:
=================================================================
program aaa;
begin
WriteLn('paramcount=', paramcount);
WriteLn('paramStr(0)=[', paramStr(0),']');
WriteLn('paramStr(1)=[', paramStr(1),']');
end.
=================================================================
program bbb;
Uses dos;
begin
Exec('./aaa','');
end.
=================================================================
There is output from ./bbb:
paramcount=1
paramStr(0)=[./aaa]
paramStr(1)=[]As You can see, paramcount=1
Error definitely is not in fpc.pas.
Another diff (for 1.1.x RTL):
=============================================================== -+- linux.pp.old Sat Sep 1 03:37:06 2001
+++ linux.pp Sat Sep 1 03:39:27 2001
@@ -2195,16 +2195,20 @@
-Function StringToPPChar(Var S:STring):ppchar;
+Function StringToPPChar(var S: String): ppchar;
{
Create a PPChar to structure of pchars which are the arguments specified
in the string S. Especially usefull for creating an ArgV for Exec-calls
}
var
+ i : integer;
nr : longint;
Buf : ^char;
p : ppchar;
begin
+ i:=Length(s);
+ while (i>0) and (s[i] in [' ',#8,#10]) do dec(i);
+ SetLength(s,i);
s:=s+#0;
;
nr:=0;
===============================================================Regards,
Sergey Korshunoff
