xundump: Report all missing fields, not just first one
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
41f00fdd33
commit
67425a06d9
4 changed files with 31 additions and 9 deletions
|
@ -424,7 +424,7 @@ xufldname(FILE *fp, int i)
|
||||||
static int
|
static int
|
||||||
xufld(FILE *fp, int i)
|
xufld(FILE *fp, int i)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch, j;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
double dbl;
|
double dbl;
|
||||||
long set;
|
long set;
|
||||||
|
@ -435,14 +435,15 @@ xufld(FILE *fp, int i)
|
||||||
return gripe("Unexpected EOF");
|
return gripe("Unexpected EOF");
|
||||||
case '\n':
|
case '\n':
|
||||||
CANT_HAPPEN(i > nflds);
|
CANT_HAPPEN(i > nflds);
|
||||||
if (i < nflds) {
|
for (j = i; j < nflds; j++) {
|
||||||
if (CA_IS_ARRAY(fldca[i]))
|
if (CA_IS_ARRAY(fldca[j]))
|
||||||
return gripe("Field %s(%d) missing",
|
gripe("Field %s(%d) missing",
|
||||||
fldca[i]->ca_name, fldidx[i]);
|
fldca[j]->ca_name, fldidx[j]);
|
||||||
return gripe("Field %s missing", fldca[i]->ca_name);
|
else
|
||||||
|
gripe("Field %s missing", fldca[j]->ca_name);
|
||||||
}
|
}
|
||||||
lineno++;
|
lineno++;
|
||||||
return 0;
|
return i < nflds ? -1 : 0;
|
||||||
case '+': case '-': case '.':
|
case '+': case '-': case '.':
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
|
|
@ -56,7 +56,17 @@ tests/empdump/xundump-errors/fld-malnum:2: Malformed number in field 1
|
||||||
tests/empdump/xundump-errors/fld-malstr:2: Malformed string in field 1
|
tests/empdump/xundump-errors/fld-malstr:2: Malformed string in field 1
|
||||||
tests/empdump/xundump-errors/fld-many:2: Too many fields, expected only 6
|
tests/empdump/xundump-errors/fld-many:2: Too many fields, expected only 6
|
||||||
tests/empdump/xundump-errors/fld-miss:2: Field name missing
|
tests/empdump/xundump-errors/fld-miss:2: Field name missing
|
||||||
tests/empdump/xundump-errors/fld-miss2:2: Field ctype(0) missing
|
tests/empdump/xundump-errors/fld-miss:2: Field mnem missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field value missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field sell missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field lbs missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field pkg(0) missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field pkg(1) missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field pkg(2) missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field pkg(3) missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field pkg(4) missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss:2: Field melt_denom missing
|
||||||
|
tests/empdump/xundump-errors/fld-miss2:3: Field ctype(0) missing
|
||||||
tests/empdump/xundump-errors/fld-nonil:3: Field 19 doesn't take nil
|
tests/empdump/xundump-errors/fld-nonil:3: Field 19 doesn't take nil
|
||||||
tests/empdump/xundump-errors/fld-nonum:3: Field 2 doesn't take numbers
|
tests/empdump/xundump-errors/fld-nonum:3: Field 2 doesn't take numbers
|
||||||
tests/empdump/xundump-errors/fld-nostr:3: Field 1 doesn't take strings
|
tests/empdump/xundump-errors/fld-nostr:3: Field 1 doesn't take strings
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
XDUMP item 0
|
XDUMP item 0
|
||||||
0
|
0
|
||||||
# Field name missing
|
# Field name missing
|
||||||
|
# Field mnem missing
|
||||||
|
# Field value missing
|
||||||
|
# Field sell missing
|
||||||
|
# Field lbs missing
|
||||||
|
# Field pkg(0) missing
|
||||||
|
# Field pkg(1) missing
|
||||||
|
# Field pkg(2) missing
|
||||||
|
# Field pkg(3) missing
|
||||||
|
# Field pkg(4) missing
|
||||||
|
# Field melt_denom missing
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
XDUMP product 0
|
config product
|
||||||
|
uid name sname ct(0) ...
|
||||||
0 "iron\040ore" "iron"
|
0 "iron\040ore" "iron"
|
||||||
# Field ctype(0) missing
|
# Field ctype(0) missing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue