Please enable JavaScript to view this site.

A-Shell Consolidated Reference

xcall MIAMEX, MX_SETENV, envdef {,status}

MX_SETENV (MIAMEX 56) is used to define environment variables for the current process, including the special case of TERM, for which see Comments, below. To set environment variables for the remote ATE client, see Set Environment Variable.

This function has both a subroutine and a print tab implementation.

Parameters

envdef (String)  [in]

Contains a definition string of the form "name=value" specifying the name of the environment variable to be set (e.g. defined or modified) and its value. For example, "TERM=AM62CG", or "MYNAME=Jack". To delete an environment variable, set its value to nothing, e.g. "MYNAME=".

status (Signed Num) [out]

If specified, will return one of the following:

Code

Meaningt

0

Success

-1

General error

-2

Overflow of memory set aside for environment variables.

 

Comments

In general, setting an environment variable doesn't have any immediate side effect. Instead the value is simply stored, for the purposes of retrieving it later, either using MX_GETENV, or indirectly by referencing the variable name in some other expression context, as in the examples below:

xcall MIAMEX, MX_SETENV, "MYPATH=c:\vm\miame\jack", status

...

open #ch, "%MYPATH%\myfile.log", output

 

In the example above, we use the %envvar% syntax, which is recognized by Windows as well as by A-Shell, regardless of the platform, in nearly all contexts where a filespec may be used. If specifying an environment variable in a Unix shell context, use the syntax $env, e.g. $MYPATH.

Environment variable definitions are available only to the current A-Shell prcess, and to those child processes launched by it (e.g. by HOSTEX or MX_SHELLEX). As an example of the former, under Unix:

xcall MIAMEX, MX_SETENV, "MYPATH=/vm/miame/jack", status

...

xcall HOSTEX, "ls -l $MYPATH/a*", STDOUT$

 

A-Shell itself defines and recognizes several environment variables.

The TERM environment variable, used by UNIX—and A-Shell—to indicate the type of terminal in use, is a special case. When set from within an A-Shell session connected to a remote terminal (e.g. a Telnet or SSH session), A-Shell also re-initializes its terminal configuration and possibly changes its internal terminal "driver" to match the terminal type.

For A-Shell/Unix, the TERM variable is typically established automatically when the Telnet/SSH session is initiated. But you may also set it manually prior to launching A-Shell (from the shell prompt), or you can set it via the -td command line switch.

See Also