* merged getenvironmentvariable

This commit is contained in:
peter 2001-02-20 22:14:19 +00:00
parent e32556ca16
commit 36e5967c3b
5 changed files with 87 additions and 5 deletions

View File

@ -627,6 +627,16 @@ begin
Result:=Format(SUnknownErrorCode,[ErrorCode]);
end;
{****************************************************************************
Os utils
****************************************************************************}
Function GetEnvironmentVariable(Const EnvVar : String) : String;
begin
Result:=getenv(EnvVar);
end;
{****************************************************************************
Initialization code
****************************************************************************}
@ -640,7 +650,10 @@ Finalization
end.
{
$Log$
Revision 1.3 2000-08-30 06:29:19 michael
Revision 1.4 2001-02-20 22:14:19 peter
* merged getenvironmentvariable
Revision 1.3 2000/08/30 06:29:19 michael
+ Merged syserrormsg fix

View File

@ -17,6 +17,8 @@
{ Read date & Time function declarations }
(* This must be placed before other functions, because TDateTime from DosCalls
would be used under OS/2 instead of that one from datih.inc otherwise. *)
{$i osutilsh.inc}
{$i datih.inc}
{ Read String Handling functions declaration }
@ -134,11 +136,16 @@ Type
{$i filutilh.inc}
{ Read disk function declarations }
{$i diskh.inc}
{
$Log$
Revision 1.7 2001-01-18 22:09:09 michael
Revision 1.8 2001-02-20 22:14:19 peter
* merged getenvironmentvariable
Revision 1.7 2001/01/18 22:09:09 michael
+ Merged fixes from fixbranch - file modes
Revision 1.6 2000/12/07 09:15:18 florian

View File

@ -757,7 +757,10 @@ Finalization
end.
{
$Log$
Revision 1.7 2001-01-13 11:10:59 hajny
Revision 1.8 2001-02-20 22:14:19 peter
* merged getenvironmentvariable
Revision 1.7 2001/01/13 11:10:59 hajny
* FileCreate and GetLocalTime fixed
Revision 1.6 2000/10/15 20:44:18 hajny
@ -785,3 +788,17 @@ end.
* forgot the add command :(
}
{****************************************************************************
OS Utils
****************************************************************************}
Function GetEnvironmentVariable(Const EnvVar : String) : String;
begin
Resumt:=Getenv(EnvVar);
end;
Revision 1.1.2.6 2001/02/20 21:19:28 michael
+ Added GetEnvironmentVariable function

View File

@ -441,6 +441,16 @@ begin
Result:=StrError(ErrorCode);
end;
{****************************************************************************
OS utility functions
****************************************************************************}
Function GetEnvironmentVariable(Const EnvVar : String) : String;
begin
Result:=StrPas(Linux.Getenv(PChar(EnvVar)));
end;
{****************************************************************************
Initialization code
@ -456,7 +466,10 @@ end.
{
$Log$
Revision 1.6 2001-01-21 20:21:40 marco
Revision 1.7 2001-02-20 22:14:19 peter
* merged getenvironmentvariable
Revision 1.6 2001/01/21 20:21:40 marco
* Rename fest II. Rtl OK
Revision 1.5 2000/12/28 20:50:04 peter

View File

@ -600,6 +600,35 @@ begin
FreeMem(MsgBuffer, MaxMsgSize);
end;
{****************************************************************************
Initialization code
****************************************************************************}
Function GetEnvironmentVariable(Const EnvVar : String) : String;
var
s : string;
i : longint;
hp,p : pchar;
begin
Result:='';
p:=GetEnvironmentStrings;
hp:=p;
while hp^<>#0 do
begin
s:=strpas(hp);
i:=pos('=',s);
if upcase(copy(s,1,i-1))=upcase(envvar) then
begin
Result:=copy(s,i+1,length(s)-i);
break;
end;
{ next string entry}
hp:=hp+strlen(hp)+1;
end;
FreeEnvironmentStrings(p);
end;
{****************************************************************************
Initialization code
@ -643,7 +672,10 @@ Finalization
end.
{
$Log$
Revision 1.5 2000-12-18 17:28:58 jonas
Revision 1.6 2001-02-20 22:14:19 peter
* merged getenvironmentvariable
Revision 1.5 2000/12/18 17:28:58 jonas
* fixed range check errors
Revision 1.4 2000/09/19 23:57:57 pierre