[fpc-devel]Stupid implementation of execlp

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Thu May 23 21:13:33 CEST 2002


On Thu, 23 May 2002, Samuel Liddicott wrote:

> ----- Original Message -----
> From: <Michael.VanCanneyt at wisa.be>
> To: "FPC development mailing list" <fpc-devel at deadlock.et.tudelft.nl>
> Sent: Thursday, May 23, 2002 6:00 PM
> Subject: Re: [fpc-devel]Stupid implementation of execlp
>
>
> > With reason: Pascal Strings can only contain 255 chars. Anything outside
> that
> > range cannot be processed. Since the getenv only returns 255 chars, only
> > that portion of the path is processed.
> >
> > We can fix this, but that will be for the 1.1 branch of FPC.
>
> Accepting your answer, but for discussions sake; TP7 also had pchar support,
> I wondered what the reason was for there not being a pchar version of getenv
> that exelp might use.
>
> Just curious.

Sheer laziness:
Procedure Execvp(Path:Pathstr;Args:ppchar;Ep:ppchar);
{
  This does the same as Execve, only it searches the PATH environment
  for the place of the Executable, except when Path starts with a slash.
  if the PATH environment variable is unavailable, the path is set to '.'
}
var
  thepath : string;  // <<<---- max 255 chars...
begin
  if path[1]<>'/' then
   begin
     Thepath:=strpas(getenv('PATH'));
     if thepath='' then

etc etc etc.

I'll change it so it scans the pchar for parts of the path.

Michael.






More information about the fpc-devel mailing list