Improve error messages.
This commit is contained in:
parent
b11aa718ce
commit
28787caa95
1 changed files with 8 additions and 7 deletions
|
@ -142,13 +142,13 @@ xufldname(FILE *fp, int i)
|
||||||
return gripe("Unexpected EOF");
|
return gripe("Unexpected EOF");
|
||||||
case '\n':
|
case '\n':
|
||||||
if (nxt_sel >= 0)
|
if (nxt_sel >= 0)
|
||||||
return gripe("Fields missing");
|
return gripe("Header fields missing"); /* TODO which? */
|
||||||
lineno++;
|
lineno++;
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
ungetc(ch, fp);
|
ungetc(ch, fp);
|
||||||
if (getid(fp, buf) < 0)
|
if (getid(fp, buf) < 0)
|
||||||
return gripe("Junk in field %d", i + 1);
|
return gripe("Junk in header field %d", i + 1);
|
||||||
ch = getc(fp);
|
ch = getc(fp);
|
||||||
if (ch != '(') {
|
if (ch != '(') {
|
||||||
ungetc(ch, fp);
|
ungetc(ch, fp);
|
||||||
|
@ -158,17 +158,18 @@ xufldname(FILE *fp, int i)
|
||||||
ungetc(ch, fp);
|
ungetc(ch, fp);
|
||||||
if (isdigit(ch) || ch == '-' || ch == '+') {
|
if (isdigit(ch) || ch == '-' || ch == '+') {
|
||||||
if (fscanf(fp, "%d", &idx) != 1) {
|
if (fscanf(fp, "%d", &idx) != 1) {
|
||||||
return gripe("Malformed number in index field %d", i + 1);
|
return gripe("Malformed number in index of header field %d",
|
||||||
|
i + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getid(fp, buf) < 0)
|
if (getid(fp, buf) < 0)
|
||||||
return gripe("Malformed string in index field %d", i + 1);
|
return gripe("Malformed index in header field %d", i + 1);
|
||||||
return gripe("Symbolic index in field %d not yet implemented",
|
return gripe("Symbolic index in header field %d not yet implemented",
|
||||||
i + 1);
|
i + 1);
|
||||||
}
|
}
|
||||||
ch = getc(fp);
|
ch = getc(fp);
|
||||||
if (ch != ')')
|
if (ch != ')')
|
||||||
return gripe("Malformed index field %d", i + 1);
|
return gripe("Malformed index in header field %d", i + 1);
|
||||||
return deffld(i, buf, idx);
|
return deffld(i, buf, idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,7 +418,7 @@ setstr(int fldidx, char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ca->ca_flags & NSC_CONST) && strcmp(old, str))
|
if ((ca->ca_flags & NSC_CONST) && strcmp(old, str))
|
||||||
return gripe("Value for field %d must be %s", fldidx + 1, old);
|
return gripe("Value for field %d must be \"%s\"", fldidx + 1, old);
|
||||||
|
|
||||||
nxtfld();
|
nxtfld();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue