GetLongOpts

Return next long option.

Declaration

Source position: getopts.pp line 52

  function GetLongOpts(ShortOpts: string; LongOpts: POption; 
                      var Longind: LongInt) : Char;

Description

Returns the next option found on the command-line, taking into account long options as well. If no more options are found, returns EndOfOptions. If the option requires an argument, it is returned in the OptArg variable.

if any of the option definitions in LongOpts array has the Flag pointer set, then the return value is the null character (#0 or char(0)) and the actual option letter is written in the location pointed to by Flag.

ShortOptions is a string containing all possible one-letter options. (see Getopt for its description and use) LongOpts is a pointer to the first element of an array of Option records, the last of which needs a name of zero length.

The function tries to match the names even partially (i.e. --app will match e.g. the append option), but will report an error in case of ambiguity.

If the option needs an argument, set Has_arg to Required_argument (1), if the option optionally has an argument, set Has_arg to Optional_argument (2). If the option needs no argument, set Has_arg to zero.

Required arguments can be specified in two ways :

Pasted to the option : --option=value As a separate argument : --option value

Optional arguments can only be specified through the first method.

Errors

see Getopt .

See also

Name Description
Getopt Get next short option.