/* tex.c * last revised at 15, Oct. 1995 * * TeX input * Copyright (C) 1995, All rights reserved. * written by Gyudong Kim(chilly@iclab.snu.ac.kr) * */ #include "findhier.h" static char buf[BUFSIZE]; static void look_for_bs(tex) FILE *tex; { register int c; while ((c = fgetc(tex))!=EOF) { switch (c) { case '%': seek_char('\n',tex); break; case '\\': return; default: continue; } } return; } static int skip_blank(tex) FILE *tex; { register int c; while((c=fgetc(tex))!=EOF) { switch (c) { case ' ': case '\t': case '\n': continue; case '%': seek_char('\n',tex); break; default: return(c); } } return(EOF); } static char *token(tex) FILE *tex; { register int c,i; i = 0; c = skip_blank(tex); switch (c) { case EOF: return((char *)NULL); case '{': c = skip_blank(tex); default: do { if (isspace(c) || i>=BUFSIZE-1 || c=='{' || c=='}' || c=='\\') { break; } buf[i]=c; i++; c = fgetc(tex); } while (c!=EOF); break; } buf[i]=0; return(buf); } static char *texgets(str,len,file) char *str; int len; FILE *file; { int i=0; int c; while(i