(xutrailer): Fix parsing of /config. Change human-readable syntax not

to accept number of records.  Don't skip empty lines after trailer.
This commit is contained in:
Markus Armbruster 2006-02-08 21:53:04 +00:00
parent 72127c838f
commit d329c4f8e6

View file

@ -693,16 +693,9 @@ xutrailer(FILE *fp, int type, int row)
res = -1;
if (human) {
if (fscanf(fp, "config%n", &res) != 0) {
return gripe("Malformed table footer");
}
}
ch = skipfs(fp);
if (!isdigit(ch)) {
if (ch != '\n' || !human)
if (fscanf(fp, "config%n", &res) != 0 || res < 0)
return gripe("Malformed table footer");
} else {
ungetc(ch, fp);
if (fscanf(fp, "%d", &rows) != 1)
return gripe("Malformed table footer");
if (row != rows)
@ -711,9 +704,7 @@ xutrailer(FILE *fp, int type, int row)
}
if (skipfs(fp) != '\n')
return gripe("Junk after table footer");
while ((ch = skipfs(fp)) == '\n') ;
ungetc(ch, fp);
lineno++;
return 0;
}