basic.%getenv C Function/BASIC Program

basic.%getenv

Command basic.%getenv C Function/BASIC Program
Applicable release versions: AP/Unix
Category BASIC Program (486)
Description searches the environment for a string of the form "name=value" and returns a pointer to "value" in the current environment if such a string is present, otherwise, a NULL is returned.
Syntax pointer=(char*)%getenv( name)
Options
Example
* Get the Unix name of our terminal: eg TERM=wy50
pointer=(char*)%getenv( 'TERM' )
if pointer=0 then
  crt 'Unix TERM is not defined'
end else
  * We got a C pointer to the 'name'. Copy it into Pick
  * BASIC variable
  char pickterm[32]
  %strcpy( pickterm, (char*)p )
  pickterm=field(pickterm,char(0),1)
end
Purpose
Related basic.%putenv
basic.cfunction
basic.cfunc
tcl.env
tcl.environ