/* COPYRIGHT (C) 1987 Kamal Al-Yahya */ /* tr2tex: troff to tex translator */ /* Author: Kamal Al-Yahya, Stanford University, 9/4/86 */ /* Last modified: 1/1/87 */ /* Keyword: convert translate tex troff */ char *documentation[] = { " SYNTAX", " tr2tex [-m] file1 file2 ...", "or", " tr2tex [-m] < file1 file2 ...", "", " Use the -m flag for manual", "", }; int doclength = { sizeof documentation/sizeof documentation[0] }; #include "setups.h" FILE *out_file; #if HAVE_SGTTY struct sgttyb ttystat; #endif int man; int xargc; char **xargv; int main(int argc, char *argv[]) { char *inbuf, *outbuf; FILE *temp,*scr; register char *cptr; int piped_in; int i; long timeval; /* clock value from time() for ctime() */ char *document = "article"; /* document type */ char *options = "[troffms,11pt]"; /* style options */ /* Allocate large arrays dynamically to conserve stack space */ if (((inbuf = (char *)malloc(MAXLEN*sizeof(char))) == (char *)NULL) || ((outbuf = (char *)malloc(MAXLEN*sizeof(char))) == (char *)NULL)) { fprintf(stderr,"tr2tex: Cannot malloc() internal buffer space\nNeed two arrays of %d characters each\n",MAXLEN); exit(-1); } /* If no arguments, and not in a pipeline, self document */ #if HAVE_SGTTY piped_in = ioctl ((fileno (stdin)), TIOCGETP, &ttystat); #else /* if no sggty, it cannot distinguish piped input from no input */ piped_in = (argc == 1); #endif if (argc == 1 && !piped_in) { for( i=0; i