/* 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" #ifdef tops20 #define TEMPFILE "texXXXXXX" #else #ifndef AMIGA #define TEMPFILE "/tmp/texXXXXXX" #endif #endif #ifdef AMIGA #include #include #define TEMPFILE "t:texXXXXXX" #endif FILE *out_file; #ifdef MSC #include #else #ifndef AMIGA struct sgttyb ttystat; #endif #endif extern char *mktemp(); char scratch_file[MAXWORD]; int man; int xargc; char **xargv; main(argc,argv) 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\n\ Need two arrays of %d characters each\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 #ifndef AMIGA piped_in = ioctl ((fileno (stdin)), TIOCGETP, &ttystat); #else piped_in = 0; #endif #endif if (argc == 1 && !piped_in) for( i=0; i