(xufld, setstr): Improve diagnostics.
This commit is contained in:
parent
565b6630a2
commit
2faa68c6e3
1 changed files with 6 additions and 2 deletions
|
@ -221,8 +221,12 @@ xufld(FILE *fp, int i)
|
||||||
case EOF:
|
case EOF:
|
||||||
return gripe("Unexpected EOF");
|
return gripe("Unexpected EOF");
|
||||||
case '\n':
|
case '\n':
|
||||||
if (i != nflds)
|
if (i != nflds) {
|
||||||
|
if (fldca[i]->ca_type != NSC_STRINGY && fldca[i]->ca_len)
|
||||||
|
return gripe("Field %s(%d) missing",
|
||||||
|
fldca[i]->ca_name, fldidx[i]);
|
||||||
return gripe("Field %s missing", fldca[i]->ca_name);
|
return gripe("Field %s missing", fldca[i]->ca_name);
|
||||||
|
}
|
||||||
lineno++;
|
lineno++;
|
||||||
return 0;
|
return 0;
|
||||||
case '+': case '-': case '.':
|
case '+': case '-': case '.':
|
||||||
|
@ -532,7 +536,7 @@ setstr(int fldno, char *str)
|
||||||
if (CANT_HAPPEN(idx))
|
if (CANT_HAPPEN(idx))
|
||||||
return -1;
|
return -1;
|
||||||
if (!str)
|
if (!str)
|
||||||
return gripe("Field doesn't take nil");
|
return gripe("Field %d doesn't take nil", fldno + 1);
|
||||||
len = ca->ca_len;
|
len = ca->ca_len;
|
||||||
if (strlen(str) > len)
|
if (strlen(str) > len)
|
||||||
return gripe("Field %d takes at most %d characters",
|
return gripe("Field %d takes at most %d characters",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue