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

Defined functions

backrest defined in line 84; used 2 times
getcomm defined in line 25; used 1 times

Defined variables

options defined in line 3; used 2 times

Defined struct's

optstr defined in line 3; used 2 times
  • in line 28(2)
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 779
Valid CSS Valid XHTML 1.0 Strict