summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/getopt_long.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix parsing of ambiguous options, the whole loop must be processed.millert2013-06-081-15/+22
| | | | From FreeBSD. OK miod@
* Fix PR 6267: recheck POSIXLY_CORRECT each time getopt_long() starts a newguenther2011-03-051-12/+12
| | | | | | | | argv and don't suppress the handling of leading '-' in optstring when POSIXLY_CORRECT is set. Based on patch from Eric Blake. ok and manpage update from millert@, manpage ok jmc@
* getopt_long.c replaced getopt.c 6+ years ago; we can retireblambert2010-07-221-7/+1
| | | | | | the REPLACE_GETOPT macro, at long last ok millert@
* Add parentheses to avoid warning:chl2007-10-311-2/+2
| | | | | | "suggest parentheses around && within ||" ok millert@
* from wiz@netbsd:jmc2006-10-041-8/+1
| | | | | | Log Message: Switch from 4-clause to 2-clause BSD license. Ok dillo@, board@.
* Back out change in rev 1.15 of to allow whitespace to separate amillert2006-09-221-10/+1
| | | | | | | | | flag from its optional argument if permutation is disabled. The idea was that since "r:" would match "-r foo" then "r::" should match "-r foo" too as long as we know that things have not been reshuffled. Unfortunately, this causes incompatibilities with GNU getopt_long when the POSIXLY_CORRECT environment variable is set. OK deraadt@
* dont' -> don't in comments;jmc2005-10-251-2/+2
| | | | from ray lai;
* zap remaining rcsid.espie2005-08-081-5/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* ansi + de-registerpat2005-03-301-14/+6
| | | | ok otto deraadt
* 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.