ezcgi.inc 907 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Uses Windows;
  2. { Declared EXPLICITLY with Ansistring, so NO mistaking is possible }
  3. {
  4. This function is VERY inefficient, but the downsize would be to
  5. have initialization/finalization code to get/free the environment
  6. settings.
  7. }
  8. Function Getenv (Var EnvVar : AnsiString): AnsiString;
  9. var
  10. s : string;
  11. i : longint;
  12. hp,p : pchar;
  13. begin
  14. getenv:='';
  15. p:=GetEnvironmentStrings;
  16. hp:=p;
  17. while hp^<>#0 do
  18. begin
  19. s:=StrPas(hp);
  20. i:=pos('=',s);
  21. if upcase(copy(s,1,i-1))=upcase(envvar) then
  22. begin
  23. getenv:=copy(s,i+1,length(s)-i);
  24. break;
  25. end;
  26. { next string entry}
  27. hp:=hp+strlen(hp)+1;
  28. end;
  29. FreeEnvironmentStrings(p);
  30. end;
  31. {
  32. $Log$
  33. Revision 1.3 2000-07-25 11:27:34 jonas
  34. * fixed missing comment openers for log section
  35. Revision 1.2 2000/07/13 11:33:07 michael
  36. + removed logs
  37. }