[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tyndur-devel] [PATCH] Pascal-RTL: GetEnv



On Sat, Sep 26 16:29, Kevin Wolf wrote:
> + Pascal-RTL: dos.GetEnv implementiert
> 
> Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
> ---
>  src/modules/pas/lib/dos/dos.pas |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/src/modules/pas/lib/dos/dos.pas b/src/modules/pas/lib/dos/dos.pas
> index 9345049..6c19309 100644
> --- a/src/modules/pas/lib/dos/dos.pas
> +++ b/src/modules/pas/lib/dos/dos.pas
> @@ -93,6 +93,8 @@ function c_directory_read(handle: Pointer): PDirEntry; cdecl; external name 'dir
>  function c_init_execute(cmd: PChar): dword; cdecl; external name 'init_execute';
>  function c_waitpid(pid: integer; status: Pointer; flags: integer): integer; cdecl; external name 'waitpid';
>  
> +function c_getenv(const name: PChar): PChar; cdecl; external name 'getenv';
> +
>  function LastDelimiter(const Delimiters, S: string): Integer;
>  var
>      i, j: longint;
> @@ -323,8 +325,12 @@ begin
>  end;
>  
>  Function GetEnv (EnvVar: String) : String;
> +var
> +    res: PChar;
>  begin
> -    GetEnv := ''; // FIXME
> +    EnvVar := EnvVar + #0;
> +    res := c_getenv(@EnvVar[1]);

Wie ist denn das Verhalten definiert, wenn die Variable nicht existiert?
"Macht rot"? ;-)

> +    GetEnv := StrPas(res);
>  end;

Aber ich glaube das kriegst du hin:
Acked-by: Antoine Kaufmann <toni@xxxxxxxxxx>

-- 
Antoine Kaufmann
<toni@xxxxxxxxxxxxxxxx>

Attachment: pgpCDfTB_BjUB.pgp
Description: PGP signature