1: #ifndef lint
   2: static char sccsid[] = "@(#)t1.c	4.2 8/11/83";
   3: #endif
   4: 
   5:  /* t1.c: main control and input switching */
   6: #
   7: # include "t..c"
   8: #include <signal.h>
   9: # ifdef gcos
  10: /* required by GCOS because file is passed to "tbl" by troff preprocessor */
  11: # define _f1 _f
  12: extern FILE *_f[];
  13: # endif
  14: 
  15: # ifdef unix
  16: # define MACROS "/usr/lib/tmac.s"
  17: # define PYMACS "/usr/lib/tmac.m"
  18: # endif
  19: 
  20: # ifdef gcos
  21: # define MACROS "cc/troff/smac"
  22: # define PYMACS "cc/troff/mmac"
  23: # endif
  24: 
  25: # define ever (;;)
  26: 
  27: main(argc,argv)
  28:     char *argv[];
  29: {
  30: # ifdef unix
  31: int badsig();
  32: signal(SIGPIPE, badsig);
  33: # endif
  34: # ifdef gcos
  35: if(!intss()) tabout = fopen("qq", "w"); /* default media code is type 5 */
  36: # endif
  37: exit(tbl(argc,argv));
  38: }
  39: 
  40: 
  41: tbl(argc,argv)
  42:     char *argv[];
  43: {
  44: char line[BUFSIZ];
  45: /* required by GCOS because "stdout" is set by troff preprocessor */
  46: tabin=stdin; tabout=stdout;
  47: setinp(argc,argv);
  48: while (gets1(line))
  49:     {
  50:     fprintf(tabout, "%s\n",line);
  51:     if (prefix(".TS", line))
  52:         tableput();
  53:     }
  54: fclose(tabin);
  55: return(0);
  56: }
  57: int sargc;
  58: char **sargv;
  59: setinp(argc,argv)
  60:     char **argv;
  61: {
  62:     sargc = argc;
  63:     sargv = argv;
  64:     sargc--; sargv++;
  65:     if (sargc>0)
  66:         swapin();
  67: }
  68: swapin()
  69: {
  70:     while (sargc>0 && **sargv=='-') /* Mem fault if no test on sargc */
  71:         {
  72:         if (sargc<=0) return(0);
  73:         if (match("-ms", *sargv))
  74:             {
  75:             *sargv = MACROS;
  76:             break;
  77:             }
  78:         if (match("-mm", *sargv))
  79:             {
  80:             *sargv = PYMACS;
  81:             break;
  82:             }
  83:         if (match("-TX", *sargv))
  84:             pr1403=1;
  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:     tabin = fopen(ifile= *sargv, "r");
  93:     iline=1;
  94: # ifdef unix
  95: /* file names are all put into f. by the GCOS troff preprocessor */
  96:     fprintf(tabout, ".ds f. %s\n",ifile);
  97: # endif
  98:     if (tabin==NULL)
  99:         error("Can't open file");
 100:     sargc--;
 101:     sargv++;
 102:     return(1);
 103: }
 104: # ifdef unix
 105: badsig()
 106: {
 107: signal(SIGPIPE, SIG_IGN);
 108:  exit(0);
 109: }
 110: # endif

Defined functions

badsig defined in line 105; used 2 times
main defined in line 27; never used
setinp defined in line 59; used 1 times
  • in line 47
swapin defined in line 68; used 3 times
tbl defined in line 41; used 1 times
  • in line 37

Defined variables

sargc defined in line 57; used 8 times
sargv defined in line 58; used 11 times
sccsid defined in line 2; never used

Defined macros

MACROS defined in line 21; used 1 times
  • in line 75
PYMACS defined in line 22; used 1 times
  • in line 80
_f1 defined in line 11; never used
ever defined in line 25; never used
Last modified: 1983-08-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 998
Valid CSS Valid XHTML 1.0 Strict