/* COPYRIGHT (C) 1987 Kamal Al-Yahya */ /* detex: strips TeX's and LaTeX's commands */ char *documentation[] = { " SYNTAX", " detex [-iw] [parameters] [inputfiles]", "", " flags:", " -i ignores TeX's and LaTeX's \input and \include commands", " -w does not check matching", "", " parameters:", " in=filename filename is the input file", " (Default: in=stdin)", "", " out=filename filename is the output file", " (Default: out=stdout)", "" }; /* Author: Kamal Al-Yahya, Stanford University, 11/1/83 */ /* Last modified: 1/25/87 */ int doclength = { sizeof documentation/sizeof documentation[0] }; #include "setups.h" #ifdef tops20 #define TEMPFILE "texXXXXXX" #else #define TEMPFILE "/tmp/texXXXXXX" #endif char string[MAXWORD], filename[MAXWORD], scratch_file[MAXWORD]; FILE *out_file; extern char *mktemp(); #ifdef MSC #else struct sgttyb ttystat; #endif int wflag; int xargc; char **xargv; main(argc,argv) int argc; char *argv[]; { char *buf; FILE *temp,*scr; register char *cptr; int piped_in; int iflag,i; if (((buf = (char *)malloc(MAXLEN*sizeof(char))) == (char *)NULL)) { fprintf(stderr,"detex: Cannot malloc() internal buffer space\n\ Need an array of %d characters\n",MAXLEN); exit(-1); } /* If no arguments, and not in a pipeline, self document */ #ifdef MSC /* MS-DOS cannot distinguish piped input from no input */ piped_in = (argc == 1); #else piped_in = ioctl ((fileno (stdin)), TIOCGETP, &ttystat); #endif if (argc == 1 && !piped_in) { for( i=0; i