diff options
author | wlestes <wlestes> | 2007-05-12 13:11:57 +0000 |
---|---|---|
committer | wlestes <wlestes> | 2007-05-12 13:11:57 +0000 |
commit | 49d912365db43dbcce1e33e67df8a7b08a43cc98 (patch) | |
tree | 4a9fba64e8c49d1952c2ae427d29b32b22c2b3e5 | |
parent | db2ab8eae52e0f59f5b7972172541c7bc1b11b4a (diff) | |
download | flex-49d912365db43dbcce1e33e67df8a7b08a43cc98.tar.gz |
parse multiple short concatenated options; patch submitted by Petr Machata <pmachata@redhat.com
-rw-r--r-- | scanopt.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -789,12 +789,12 @@ int scanopt (svoid, arg, optindex) } optarg = pstart + 1; - arglen = 0; - while (optarg[arglen]) - arglen++; - - if (arglen == 0) + if (!*optarg) { optarg = NULL; + arglen = 0; + } + else + arglen = strlen (optarg); } /* At this point, we have a long or short option matched at opt_offset into @@ -812,13 +812,16 @@ int scanopt (svoid, arg, optindex) /* case: no args allowed */ if (auxp->flags & ARG_NONE) { - if (optarg) { + if (optarg && !is_short) { scanopt_err (s, opt_offset, is_short, errcode = SCANOPT_ERR_ARG_NOT_ALLOWED); INC_INDEX (s, 1); return errcode; } - INC_INDEX (s, 1); + else if (!optarg) + INC_INDEX (s, 1); + else + s->subscript++; return optp->r_val; } |