summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/getopt_long.c
AgeCommit message (Collapse)Author
2023-11-26lib: Automated cleanup of cdefs and other formattingWarner Losh
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
2023-11-26lib: Remove ancient SCCS tags.Warner Losh
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
2023-11-01libc: Purge unneeded cdefs.hWarner Losh
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
2023-08-16Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2021-01-19getopt: Fix conversion from string-literal to non-const char *Alex Richardson
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.
2019-01-04getopt_long(3): fix case of malformed long optKyle Evans
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
2014-06-22Merge intermediate OpenBSD v1.25 changes (almost identical to ours)Andrey A. Chernov
to reduce diff and bump OpenBSD patch level to v1.26. MFC after: 2 weeks Notes: svn path=/head/; revision=267756
2014-06-22getopt(3): recognize option:: as GNU extension for "optional options".Pedro F. Giffuni
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
2012-06-11Switch from 4-clause to 2-clause BSD license. (OpenBSD r1.22)Xin LI
No functional change. Obtained from: NetBSD via OpenBSD Notes: svn path=/head/; revision=236936
2006-09-23Keep compatible parts in sync with OpenBSD v1.21, add some comments.Andrey A. Chernov
No functional changes. Notes: svn path=/head/; revision=162574
2006-09-22Remove code #ifndef'ed in prev. commit to stay in sync with OpenBSDAndrey A. Chernov
v1.21 which just do that. Notes: svn path=/head/; revision=162557
2006-09-22Be more GNU compatible:Andrey A. Chernov
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
2004-07-06Keep it sync with OpenBSD:Andrey A. Chernov
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
2004-04-01Simplify one condition in prev. commit:Andrey A. Chernov
short_too already assumes FLAG_LONGONLY Notes: svn path=/head/; revision=127734
2004-04-01Fix parsing of ambiguous options, whole loop must be processedAndrey A. Chernov
Notes: svn path=/head/; revision=127733
2004-03-06Make GNU-compatible following case:Andrey A. Chernov
single '-' in command line and '-' (non-first) in options Notes: svn path=/head/; revision=126692
2004-03-03Make return code in noarg case GNU-compatibleAndrey A. Chernov
Notes: svn path=/head/; revision=126535
2004-03-03Be more GNU-compatible in diagnosticsAndrey A. Chernov
Notes: svn path=/head/; revision=126518
2004-03-01Improve GNU compatibility in several places, use internal GNU_COMPATIBLEAndrey A. Chernov
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
2004-03-01Change "-"-started options when POSIX_CORRECTLY is set handlingAndrey A. Chernov
in favour of GNU instead of NetBSD, because configure's use us and expect GNU. Notes: svn path=/head/; revision=126438
2004-02-24Add getopt_long_only() from OpenBSD and other OpenBSD cleanupsAndrey A. Chernov
PR: 63173 Submitted by: Marius Strobl <marius@alchemy.franken.de> Notes: svn path=/head/; revision=126189
2004-02-20Unbreak the upgrade path from 4.9 after removal of GNU getopt andRuslan Ermilov
<gnuregex.h>. Notes: svn path=/head/; revision=126039
2002-10-16de-__P()Alfred Perlstein
Notes: svn path=/head/; revision=105299
2002-09-29Add getopt_long(3).Eric Melville
Obtained from: NetBSD Sponsored by: Apple Notes: svn path=/head/; revision=104128