|
|
1.1 ! root 1: /* t1.c: main control and input switching */ ! 2: # ! 3: # include "t..c" ! 4: #include <signal.h> ! 5: # ifdef gcos ! 6: /* required by GCOS because file is passed to "tbl" by troff preprocessor */ ! 7: # define _f1 _f ! 8: extern FILE *_f[]; ! 9: # endif ! 10: ! 11: # ifdef unix ! 12: # define MACROS "/usr/lib/tmac.s" ! 13: # define PYMACS "/usr/lib/tmac.m" ! 14: # endif ! 15: ! 16: # ifdef gcos ! 17: # define MACROS "cc/troff/smac" ! 18: # define PYMACS "cc/troff/mmac" ! 19: # endif ! 20: ! 21: # define ever (;;) ! 22: ! 23: main(argc,argv) ! 24: char *argv[]; ! 25: { ! 26: # ifdef unix ! 27: int badsig(); ! 28: signal(SIGPIPE, badsig); ! 29: # endif ! 30: # ifdef gcos ! 31: if(!intss()) tabout = fopen("qq", "w"); /* default media code is type 5 */ ! 32: # endif ! 33: exit(tbl(argc,argv)); ! 34: } ! 35: ! 36: ! 37: tbl(argc,argv) ! 38: char *argv[]; ! 39: { ! 40: char line[512]; ! 41: /*int x;*/ ! 42: /*x=malloc((char *)0); uncomment when allocation breaks*/ ! 43: /* required by GCOS because "stdout" is set by troff preprocessor */ ! 44: tabin=stdin; tabout=stdout; ! 45: setinp(argc,argv); ! 46: while (gets1(line)) ! 47: { ! 48: fprintf(tabout, "%s\n",line); ! 49: if (prefix(".TS", line)) ! 50: tableput(); ! 51: } ! 52: fclose(tabin); ! 53: return(0); ! 54: } ! 55: int sargc; ! 56: char **sargv; ! 57: setinp(argc,argv) ! 58: char **argv; ! 59: { ! 60: sargc = argc; ! 61: sargv = argv; ! 62: sargc--; sargv++; ! 63: if (sargc>0) ! 64: swapin(); ! 65: } ! 66: swapin() ! 67: { ! 68: char *name; ! 69: while (sargc>0 && **sargv=='-') ! 70: { ! 71: if (match("-ms", *sargv)) ! 72: { ! 73: *sargv = MACROS; ! 74: break; ! 75: } ! 76: if (match("-mm", *sargv)) ! 77: { ! 78: *sargv = PYMACS; ! 79: break; ! 80: } ! 81: if (match("-TX", *sargv)) ! 82: pr1403=1; ! 83: if (match("-", *sargv)) ! 84: break; ! 85: sargc--; sargv++; ! 86: } ! 87: if (sargc<=0) return(0); ! 88: # ifdef unix ! 89: /* file closing is done by GCOS troff preprocessor */ ! 90: if (tabin!=stdin) fclose(tabin); ! 91: # endif ! 92: if (match(*sargv, "-")){ ! 93: tabin=stdin; ! 94: name = "-"; ! 95: } ! 96: else{ ! 97: tabin = fopen(ifile= *sargv, "r"); ! 98: name = ifile; ! 99: } ! 100: iline=1; ! 101: # ifdef unix ! 102: /* file names are all put into f. by the GCOS troff preprocessor */ ! 103: fprintf(tabout, ".ds f. %s\n",ifile); ! 104: fprintf(tabout, ".lf %d %s\n",iline, name); ! 105: # endif ! 106: if (tabin==NULL) ! 107: error("Can't open file"); ! 108: sargc--; ! 109: sargv++; ! 110: return(1); ! 111: } ! 112: # ifdef unix ! 113: badsig() ! 114: { ! 115: signal(SIGPIPE, 1); ! 116: exit(0); ! 117: } ! 118: # endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.