1: #ifndef lint
   2: static char sccsid[] = "@(#)t3.c	4.2 8/11/83";
   3: #endif
   4: 
   5:  /* t3.c: interpret commands affecting whole table */
   6: # include "t..c"
   7: struct optstr {char *optnam; int *optadd;} options [] = {
   8:     "expand", &expflg,
   9:     "EXPAND", &expflg,
  10:     "center", &ctrflg,
  11:     "CENTER", &ctrflg,
  12:     "box", &boxflg,
  13:     "BOX", &boxflg,
  14:     "allbox", &allflg,
  15:     "ALLBOX", &allflg,
  16:     "doublebox", &dboxflg,
  17:     "DOUBLEBOX", &dboxflg,
  18:     "frame", &boxflg,
  19:     "FRAME", &boxflg,
  20:     "doubleframe", &dboxflg,
  21:     "DOUBLEFRAME", &dboxflg,
  22:     "tab", &tab,
  23:     "TAB", &tab,
  24:     "linesize", &linsize,
  25:     "LINESIZE", &linsize,
  26:     "delim", &delim1,
  27:     "DELIM", &delim1,
  28:     0,0};
  29: getcomm()
  30: {
  31: char line[200], *cp, nb[25], *t;
  32: struct optstr *lp;
  33: int c, ci, found;
  34: for(lp= options; lp->optnam; lp++)
  35:     *(lp->optadd) = 0;
  36: texname = texstr[texct=0];
  37: tab = '\t';
  38: printf(".nr %d \\n(.s\n", LSIZE);
  39: gets1(line);
  40: /* see if this is a command line */
  41: if (index(line,';') == NULL)
  42:     {
  43:     backrest(line);
  44:     return;
  45:     }
  46: for(cp=line; (c = *cp) != ';'; cp++)
  47:     {
  48:     if (!letter(c)) continue;
  49:     found=0;
  50:     for(lp= options; lp->optadd; lp++)
  51:         {
  52:         if (prefix(lp->optnam, cp))
  53:             {
  54:             *(lp->optadd) = 1;
  55:             cp += strlen(lp->optnam);
  56:             if (letter(*cp))
  57:                 error("Misspelled global option");
  58:             while (*cp==' ')cp++;
  59:             t=nb;
  60:             if ( *cp == '(')
  61:                 while ((ci= *++cp) != ')')
  62:                     *t++ = ci;
  63:             else cp--;
  64:             *t++ = 0; *t=0;
  65:             if (lp->optadd == &tab)
  66:                 {
  67:                 if (nb[0])
  68:                     *(lp->optadd) = nb[0];
  69:                 }
  70:             if (lp->optadd == &linsize)
  71:                 printf(".nr %d %s\n", LSIZE, nb);
  72:             if (lp->optadd == &delim1)
  73:                 {
  74:                 delim1 = nb[0];
  75:                 delim2 = nb[1];
  76:                 }
  77:             found=1;
  78:             break;
  79:             }
  80:         }
  81:     if (!found)
  82:         error("Illegal option");
  83:     }
  84: cp++;
  85: backrest(cp);
  86: return;
  87: }
  88: backrest(cp)
  89:     char *cp;
  90: {
  91: char *s;
  92: for(s=cp; *s; s++);
  93: un1getc('\n');
  94: while (s>cp)
  95:     un1getc(*--s);
  96: return;
  97: }

Defined functions

backrest defined in line 88; used 2 times
getcomm defined in line 29; used 1 times

Defined variables

options defined in line 7; used 2 times
sccsid defined in line 2; never used

Defined struct's

optstr defined in line 7; used 2 times
  • in line 32(2)
Last modified: 1983-08-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1024
Valid CSS Valid XHTML 1.0 Strict