custapp.inc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2003 by the Free Pascal development team
  4. OS/2 version of custom app object routines.
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. { taken from dos unit }
  12. function EnvStr (Index: longint): string;
  13. var HP: PChar;
  14. begin
  15. if (Index <= 0) or (Index > EnvC) then
  16. begin
  17. EnvStr := '';
  18. exit;
  19. end;
  20. HP := EnvP [Pred (Index)];
  21. EnvStr := StrPas (HP);
  22. end;
  23. procedure SysGetEnvironmentList(List : TStrings;NamesOnly : Boolean);
  24. Var
  25. S : String;
  26. J,I : Integer;
  27. begin
  28. List.Clear;
  29. For J := 1 to Pred (EnvC) do
  30. begin
  31. S:=EnvStr(J);
  32. If NamesOnly then
  33. begin
  34. I:=Pos('=',S);
  35. If (I>1) then
  36. S:=Copy(S,1,I-1);
  37. end;
  38. List.Add(S);
  39. end;
  40. end;