(nytpu getopt)

POSIX getopt(3), in compliance with POSIX 2008

(getopt ostr . cmdln)

getopt will parse the command line parameters of a Scheme program following the POSIX Utility Syntax Guidelines.

Usage: (getopt optstring virtual-command-line)

Where optstring is an options string as defined in POSIX. See the specification for more details. Note that leading ':'s are ignored since this implementation of getopt doesn't print anything for you and doesn't return ':' and '?' like in the C function; the appropriate error is always raised.

Sample optstrings:

virtual-command-line ... is a list of strings as would be returned by (command-line). If there are no virtual command line arguments provided then the list returned by (command-line) is used.

getopt will return an association list with the keys corresponding to each of the flags present. If the flag does not accept a value then the value of the association will be #t, otherwise it will be a string containing the argument.

The special key 'command contains the name of the command.

The special key '@ contains the remaining non-option arguments, in the order they were present in on the command line.