custapp.inc 1.4 KB

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