no message

This commit is contained in:
florian 2004-02-10 22:10:18 +00:00
parent 96bff0fccb
commit c5fae16a0d
2 changed files with 60 additions and 1 deletions

View File

@ -21,4 +21,5 @@ begin
end;
begin
end.
myexec('',['','']);
end.

58
tests/webtbs/tw2968.pas Normal file
View File

@ -0,0 +1,58 @@
{ Source provided for Free Pascal Bug Report 2968 }
{ Submitted by "Marco (gory bugs)" on 2004-02-10 }
{ e-mail: }
Uses Unix,BaseUnix;
function ArrayStringToPPchar(const S:Array of AnsiString;reserveone:boolean):ppchar; // const ?
// ReserveOne:=True -> one extra pchar is allocated and the first ( p[0]) is left for commandline
var p : ppchar;
Res,
i : LongInt;
begin
if High(s)<Low(s) Then Exit(NIL);
Res:=0;
If ReserveOne Then
Res:=1 ;
Getmem(p,1+sizeof(pchar)*(high(s)-low(s))); // one more for NIL, one more
// for cmd
for i:=low(s) to high(s) do
p[i+Res]:=@pchar(@s[i])[1];
// p[i+Res]:=@ansistring(s[i])[1];
p[high(s)+1+Res]:=nil;
ArrayStringToPPchar:=p;
end;
function intFpExec (Const PathName:AnsiString;const S:Array Of AnsiString):cint;
Var
p : ppchar;
NewCmd : ansistring;
ThePath : String;
begin
p:=ArrayStringToPPchar(s,True);
newcmd:=PathName;
{ If SearchPath Then
Begin}
Thepath:=strpas(fpgetenv('PATH'));
if thepath='' then
thepath:='.';
newcmd:=FSearch(newcmd,thepath);
writeln(newcmd);
{ End;}
// p^:=@NewCmd[1];
// IntFpExec:=fpExecVE(p^,p,MyEnv);
end;
function FpExecLP(Const PathName:AnsiString;const S:Array Of AnsiString):cint;
Begin
FpExecLP:=intFPExec(PathName,S);
End;
begin
fpexeclp('sh',['-c','echo hello']);
end.