xref: /original-bsd/old/lex/libln/yyless.c (revision 50dd0bba)
1 /*	@(#)yyless.c	4.2	01/09/85	*/
2 
3 yyless(x)
4 {
5 extern char yytext[];
6 register char *lastch, *ptr;
7 extern int yyleng;
8 extern int yyprevious;
9 lastch = yytext+yyleng;
10 if (x>=0 && x <= yyleng)
11 	ptr = x + yytext;
12 else
13 	ptr = (char *) x;
14 while (lastch > ptr)
15 	yyunput(*--lastch);
16 *lastch = 0;
17 if (ptr >yytext)
18 	yyprevious = *--lastch;
19 yyleng = ptr-yytext;
20 }
21