Code:
Function php_getenv(dfn_var_isstr:shortstring;local_only :wordbool):string;
var BufSize: Integer; // buffer size required for value
begin
// Get required buffer size (inc. terminal #0)
dfn_var_isstr:=concat(dfn_var_isstr,#0,#0,#0);
BufSize := GetEnvironmentVariable(@dfn_var_isstr[1], nil, 0);
if BufSize > 0 then
begin
// Read env var value into result string
SetLength(Result, BufSize - 1);
GetEnvironmentVariable(@dfn_var_isstr[1],PChar(Result), BufSize);
end
else
// No such environment variable
Result := '';
end;//far.exe("'Path',Path php_getenv_path") |