basic.%getenv

C Function/BASIC Program, Releases: AP/Unix

Gets Unix environment variable.

Syntax

pointer=(char*)%getenv( name)

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.

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

See Also

Command Name Type Description
basic.%putenv C Function Assigns value to environment variable.
basic.cfunction Definition Declare a list of C functions.
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.
tcl.env Verb: Access Displays environment variables
tcl.environ Verb: Access Manipulates Unix shell environment variables from TCL.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.