/* $Id: std_lex.mc,v 8.8 2012/09/12 19:03:16 ksb Exp $ * the idea for this module was from Allen Braunsdorf at Purdue (ksb) */ %static char **%K1ev%; /* follow the list idea of which file to read (ksb) */ int yywrap() { register char *pcGot; extern FILE *yyin; if (stdin == yyin) { clearerr(stdin); } else if ((FILE *)0 != yyin) { fclose(yyin); } yyin = (FILE *)0; % if ((char **)0 == %K1ev || (char *)0 == *%K1ev) %{ return 1; } % pcGot = *%K1ev++%; if ('-' == pcGot[0] && '\000' == pcGot[1]) { yyin = stdin; % %H/stdin/H/pcGot/K/e return 0; } if ((FILE *)0 != (yyin = fopen(pcGot, "r"))) { % %H/yyin/H/pcGot/K/e return 0; } % fprintf(stderr, "%%s: fopen: %%s: %%s\n", %b, pcGot, %E)%; return yywrap(); /* tail recursion is free! */ } /* setup the list of files to read (ksb) */ void %%K1ev(argc, argv) int argc; char **argv; { if (0 == argc) { static char *apcArgv[] = { % %Ks/el, (char *)0 }; % %K1ev = apcArgv%; } else { % %K1ev = argv%; } }