diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2008-02-12 17:20:09 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2008-02-12 17:20:09 +0000 |
commit | f46f40b54e6993356a87a258abca4cb570cbed59 (patch) | |
tree | e209547ea126decae44a4d40f5940195aee98426 /newlib/libc/stdlib/getopt.c | |
parent | 025ce65fcbd2f1e783b86d9708031a1ea7a7e172 (diff) | |
download | cygnal-f46f40b54e6993356a87a258abca4cb570cbed59.tar.gz cygnal-f46f40b54e6993356a87a258abca4cb570cbed59.tar.bz2 cygnal-f46f40b54e6993356a87a258abca4cb570cbed59.zip |
2008-02-12 Peter Rosin <peda@lysator.liu.se>
* libc/stdlib/getopt.c (getopt_internal): Handle optional
arguments better for long options and short options not
appearing as the first option in a sequence.
Diffstat (limited to 'newlib/libc/stdlib/getopt.c')
-rw-r--r-- | newlib/libc/stdlib/getopt.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/newlib/libc/stdlib/getopt.c b/newlib/libc/stdlib/getopt.c index 06e378170..09952db19 100644 --- a/newlib/libc/stdlib/getopt.c +++ b/newlib/libc/stdlib/getopt.c @@ -308,13 +308,8 @@ getopt_internal (int argc, char *const argv[], const char *shortopts, case OPTIONAL_ARG: if (*possible_arg == '=') possible_arg++; - if (*possible_arg != '\0') - { - optarg = possible_arg; - optwhere = 1; - } - else - optarg = NULL; + optarg = (*possible_arg != '\0') ? possible_arg : NULL; + optwhere = 1; break; case REQUIRED_ARG: if (*possible_arg == '=') |