#
ef2b5e9f |
|
16-Feb-2016 |
Rich Felker <dalias@aerifal.cx> |
fix unlikely corner cases in getopt's message printing like fputs (see commit 10a17dfbad2c267d885817abc9c7589fc7ff630b), the message printing code for getopt assumed that fwrite only returns 0 on failure, but it can also happen on success if the total length to be written is zero. programs with zero-length argv[0] were affected. commit 500c6886c654fd45e4926990fee2c61d816be197 introduced this problem in getopt by fixing the fwrite behavior to conform to the requirements of ISO C. previously the wrong expectations of the getopt code were met by the fwrite implementation.
|
#
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.
|
#
d3357268 |
|
19-Dec-2014 |
Rich Felker <dalias@aerifal.cx> |
support translation for getopt error messages
|
#
1d8d86ae |
|
19-Dec-2014 |
Rich Felker <dalias@aerifal.cx> |
fix stderr locking and ferror semantics in getopt message printing if writing the error message fails, POSIX requires that ferror(stderr) be set. and as a function that operates on a stdio stream, getopt is required to lock the stream it uses, stderr. fwrite calls are used instead of fprintf since there is a demand from some users not to pull in heavy stdio machinery via getopt. this mimics the original code using write.
|
#
d4f7d9c4 |
|
10-Dec-2014 |
Rich Felker <dalias@aerifal.cx> |
fix getopt handling of initial '+' in optstring in the case where an initial '+' was passed in optstring (a getopt_long feature to suppress argv permutation), getopt would fail to see a possible subsequent ':', resulting in incorrect handling of missing arguments.
|
#
014275b5 |
|
04-Dec-2014 |
Rich Felker <dalias@aerifal.cx> |
fix getopt handling of ':' modifier for multibyte option characters the previous hard-coded offsets of +1 and +2 contained a hidden assumption that the option character matched was single-byte, despite this implementation of getopt attempting to support multibyte option characters. this patch reworks the matching logic to leave the final index pointing just past the matched character so that fixed offsets can be used to check for ':'.
|
#
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.
|
#
acccc93e |
|
21-Oct-2014 |
Felix Fietkau <nbd@openwrt.org> |
getopt: fix optional argument processing Processing an option character with optional argument fails if the option is last on the command line. This happens because the if (optind >= argc) check runs first before testing for optional argument.
|
#
66fcde4a |
|
11-Jun-2014 |
Rich Felker <dalias@aerifal.cx> |
support optional-argument extension to getopt via double-colon this extension is not incompatible with the standard behavior of the function, not expensive, and avoids requiring a replacement getopt with full GNU extensions for a few important apps including busybox's sed with the -i option.
|
#
14f0272e |
|
06-Apr-2013 |
Isaac Dunham <idunham@lavabit.com> |
Add ABI compatability aliases. GNU used several extensions that were incompatible with C99 and POSIX, so they used alternate names for the standard functions. The result is that we need these to run standards-conformant programs that were linked with glibc.
|
#
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
|
#
0b44a031 |
|
11-Feb-2011 |
Rich Felker <dalias@aerifal.cx> |
initial check-in, version 0.5.0
|