Task

Show how to get one of your process's environment variables.

The available variables vary by system;   some of the common ones available on Unix include:

   PATH
   HOME
   USER


      PRINT FNenvironment("PATH")
      PRINT FNenvironment("USERNAME")
      END
 
      DEF FNenvironment(envar$)
      LOCAL buffer%, size%
      SYS "GetEnvironmentVariable", envar$, 0, 0 TO size%
      DIM buffer% LOCAL size%
      SYS "GetEnvironmentVariable", envar$, buffer%, size%+1
      = $$buffer%