History log of /seL4-refos-master/libs/libmuslc/src/misc/getopt_long.c
Revision Date Author Comments
# b24f1d25 19-Oct-2016 Rich Felker <dalias@aerifal.cx>

fix getopt_long_only misinterpreting "--" as an option


# 63cac4e2 21-Jan-2015 Rich Felker <dalias@aerifal.cx>

simplify part of getopt_long

as a result of commit e8e4e56a8ce1f3d7e4a027ff5478f2f8ea70c46b,
the later code path for setting optarg to a null pointer is no longer
necessary, and removing it eliminates an indention level and arguably
makes the code more readable.


# e8e4e56a 21-Jan-2015 Rich Felker <dalias@aerifal.cx>

always set optarg in getopt_long

the standard getopt does not touch optarg unless processing an option
with an argument. however, programs using the GNU getopt API, which we
attempt to provide in getopt_long, expect optarg to be a null pointer
after processing an option without an argument.

before argument permutation support was added, such programs typically
detected its absence and used their own replacement getopt_long,
masking the discrepency in behavior.


# 699d4532 11-Jan-2015 Rich Felker <dalias@aerifal.cx>

fix regression in getopt_long support for non-option arguments

commit b72cd07f176b876aa51864d93aa8101477b1d732 added support for a
this feature in getopt, but it was later broken in the case where
getopt_long is used as a side effect of the changes made in commit
91184c4f16b143107fa9935edebe5d2b20bd70d8, which prevented the
underlying getopt call from seeing the leading '-' or '+' character in
optstring.

this commit changes the logic in the getopt_long core to check for a
leading colon, possibly after the leading '-' or '+', without
depending on the latter having been skipped by the caller. a minor
incorrectness in the return value for one error condition in
getopt_long is also fixed when opterr has been set to zero but
optstring has no leading ':'.


# 0217ed72 20-Dec-2014 Rich Felker <dalias@aerifal.cx>

set optopt in getopt_long

this is undocumented but possibly expected behavior of GNU
getopt_long, and useful when error message printing has been
suppressed.


# 91184c4f 20-Dec-2014 Rich Felker <dalias@aerifal.cx>

add error message printing to getopt_long and make related improvements

some related changes are also made to getopt, and the return value of
getopt_long in the case of missing arguments is fixed.


# da16224f 13-Dec-2014 Rich Felker <dalias@aerifal.cx>

simplify getopt_long argv permutation loop logic


# 567cc81c 12-Dec-2014 Rich Felker <dalias@aerifal.cx>

fix handling of "--" with getopt_long argv permutation

if argv permutation is used, the option terminator "--" should be
moved before any skipped non-option arguments rather than being left
in the argv tail where the caller will see and interpret it.


# b4ef1830 10-Dec-2014 Rich Felker <dalias@aerifal.cx>

accept null longopts pointer in getopt_long

this is an undocumented feature of GNU getopt_long that the BSD
version also mimics, and is reportedly needed by some programs.


# cfd7b4ac 10-Dec-2014 Rich Felker <dalias@aerifal.cx>

support abbreviated options in getopt_long


# 59f6232f 10-Dec-2014 Rich Felker <dalias@aerifal.cx>

support options after non-option arguments in getopt_long (argv permutation)


# b72cd07f 25-Nov-2014 Gianluca Anzolin <gianluca@sottospazio.it>

add support for non-option arguments extension to getopt

this is a GNU extension, activated by including '-' as the first
character of the options string, whereby non-option arguments are
processed as if they were arguments to an option character '\1' rather
than ending option processing.


# 030e5263 30-Sep-2012 Rich Felker <dalias@aerifal.cx>

add getopt reset support

based on proposed patches by Daniel Cegiełka, with minor changes:
- use a weak symbol for optreset so it doesn't clash with namespace
- also reset optpos (position in multi-option arg like -lR)
- also make getopt_long support reset


# b9bb8f67 06-Sep-2012 Rich Felker <dalias@aerifal.cx>

cleanup src/linux and src/misc trees, etc.

previously, it was pretty much random which one of these trees a given
function appeared in. they have now been organized into:

src/linux: non-POSIX linux syscalls (possibly shard with other nixen)
src/legacy: various obsolete/legacy functions, mostly wrappers
src/misc: still mostly uncategorized; some misc POSIX, some nonstd
src/crypt: crypt hash functions

further cleanup will be done later.