home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFB.ZIP / FFHLP.ARC / ENVIRON.HLP < prev    next >
Encoding:
Text File  |  1987-12-19  |  2.3 KB  |  79 lines

  1. \ ENVIRON.HLP   Environment manipulation words          by Tom Zimmer
  2.  
  3. evseg           ( --- n1 )
  4.         Return n1 the value of the environment segment.
  5.  
  6. envsize         ( --- n1 )
  7.         Calculate n1 the size of the environment in bytes, clipped
  8.         to about 31k bytes.
  9.  
  10. "envfind        ( a1 n1 --- n2 bool )
  11.         Search the environment for the string specified by a1,n1.
  12.         Return a boolean flag TRUE if found, and n1 the offset
  13.         into the environment where the match occured.
  14.  
  15. .env            ( --- )
  16.         Display the current contents of the environment string.
  17.  
  18. comspec$        ( --- a1 )
  19.         The handle used to hold the COMSPEC string. I.e. COMMAND.COM
  20.  
  21. comspec@        ( --- )
  22.         Read the environment string, and extrac the COMSPEC
  23.         parameter. the COMSPEC is inserted in the COMSPEC$ handle.
  24.  
  25. .comspec        ( --- )
  26.         Print the current COMSPEC.
  27.  
  28. handle me$
  29.  
  30. : me@           ( --- ) \ extract my own execution name string
  31.                 me$ dup off 2 "envfind 0=
  32.                 abort" Couldn't find my execution name."
  33.                 4 + envsize swap
  34.                 me$ dup clr-hcb >nam -rot
  35.                 do      evseg i c@l 0= ?leave
  36.                         evseg i c@l over c! 1+
  37.                         me$ c@ 1+ me$ c!
  38.                 loop    drop ;
  39.  
  40. : .me           ( --- ) me@ me$ count type ;
  41.  
  42. comment:
  43.  
  44. envsize       ( --- n1 )
  45.         Return the maximum size the environment can be in bytes.
  46.  
  47. .env          ( --- )
  48.         Print the environment string used by the system.
  49.  
  50. "envfind      ( a1 n1 --- n2 bool )
  51.         Find the string a1 n1 in the environment, returning
  52.         bool true if found, and n2 the offset into env$ where it
  53.         was found. N2 is the offset to the BEGINNING of the
  54.         string searched for.
  55.  
  56. comspec$
  57.         Storage space for the command spec string.
  58.  
  59. comspec@      ( --- )
  60.         Extract the command spec from the environment string.
  61.  
  62. .comspec      ( --- )
  63.         Print the command spec.
  64.  
  65. me$
  66.         Storage space for the execution string used to execute
  67.         this forth currently running.
  68.  
  69. me@           ( --- )
  70.         Extract the execution string from the environment, and
  71.         place it in the string ME$
  72.  
  73. .me           ( --- )
  74.         Print the execution string after extracting it.
  75.  
  76. comment;
  77.  
  78.  
  79.