Command Line Parsing Variables

These variables support the getopt(), getopt_long(), and getopt_long_only() policy language functions. These functions examine the read-only task information variable env. The following table summarizes the command line parsing variables.

Variable Description
optarg

Contains the parameter for the last argument or an empty string if none was found.

Version 3.5 and earlier: variable not available.

Version 4.0 and later: variable available.

opterr

Determines whether to print errors from the getopt(), getopt_long (), and getopt_long_only() functions.

Version 3.5 and earlier: variable not available.

Version 4.0 and later: variable available.

optind

Contains the current argument list index.

Version 3.5 and earlier: variable not available.

Version 4.0 and later: variable available.

optopt

Contains the letter of the last option that had a problem.

Version 3.5 and earlier: variable not available.

Version 4.0 and later: variable available.

optreset

Set this to true to restart the getopt functions from the start. The next time a getopt function is called, optind is set to 1.

Version 3.5 and earlier: variable not available.

Version 4.0 and later: variable available.

optstrictparameters

The getopt_long() function provides strict interpretation of argument parameters. In particular, arguments with optional parameters are accepted only in the form --argument=parameter. Some non-compliant programs allow --argument parameter. To make getopt_long() recognize the latter form, set optstrictparameters to false.

Version 3.5 and earlier: variable not available.

Version 4.0 and later: variable available.