summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getopt_long.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* An optional argument cannot start with '-', even if permutation ismillert2004-06-031-4/+5
| | | | disabled. Magne Oestlyngen.
* Traditionally, getopt(3) has treated "--foo" the same as "--". However,millert2004-02-041-10/+9
| | | | | | | | this can cause confusion when a user tries to use a long option with a program that only supports short options. Furthermore, it appears to be in violation of POSIX, which states that "--" shall indicate the end of argument processing, not any string that begins with "--". OK otto@ and closes PR 3666.
* If permutation is disabled (as it is via getopt(3) or when POSIXLY_CORRECTmillert2003-09-221-2/+9
| | | | | | is set), we can accept an optional arg separated by whitespace. Previously, the optional arg needed to be adjacent to the option character. deraadt@ OK
* Sync with share/misc/license.template and add missing DARPA creditmillert2003-06-171-9/+13
| | | | where applicable.
* Use an ISC-tyle license for all my code; it is simpler and more permissive.millert2003-06-031-23/+12
|
* Use the getopt() in getopt_long.c which supports some GNU extensions.millert2003-06-021-2/+4
| | | | getopt.c is no longer compiled and will eventually be removed.
* When doing permutation, only treat "-" as an option if it was specifiedmillert2002-12-101-4/+5
| | | | in optstring. Problem noticed by Theo.
* SUS (and apparently 1003.1-2001) say to check optstring for NULLmillert2002-12-081-3/+5
|
* If we are passed "-" in argv and the user didn't specify '-' in optstring,millert2002-12-081-6/+10
| | | | return -1 like POSIX requires.
* BSD getopt() supports '-' in the optstring so we should too.millert2002-12-081-8/+15
| | | | This is used by a few programs such as man and su.
* Fix pasto in last commit.millert2002-12-071-3/+3
|
* For getopt_long_only() we *do* want to match single-character optionsmillert2002-12-071-41/+36
| | | | | as shortcuts for long ones, but only if this would not conflict with a short option in optstring. Now binutils gas works.
* Fix two compatibility issues with our getopt_long_only() vs. the GNU version:millert2002-12-061-28/+61
| | | | | | | | | | | | | | o Check for long options even when not at the beginning of an option. For instance, if -a is a short option w/o an arg and -static is a boolean long option then -astatic is valid for getopt_long_only(). o If a potential long argument does not match longopts and the first character is not a short option, print a warning and skip the rest of the argument. Also clean up some trailing whitespace and change return value of parse_long_options() from -2 to -1 when unmatched and in long_only mode. With these fixes the binutils ld seems happy with our getopt_long_only()
* Correctly handle -Wlong_arg (no space between -W and long_arg) when "W;"millert2002-12-051-6/+8
| | | | is in optstring.
* Reorganize this so that getopt_only_only() works correctly.millert2002-12-051-221/+208
| | | | | | | | In order for getopt_only_only() to work we need to check for long options before short ones. I have merged getopt_internal and getopt_long_internal into a single function with the actual long args parsing broken out into a separate function. This also simplifies the flow of control.
* Whoops, add missing #ifdef REPLACE_GETOPTmillert2002-12-031-2/+4
|
* GNU-like getopt_long() from NetBSD with changes by me to supportmillert2002-12-031-0/+510
getopt_long_only(). At some point this should replace the BSD getopt(3) but we are not there yet. While I am here add protection from the multiple getopt() definitions due to conflicting standards.