Bläddra i källkod

* merged getenvironmentvariable

peter 24 år sedan
förälder
incheckning
36e5967c3b
5 ändrade filer med 87 tillägg och 5 borttagningar
  1. 14 1
      rtl/go32v2/sysutils.pp
  2. 8 1
      rtl/objpas/sysutilh.inc
  3. 18 1
      rtl/os2/sysutils.pp
  4. 14 1
      rtl/unix/sysutils.pp
  5. 33 1
      rtl/win32/sysutils.pp

+ 14 - 1
rtl/go32v2/sysutils.pp

@@ -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
 
   

+ 8 - 1
rtl/objpas/sysutilh.inc

@@ -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

+ 18 - 1
rtl/os2/sysutils.pp

@@ -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
+

+ 14 - 1
rtl/unix/sysutils.pp

@@ -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

+ 33 - 1
rtl/win32/sysutils.pp

@@ -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