projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d4f7d9c
)
accept null longopts pointer in getopt_long
author
Rich Felker
<dalias@aerifal.cx>
Thu, 11 Dec 2014 06:07:02 +0000
(
01:07
-0500)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 11 Dec 2014 06:07:02 +0000
(
01:07
-0500)
this is an undocumented feature of GNU getopt_long that the BSD
version also mimics, and is reportedly needed by some programs.
src/misc/getopt_long.c
patch
|
blob
|
history
diff --git
a/src/misc/getopt_long.c
b/src/misc/getopt_long.c
index 469ee9206807eea24e4bf39bd2c545602d89253a..c3cf7f9333e05bf6122ea3ab704914af5196cc29 100644
(file)
--- a/
src/misc/getopt_long.c
+++ b/
src/misc/getopt_long.c
@@
-52,7
+52,7
@@
static int __getopt_long(int argc, char *const *argv, const char *optstring, con
static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)
{
- if (argv[optind][0] == '-' &&
+ if (
longopts &&
argv[optind][0] == '-' &&
((longonly && argv[optind][1]) ||
(argv[optind][1] == '-' && argv[optind][2])))
{