summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/fcl-base/src/os2/custapp.inc
blob: 9486cc964f6bd208506903944ed3bb8223991fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
    This file is part of the Free Pascal run time library.
    Copyright (c) 2003 by the Free Pascal development team

    OS/2 version of custom app object routines.

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}

{ taken from dos unit }

function EnvStr (Index: longint): string;

var HP: PChar;

begin
    if (Index <= 0) or (Index > EnvC) then
        begin
            EnvStr := '';
            exit;
        end;
    HP := EnvP [Pred (Index)];
    EnvStr := StrPas (HP);
end;


procedure SysGetEnvironmentList(List : TStrings;NamesOnly : Boolean);

Var
  S : String;
  J,I : Integer;

begin
  List.Clear;
  For J := 1 to Pred (EnvC) do
    begin
    S:=EnvStr(J);
    If NamesOnly then
      begin
      I:=Pos('=',S);
      If (I>1) then
        S:=Copy(S,1,I-1);
      end;
    List.Add(S);
    end;
end;