http://git.etherboot.org
/
mirror
/
winof
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
getopt: return '?' if user wants an arg, but none is provided
[mirror/winof/.git]
/
etc
/
user
/
getopt.c
diff --git
a/etc/user/getopt.c
b/etc/user/getopt.c
index
1282f1b
..
9e05699
100644
(file)
--- a/
etc/user/getopt.c
+++ b/
etc/user/getopt.c
@@
-79,9
+79,9
@@
int getopt(int argc, char * const argv[], char const *opts)
goto out;
\r
\r
optarg = argv[++optind];
\r
- while(optarg && *optarg && (*optarg == ' ' || *optarg == ' ')) optarg++;
\r
- if (optarg && !(*optarg))
\r
- optarg = NULL;
\r
+ if (!optarg || !(*optarg)) {
\r
+ return '?';
\r
+ }
\r
\r
out:
\r
optind++;
\r