From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- support/kamal/texexpand1.c | 153 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 support/kamal/texexpand1.c (limited to 'support/kamal/texexpand1.c') diff --git a/support/kamal/texexpand1.c b/support/kamal/texexpand1.c new file mode 100644 index 0000000000..8db44d932d --- /dev/null +++ b/support/kamal/texexpand1.c @@ -0,0 +1,153 @@ +/* COPYRIGHT (C) 1987 Kamal Al-Yahya */ +/* texexpand: to expand TeX and LaTeX \input and include files */ + +char *documentation[] = { +" SYNTAX", +" texexpand [-w] file1 [file2 .....]", +" or texexpand [-w] < file1 [file2 ....]", +"", +" Flags:", +" -w maching is not checked", +"", +"See the manual page for more details.", +"", +}; + +/* 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 + +#ifdef MSC +#else +struct sgttyb ttystat; +#endif + +extern char *mktemp(); +char scratch_file[MAXWORD]; + +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 i; + +if (((buf = (char *)malloc(MAXLEN*sizeof(char))) == (char *)NULL)) + { + fprintf(stderr,"texpand: 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