aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/getopt_long.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-2/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* lib: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* libc: Purge unneeded cdefs.hWarner Losh2023-11-011-1/+0
| | | | | | | | | These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* getopt: Fix conversion from string-literal to non-const char *Alex Richardson2021-01-191-2/+2
| | | | | | Define a non-const static char EMSG[] = "" to avoid having to add __DECONST() to all uses of EMSG. Also make current_dash a const char * to fix this warning.
* getopt_long(3): fix case of malformed long optKyle Evans2019-01-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | When presented with an arg string like '-l-', getopt_long will successfully parse out the 'l' short option, then proceed to match '--' against the first longopts entry as it later does a strncmp with len=0. This latter bit is arguably another bug in itself, but presumably not a practical issue as all callers of parse_long_options are already doing the right thing (except this one pointed out). An opt string like '-l-' should be considered malformed and throw a bad argument rather than behaving as if '--' were passed. It cannot possibly do what the invoker expects, and it's probably the result of a typo (ls -l- a) rather than any intent. Reported by: Tony Overfield <toverfield@yahoo.com> Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18616 Notes: svn path=/head/; revision=342757
* Merge intermediate OpenBSD v1.25 changes (almost identical to ours)Andrey A. Chernov2014-06-221-18/+12
| | | | | | | | | to reduce diff and bump OpenBSD patch level to v1.26. MFC after: 2 weeks Notes: svn path=/head/; revision=267756
* getopt(3): recognize option:: as GNU extension for "optional options".Pedro F. Giffuni2014-06-221-1/+1
| | | | | | | | | | | | | Also ANSIfy a function declaration. While here update the OpenBSD patch level in getopt_long.c as we already have the corresponding change. Obtained from: NetBSD MFC after: 2 weeks Notes: svn path=/head/; revision=267745
* Switch from 4-clause to 2-clause BSD license. (OpenBSD r1.22)Xin LI2012-06-111-8/+1
| | | | | | | | | No functional change. Obtained from: NetBSD via OpenBSD Notes: svn path=/head/; revision=236936
* Keep compatible parts in sync with OpenBSD v1.21, add some comments.Andrey A. Chernov2006-09-231-15/+7
| | | | | | | No functional changes. Notes: svn path=/head/; revision=162574
* Remove code #ifndef'ed in prev. commit to stay in sync with OpenBSDAndrey A. Chernov2006-09-221-12/+0
| | | | | | | v1.21 which just do that. Notes: svn path=/head/; revision=162557
* Be more GNU compatible:Andrey A. Chernov2006-09-221-2/+5
| | | | | | | | | don't be greedy on the GNU "::" extension when arg separated by whitespace and POSIX_CORRECTLY is set. From POSIX point of view this is unclear situation, so minimal assumption looks right. Notes: svn path=/head/; revision=162555
* Keep it sync with OpenBSD:Andrey A. Chernov2004-07-061-3/+4
| | | | | | | | | | An optional argument cannot start with '-', even if permutation is disabled. Obtained from: OpenBSD getopt_long.c v1.17 Notes: svn path=/head/; revision=131710
* Simplify one condition in prev. commit:Andrey A. Chernov2004-04-011-2/+1
| | | | | | | short_too already assumes FLAG_LONGONLY Notes: svn path=/head/; revision=127734
* Fix parsing of ambiguous options, whole loop must be processedAndrey A. Chernov2004-04-011-17/+27
| | | | Notes: svn path=/head/; revision=127733
* Make GNU-compatible following case:Andrey A. Chernov2004-03-061-0/+4
| | | | | | | single '-' in command line and '-' (non-first) in options Notes: svn path=/head/; revision=126692
* Make return code in noarg case GNU-compatibleAndrey A. Chernov2004-03-031-0/+4
| | | | Notes: svn path=/head/; revision=126535
* Be more GNU-compatible in diagnosticsAndrey A. Chernov2004-03-031-11/+61
| | | | Notes: svn path=/head/; revision=126518
* Improve GNU compatibility in several places, use internal GNU_COMPATIBLEAndrey A. Chernov2004-03-011-10/+30
| | | | | | | | | | define for it. Don't catch POSIXLY_CORRECT env. into static variable, it can be changed on the fly by program. Use P1003.2 standartized illoptchar[] Notes: svn path=/head/; revision=126452
* Change "-"-started options when POSIX_CORRECTLY is set handlingAndrey A. Chernov2004-03-011-1/+5
| | | | | | | | in favour of GNU instead of NetBSD, because configure's use us and expect GNU. Notes: svn path=/head/; revision=126438
* Add getopt_long_only() from OpenBSD and other OpenBSD cleanupsAndrey A. Chernov2004-02-241-237/+295
| | | | | | | | PR: 63173 Submitted by: Marius Strobl <marius@alchemy.franken.de> Notes: svn path=/head/; revision=126189
* Unbreak the upgrade path from 4.9 after removal of GNU getopt andRuslan Ermilov2004-02-201-2/+0
| | | | | | | <gnuregex.h>. Notes: svn path=/head/; revision=126039
* de-__P()Alfred Perlstein2002-10-161-3/+3
| | | | Notes: svn path=/head/; revision=105299
* Add getopt_long(3).Eric Melville2002-09-291-0/+494
Obtained from: NetBSD Sponsored by: Apple Notes: svn path=/head/; revision=104128