%{ #include #include #include /* * text2html: 1:1 translation of newlines, '<' '&' '>' + header/footer * * to compile, simply "make text2html" */ char *title; int yywrap(){ struct timeval tp; struct timezone tzp; char tbuf[100]; gettimeofday(&tp,&tzp); strftime(tbuf,100,"%B %e, %Y",localtime(& tp.tv_sec)); printf( "\n
This page was generated on %s by \ text2html.
\ Bug reports and comments to : \ mfx@cs.tu.berlin.de.\n \n\n",tbuf); return 1; } int main(argc, argv) int argc; char **argv; { title = (argc>1) ? argv[1] : "automatically generated"; yylex(); return 0; } %} %% printf("\n\n %s \n\n\n",title); \& {printf("&");} \< {printf("<");} \> {printf(">");} \n {printf("
\n");}