o Yacc's lineno variable holds a total number of parsed lines.
Reset it to 1 for each devd config file so if the parser finds a syntax error devd(8) will report a correct line number. Submitted by: Niki Denev MFC after: 2 weeks
This commit is contained in:
parent
cfd6f8cd6c
commit
4a3050fc46
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157746
@ -311,6 +311,7 @@ config::parse_one_file(const char *fn)
|
|||||||
yyin = fopen(fn, "r");
|
yyin = fopen(fn, "r");
|
||||||
if (yyin == NULL)
|
if (yyin == NULL)
|
||||||
err(1, "Cannot open config file %s", fn);
|
err(1, "Cannot open config file %s", fn);
|
||||||
|
lineno = 1;
|
||||||
if (yyparse() != 0)
|
if (yyparse() != 0)
|
||||||
errx(1, "Cannot parse %s at line %d", fn, lineno);
|
errx(1, "Cannot parse %s at line %d", fn, lineno);
|
||||||
fclose(yyin);
|
fclose(yyin);
|
||||||
|
Loading…
Reference in New Issue
Block a user