/* COPYRIGHT (C) 1987 Kamal Al-Yahya */ /* * texmatch: checks matching parantheses, braces, brackets, and dollar signs * in TeX documents. */ char *documentation[] = { " SYNTAX", " texmatch [-i] [parameters] [inputfiles]", "", " flags:", " -i ignores TeX's and LaTeX's \input and \include commands", "", " parameters:", " in=filename filename is the input file", " (Default: in=stdin)", "" }; /* Author: Kamal Al-Yahya, Stanford University, 11/1/83 */ /* Last modified: 1/25/87 */ int doclength = { sizeof documentation/sizeof documentation[0] }; #include "setups.h" char string[MAXWORD], filename[MAXWORD]; struct sgttyb ttystat; extern char *strcpy(), *mktemp(); char scratch_file[MAXWORD]; int wflag=0; /* for consistency with other programs */ int xargc; char **xargv; main(argc,argv) int argc; char *argv[]; { char *buf; FILE *temp,*scr; register char *cptr; int piped_in; int i,iflag; if (((buf = (char *)malloc(MAXLEN*sizeof(char))) == (char *)NULL)) { fprintf(stderr,"texmatch: Cannot malloc() internal buffer space\n\ Need two arrays of %d characters each\n",MAXLEN); exit(-1); } /* If no arguments, and not in a pipeline, self document */ piped_in = ioctl ((fileno (stdin)), TIOCGETP, &ttystat); if (argc == 1 && !piped_in) { for( i=0; i