summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-04-04 10:31:09 -0700
committerH. Peter Anvin <hpa@zytor.com>2011-04-04 10:31:09 -0700
commit61565f3994e672607f6a00ae7a72373251d8f9e6 (patch)
tree7607e61e4ae1d49d39af1dcefc90caa1ef783e05 /com32
parentaf97187d32aa51d5109af813187b98081e7d7b2f (diff)
downloadsyslinux-61565f3994e672607f6a00ae7a72373251d8f9e6.tar.gz
com32: fix range handling in vsscanf
Fix multiple errors in building the bitmap for ranges in %[. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32')
-rw-r--r--com32/lib/vsscanf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/com32/lib/vsscanf.c b/com32/lib/vsscanf.c
index 751f22a7..9d4c7211 100644
--- a/com32/lib/vsscanf.c
+++ b/com32/lib/vsscanf.c
@@ -20,9 +20,8 @@
enum flags {
FL_SPLAT = 0x01, /* Drop the value, do not assign */
- FL_INV = 0x02, /* Character-set with inverse */
- FL_WIDTH = 0x04, /* Field width specified */
- FL_MINUS = 0x08, /* Negative number */
+ FL_WIDTH = 0x02, /* Field width specified */
+ FL_MINUS = 0x04, /* Negative number */
};
enum ranks {
@@ -295,9 +294,10 @@ set_integer:
break;
case st_match_init: /* Initial state for %[ match */
- if (ch == '^' && !(flags & FL_INV)) {
+ if (ch == '^' && !matchinv) {
matchinv = 1;
} else {
+ range_start = (unsigned char)ch;
set_bit((unsigned char)ch, matchmap);
state = st_match;
}
@@ -307,9 +307,9 @@ set_integer:
if (ch == ']') {
goto match_run;
} else if (ch == '-') {
- range_start = (unsigned char)ch;
state = st_match_range;
} else {
+ range_start = (unsigned char)ch;
set_bit((unsigned char)ch, matchmap);
}
break;
@@ -320,7 +320,7 @@ set_integer:
goto match_run;
} else {
int i;
- for (i = range_start; i < (unsigned char)ch; i++)
+ for (i = range_start; i <= (unsigned char)ch; i++)
set_bit(i, matchmap);
state = st_match;
}