getopt: Command line options module

Usage

See Getopt module usage to understand how the getopt module can be used.

Table 1. GetOpt types (getopt.4gl)
Type Description
PUBLIC TYPE GetoptOptions DYNAMIC ARRAY OF RECORD
    name STRING,
    description STRING,
    opt_char CHAR,
    arg_type INTEGER
END RECORD
The GetoptOptions structured array type that holds the definition of command line options.
PUBLIC TYPE Getopt RECORD
    ... private members not documented here ...
    opt_ind INTEGER,
    opt_char CHAR,
    opt_arg STRING
  END RECORD
The Getopt structured type is used to process command line options.
Table 2. GetOpt constants (getopt.4gl)
Constant Description
GetOpt constants List of predefined constants for the getopt API.
Table 3. GetOpt functions (getopt.4gl)
Function Description
copyArguments( ind INTEGER )
  RETURNS DYNAMIC ARRAY OF STRING
Returns a dynamic array of string with all command line arguments starting from the provided index.
Table 4. GetOpt methods (getopt.4gl)
Function Description
Getopt.displayUsage(
   more_args STRING
   )
Display the usage and command line option description to the standard output stream.
Getopt.getMoreArgumentCount( )
  RETURNS INTEGER
Returns the number of command line arguments left to be processed after the known options.
Getopt.getMoreArgument( ind INTEGER )
  RETURNS STRING
Returns the additional argument at the specified index.
Getopt.getopt( )
  RETURNS INTEGER
Process the next command line option.
Getopt.initDefault(
   options GetoptOptions
   )
Initializes a variable defined with the Getopt type.
Getopt.initialize(
   prog_name STRING,
   argv DYNAMIC ARRAY OF STRING,
   options GetoptOptions
   )
Initializes a variable defined with the Getopt type for command line argument processing.
Getopt.invalidOptionSeen( )
  RETURNS BOOLEAN
Checks if the command line options are misused.
Getopt.isEof( )
  RETURNS BOOLEAN
Checks if there are more command line options to be read.
Getopt.isSuccess( )
  RETURNS BOOLEAN
Checks if a command line option parsing succeeded.