Getopt type

The Getopt structured type is used to process command line options.

Syntax

PUBLIC TYPE Getopt RECORD
    ... private members not documented here ...
    opt_ind INTEGER,
    opt_char CHAR,
    opt_arg STRING
  END RECORD
  1. opt_ind current command line argument index that is processed.
  2. opt_char is the single-character short name of the current processed option.
  3. opt_arg if present, holds the value parameter of the current processed option (--option=value). Otherwise, this member is NULL.

Usage

This type defines the Getopt record that is used with getopt methods to parse and validate command line options.

A variable of the type Getopt must be defined and initialized with the initDefault() or initialize() method, before using the getopt() method in a WHILE loop, to process command line options.

Example

IMPORT FGL getopt

MAIN
    DEFINE g getopt.Getopt
    DEFINE _options getopt.GetoptOptions = [ ... ]

    CALL g.initDefault(_options)
    ...
END MAIN