From: ceriel Date: Mon, 2 Mar 1987 16:40:14 +0000 (+0000) Subject: Be a bit more tolerant about line directives. X-Git-Tag: release-5-5~4541 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=70a459a112588ce1e885b4495d34133169465dcd;p=ack.git Be a bit more tolerant about line directives. --- diff --git a/util/ncgg/scan.l b/util/ncgg/scan.l index 11cff7567..eb66d30ad 100644 --- a/util/ncgg/scan.l +++ b/util/ncgg/scan.l @@ -22,10 +22,12 @@ extern char *filename; if (c=='\n') lineno++; } while (c!='/'); } -^\#[ \t]+[0-9]+[ \t]+\".*\"$ { +^\#(line)?[ \t]*[0-9]+[ \t]+\".*\".*$ { int ind,ind2; - lineno=atoi(yytext+1)-1; - for(ind=0;yytext[ind]!='"';ind++) + for (ind=0; yytext[ind] < '0' || yytext[ind]>'9'; ind++) + ; + lineno=atoi(&yytext[ind])-1; + for(;yytext[ind]!='"';ind++) ; for(ind2=ind+1;yytext[ind2]!='"';ind2++) ;