This function moves to the next switch on the command line (defined
as a switch character followed by a character within Switches,
casing being significant). The result returned is the first
character of the particular switch located. If there are no more
switches in the current section, returns ASCII.NUL. The switches
need not be separated by spaces (they can be concatenated if they do
not require an argument, e.g. -ab is the same as two separate
arguments -a -b).
Switches is a string of all the possible switches, separated by a
space. A switch can be followed by one of the following characters :
':' The switch requires a parameter. There can optionally be a space
on the command line between the switch and its parameter
'!' The switch requires a parameter, but there can be no space on the
command line between the switch and its parameter
'?' The switch may have an optional parameter. There can no space
between the switch and its argument
ex/ if Switches has the following value : "a? b"
The command line can be :
-afoo : -a switch with 'foo' parameter
-a foo : -a switch and another element on the
command line 'foo', returned by Get_Argument
Example: if Switches is "-a: -aO:", you can have the following
command lines :
-aarg : 'a' switch with 'arg' parameter
-a arg : 'a' switch with 'arg' parameter
-aOarg : 'aO' switch with 'arg' parameter
-aO arg : 'aO' switch with 'arg' parameter
Example:
Getopt ("a b: ac ad?")
accept either 'a' or 'ac' with no argument,
accept 'b' with a required argument
accept 'ad' with an optional argument
If the first item in switches is '*', then Getopt will catch
every element on the command line that was not caught by any other
switch. The character returned by GetOpt is '*'
Example
Getopt ("* a b")
If the command line is '-a -c toto.o -b', GetOpt will return
successively 'a', '*', '*' and 'b'. When '*' is returnd,
Full_Switch returns the corresponding item on the command line.
When Getopt encounters an invalid switch, it raises the exception
Invalid_Switch and sets Full_Switch to return the invalid switch.
When Getopt can not find the parameter associated with a switch, it
raises Invalid_Parameter, and sets Full_Switch to return the invalid
switch character.
Note: in case of ambiguity, e.g. switches a ab abc, then the longest
matching switch is returned.
Arbitrary characters are allowed for switches, although it is
strongly recommanded to use only letters and digits for portability
reasons.