awk: handle bad/incomplete input in maketab (thanks kenji arisawa)

This commit is contained in:
cinap_lenrek 2017-06-02 19:03:37 +02:00
parent ea413b4a62
commit 178e05f9b7

View file

@ -133,8 +133,8 @@ void main(int, char**)
i = 0; i = 0;
while ((buf = Brdline(fp, '\n')) != nil) { while ((buf = Brdline(fp, '\n')) != nil) {
buf[Blinelen(fp)-1] = '\0'; buf[Blinelen(fp)-1] = '\0';
tokenize(buf, toks, 3); if (tokenize(buf, toks, 3) != 3
if (toks[0] == nil || strcmp("#define", toks[0]) != 0) /* not a valid #define */ || strcmp("#define", toks[0]) != 0) /* not a valid #define */
continue; continue;
tok = strtol(toks[2], nil, 10); tok = strtol(toks[2], nil, 10);
if (tok < FIRSTTOKEN || tok > LASTTOKEN) { if (tok < FIRSTTOKEN || tok > LASTTOKEN) {