+ Paramstr(0) must return binary name

This commit is contained in:
michael 2003-05-29 08:43:52 +00:00
parent ead9de924c
commit 78aa08c8be

View File

@ -182,18 +182,28 @@ Function ParamStr(Param : Integer) : Ansistring;
Var Len : longint; Var Len : longint;
begin begin
if (Param>=0) and (Param<argc) then {
begin Paramstr(0) should return the name of the binary.
Len:=0; Since this functionality is included in the system unit,
While Argv[Param][Len]<>#0 do we fetch it from there.
Inc(len); Normally, pathnames are less than 255 chars anyway,
SetLength(Result,Len); so this will work correct in 99% of all cases.
If Len>0 then In time, the system unit should get a GetExeName call.
Move(Argv[Param][0],Result[1],Len); }
end if (Param=0) then
else Result:=System.Paramstr(0)
paramstr:=''; else if (Param>0) and (Param<argc) then
end; begin
Len:=0;
While Argv[Param][Len]<>#0 do
Inc(len);
SetLength(Result,Len);
If Len>0 then
Move(Argv[Param][0],Result[1],Len);
end
else
paramstr:='';
end;
@ -380,9 +390,15 @@ end.
{ {
$Log$ $Log$
Revision 1.11 2002-09-07 16:01:22 peter Revision 1.12 2003-05-29 08:43:52 michael
+ Paramstr(0) must return binary name
Revision 1.11 2002/09/07 16:01:22 peter
* old logs removed and tabs fixed * old logs removed and tabs fixed
Revision 1.1.2.3 2003/05/29 08:42:23 michael
+ Paramstr(0) must return binary name
Revision 1.10 2002/01/25 17:41:25 peter Revision 1.10 2002/01/25 17:41:25 peter
* delphi compatible array types * delphi compatible array types