39 lines
909 B
Diff
39 lines
909 B
Diff
|
diff -urp flex-2.5.33/scanopt.c flex-2.5.33-pm/scanopt.c
|
||
|
--- flex-2.5.33/scanopt.c 2002-08-29 22:30:25.000000000 +0200
|
||
|
+++ flex-2.5.33-pm/scanopt.c 2007-05-11 17:03:01.000000000 +0200
|
||
|
@@ -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,10 @@ int scanopt (svoid, arg, optindex)
|
||
|
|
||
|
/* case: no args allowed */
|
||
|
if (auxp->flags & ARG_NONE) {
|
||
|
- if (optarg) {
|
||
|
- scanopt_err (s, opt_offset, is_short, errcode =
|
||
|
- SCANOPT_ERR_ARG_NOT_ALLOWED);
|
||
|
+ if (!optarg)
|
||
|
INC_INDEX (s, 1);
|
||
|
- return errcode;
|
||
|
- }
|
||
|
- INC_INDEX (s, 1);
|
||
|
+ else
|
||
|
+ s->subscript++;
|
||
|
return optp->r_val;
|
||
|
}
|
||
|
|