Remove building with NOCRYPTO option
[minix.git] / external / bsd / flex / dist / examples / manual / cat.lex
blob7890aa204fa8be2c45c4cf729c34fdee222eab8f
1 /*
2  * cat.lex: A demonstration of YY_NEW_FILE.
3  */
5 %{
6 #include <stdio.h>
8 char **names = NULL;
9 int  current = 1;
13 <<EOF>> {
14            current += 1;
15            if(names[current] != NULL){
16               yyin = fopen(names[current],"r");
17               if(yyin == NULL){
18                 fprintf(stderr,"cat: unable to open %s\n",
19                         names[current]);
20                 yyterminate();
21               }
22               YY_NEW_FILE;
23            } else {
24              yyterminate();
25            }
26         }
29 int main(int argc, char **argv)
31     if(argc < 2){
32        fprintf(stderr,"Usage: cat files....\n");
33        exit(1);
34     }
35     names = argv;
37     yyin = fopen(names[current],"r");
38     if(yyin == NULL){
39       fprintf(stderr,"cat: unable to open %s\n",
40               names[current]);
41       yyterminate();
42     }
44     yylex();