|
|
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: /* required by GCOS because "stdout" is set by troff preprocessor */ ! 42: tabin=stdin; tabout=stdout; ! 43: setinp(argc,argv); ! 44: while (gets1(line)) ! 45: { ! 46: fprintf(tabout, "%s\n",line); ! 47: if (prefix(".TS", line)) ! 48: tableput(); ! 49: } ! 50: fclose(tabin); ! 51: return(0); ! 52: } ! 53: int sargc; ! 54: char **sargv; ! 55: setinp(argc,argv) ! 56: char **argv; ! 57: { ! 58: sargc = argc; ! 59: sargv = argv; ! 60: sargc--; sargv++; ! 61: if (sargc>0) ! 62: swapin(); ! 63: } ! 64: swapin() ! 65: { ! 66: char *name; ! 67: while (sargc>0 && **sargv=='-') ! 68: { ! 69: if (match("-ms", *sargv)) ! 70: { ! 71: *sargv = MACROS; ! 72: break; ! 73: } ! 74: if (match("-mm", *sargv)) ! 75: { ! 76: *sargv = PYMACS; ! 77: break; ! 78: } ! 79: if (match("-TX", *sargv)) ! 80: pr1403=1; ! 81: if (match("-", *sargv)) ! 82: break; ! 83: sargc--; sargv++; ! 84: } ! 85: if (sargc<=0) return(0); ! 86: # ifdef unix ! 87: /* file closing is done by GCOS troff preprocessor */ ! 88: if (tabin!=stdin) fclose(tabin); ! 89: # endif ! 90: if (match(*sargv, "-")){ ! 91: tabin=stdin; ! 92: name = "-"; ! 93: } ! 94: else{ ! 95: tabin = fopen(ifile= *sargv, "r"); ! 96: name = ifile; ! 97: } ! 98: iline=1; ! 99: # ifdef unix ! 100: /* file names are all put into f. by the GCOS troff preprocessor */ ! 101: fprintf(tabout, ".ds f. %s\n",ifile); ! 102: fprintf(tabout, ".lf %d %s\n",iline, name); ! 103: # endif ! 104: if (tabin==NULL) ! 105: error("Can't open file"); ! 106: sargc--; ! 107: sargv++; ! 108: return(1); ! 109: } ! 110: # ifdef unix ! 111: badsig() ! 112: { ! 113: signal(SIGPIPE, 1); ! 114: exit(0); ! 115: } ! 116: # endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.