Built-in variables
The built-in variables are a set of special, read-only variables that
are predefined in the Form and Menu Language.
These built-in variables
can only be referenced, but never set, in frame definition files.
The built-in variables are as follows:
ARGn-
This variable evaluates to the nth argument passed to the corresponding
form, menu, or text frame.
DISPLAYH-
This variable evaluates to the height of the available frame display area,
minus the three lines reserved for the message line,
the command line, and the screen labels for function keys.
DISPLAYH is placed in the UNIX shell environment.
DISPLAYW-
This variable evaluates to the width of the available frame display area
of the screen.
DISPLAYW is placed in the UNIX shell environment.
Form_Choice-
This variable evaluates to the last choice made from a choices menu.
Fn-
This variable evaluates to the current value of the nth field.
NOTE:
Field n cannot reference field m, where m is greater
than n, and field m does not have a
value
descriptor defined.
HAS_COLORS-
This variable evaluates to TRUE if fmli is invoked from a color
terminal, otherwise it evaluates to FALSE.
HAS_COLORS is placed in the UNIX shell environment.
LININFO-
This variable evaluates to null if the current menu item or form field
does not have a
lininfo descriptor defined.
Otherwise it evaluates to the value
of the lininfo descriptor.
(See
``Frame definition files''
for an example of how to use this variable to
output a help message for form fields or menu items.)
LOADPFK-
When this variable is set to yes, true,
or the null string, it directs
FMLI to download alternative keystroke
sequences into the function keys of a terminal that does not have fixed,
preset values for them.
LOADPFK is read from the UNIX shell environment.
(See
``Keyboard and mouse support'',
for more information on automatic function key
downloading.)
MAILCHECK-
This variable determines the
amount of time before a SIGALRM alarm automatically occurs.
The minimum value for MAILCHECK is 120 seconds.
If MAILCHECK is not defined, or defined as 0 (zero),
it defaults to 300 seconds.
MAILCHECK is read from the UNIX shell environment.
NR-
This variable evaluates to the number of items in the menu frame.
RET-
This variable evaluates to the exit value of the last executable run,
whether in a backquoted expression
or as the executable
argument to the built-in utility run.
If such an exec or fork system call
fails, RET will be set to the sum of the return
code of the exec or fork
plus the integer 1000.
SELECTED-
This variable evaluates to TRUE if the current item in a
multi-select menu has been marked.
It evaluates to FALSE if the item is not marked.
TEXT-
This variable evaluates to the value of the text descriptor in
a text frame.
Variable evaluation
In frame definition files and application level files,
variables are referenced
by prefixing either $ or $! to the variable
name.
When you use the $name notation, the variable is
evaluated only once.
This implies that special characters lose their special meaning when
they are coded in the values of strings.
For example, if you assigned a value to the variable VAR as follows
`set -l VAR="`date` $HOME"`
and then requested FMLI to display the value of $VAR,
the value displayed would be
`date` $HOME
When you use the $!name notation, the variable will be
evaluated multiple times--as long as special characters remain
in the expression.
For example, if the variable VAR had the same value assigned as shown
above,
but you requested FMLI to display the value of $!VAR, the
value displayed would be, for instance,
Thu Sep 29 14:43:41 EDT 1989 /home/loginID
The $! notation should never be used when referencing
the built-in variables (especially F1, F2, and so on), because it
is impossible to guard against users entering special characters
in form fields.
NOTE:
Prior to FMLI Release 4.0, only the $ notation existed for variable
evaluation, and that notation exhibited the behavior now defined for
$!.
For previously written FMLI applications now being run under FMLI
Release 4.0 or later, a Boolean descriptor, use_incorrect_pre4.0_behavior,
can be set in the initialization file if needed.
This will cause FMLI
to ignore the $! notation and interpret $ in the old way.
The default value (if not defined in the initialization file) for
use_incorrect_pre4.0_behavior is FALSE.
This descriptor, and consequently the ability to make the $ notation
behave like the $! notation, will be removed in the next
release of FMLI.
When a variable is evaluated that does not specifically
reference a file,
two environments are searched:
local environment-
This environment is specific to the current FMLI process (variables set
with set -l).
This is similar to an unexported shell variable.
UNIX system environment-
The UNIX system environment is the standard UNIX environment.
Whenever ``environment'' is referred to in this text,
these environments are searched in the order listed.
Variable names must be referenced using one of the following formats:
$variable or ${variable}-
Look for variable in the environment and evaluate to
the value of that variable.
NOTE:
The built-in variable Fn must be used with the
format {Fn} for fields greater than the ninth, that is,
{F10}, {F11}, and so on.
${variable:-default}-
Look for variable in the environment and if it is found evaluate to its value.
If it is not found, evaluate to default.
${(filename)variable}-
Look for a line of the format variable=value
in the file filename.
If such a line is found, evaluate to value.
${(filename)variable:-default}-
Same as above, except if variable is not found
anywhere, evaluate to default.
Note that filename and default may themselves be variables, such as
${($HOME/.variables)NAME:-$LOGNAME}
Next topic:
Descriptors
Previous topic:
User-defined variables
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004