Make lex safer for 8-bit data. [rsc] --rw-rw-r-- M 1487869 glenda sys 4074 Jan 29 11:18 sys/src/cmd/lex/ncform /n/sourcesdump/2006/0129/plan9/sys/src/cmd/lex/ncform:9,15 - /n/sourcesdump/2006/0130/plan9/sys/src/cmd/lex/ncform:9,15 extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; # ifdef LEXDEBUG - extern void allprint(char); + extern void allprint(int); # endif yylook(void){ struct yysvf *yystate, **lsp; /n/sourcesdump/2006/0129/plan9/sys/src/cmd/lex/ncform:113,119 - /n/sourcesdump/2006/0130/plan9/sys/src/cmd/lex/ncform:113,119 } # ifdef LEXDEBUG if(debug){ - fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); + fprintf(yyout,"stopped at %d with ",lsp>yylstate?*(lsp-1)-yysvec-1:0); allprint(yych); putchar('\n'); } [rsc] --rw-rw-r-- M 1487869 glenda sys 10162 Jan 29 11:18 sys/src/cmd/lex/sub1.c /n/sourcesdump/2006/0129/plan9/sys/src/cmd/lex/sub1.c:462,467 - /n/sourcesdump/2006/0130/plan9/sys/src/cmd/lex/sub1.c:462,469 void allprint(int c) { + if(c < 0) + c += 256; /* signed char */ switch(c){ case 014: print("\\f");