$fscanf("%s"): accept '-' and '_' chars.

This commit is contained in:
Holger Wächtler 2008-07-28 20:50:00 +02:00 committed by Stephen Williams
parent 15584a4f81
commit c71e930ffa
1 changed files with 7 additions and 5 deletions

View File

@ -379,12 +379,14 @@ static int scan_format(vpiHandle sys, struct byte_source*src, vpiHandle argv)
match_fail = 1;
ch = byte_getc(src);
while (isdigit(ch)) {
while (isdigit(ch) || ch == '_' || (value == 0 && ch == '-')) {
match_fail = 0;
tmp[value++] = ch;
tmp = realloc(tmp, value+1);
tmp[value] = 0;
ch = byte_getc(src);
if (ch != '_') {
tmp[value++] = ch;
tmp = realloc(tmp, value+1);
tmp[value] = 0;
ch = byte_getc(src);
}
}
byte_ungetc(src, ch);