Annotation of researchv10no/cmd/troff/n5.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * troff5.c
                      3:  * 
                      4:  * misc processing requests
                      5:  */
                      6: 
                      7: #include "tdef.h"
                      8: #include "fns.h"
                      9: #include "ext.h"
                     10: 
                     11: int    iflist[NIF];
                     12: int    ifx;
                     13: 
                     14: void casead(void)
                     15: {
                     16:        int i;
                     17: 
                     18:        ad = 1;
                     19:        /* leave admod alone */
                     20:        if (skip())
                     21:                return;
                     22:        switch (i = cbits(getch())) {
                     23:        case 'r':       /* right adj, left ragged */
                     24:                admod = 2;
                     25:                break;
                     26:        case 'l':       /* left adj, right ragged */
                     27:                admod = ad = 0; /* same as casena */
                     28:                break;
                     29:        case 'c':       /*centered adj*/
                     30:                admod = 1;
                     31:                break;
                     32:        case 'b': 
                     33:        case 'n':
                     34:                admod = 0;
                     35:                break;
                     36:        case '0': 
                     37:        case '2': 
                     38:        case '4':
                     39:                ad = 0;
                     40:        case '1': 
                     41:        case '3': 
                     42:        case '5':
                     43:                admod = (i - '0') / 2;
                     44:        }
                     45: }
                     46: 
                     47: 
                     48: void casena(void)
                     49: {
                     50:        ad = 0;
                     51: }
                     52: 
                     53: 
                     54: void casefi(void)
                     55: {
                     56:        tbreak();
                     57:        fi = 1;
                     58:        pendnf = 0;
                     59:        lnsize = LNSIZE;
                     60: }
                     61: 
                     62: 
                     63: void casenf(void)
                     64: {
                     65:        tbreak();
                     66:        fi = 0;
                     67: }
                     68: 
                     69: 
                     70: void casers(void)
                     71: {
                     72:        dip->nls = 0;
                     73: }
                     74: 
                     75: 
                     76: void casens(void)
                     77: {
                     78:        dip->nls++;
                     79: }
                     80: 
                     81: 
                     82: chget(int c)
                     83: {
                     84:        Tchar i;
                     85: 
                     86:        if (skip() || ismot(i = getch()) || cbits(i) == ' ' || cbits(i) == '\n') {
                     87:                ch = i;
                     88:                return(c);
                     89:        } else 
                     90:                return cbits(i);        /* was (i & BYTEMASK) */
                     91: }
                     92: 
                     93: 
                     94: void casecc(void)
                     95: {
                     96:        cc = chget('.');
                     97: }
                     98: 
                     99: 
                    100: void casec2(void)
                    101: {
                    102:        c2 = chget('\'');
                    103: }
                    104: 
                    105: 
                    106: void casehc(void)
                    107: {
                    108:        ohc = chget(OHC);
                    109: }
                    110: 
                    111: 
                    112: void casetc(void)
                    113: {
                    114:        tabc = chget(0);
                    115: }
                    116: 
                    117: 
                    118: void caselc(void)
                    119: {
                    120:        dotc = chget(0);
                    121: }
                    122: 
                    123: 
                    124: void casehy(void)
                    125: {
                    126:        int i;
                    127: 
                    128:        hyf = 1;
                    129:        if (skip())
                    130:                return;
                    131:        noscale++;
                    132:        i = atoi0();
                    133:        noscale = 0;
                    134:        if (nonumb)
                    135:                return;
                    136:        hyf = max(i, 0);
                    137: }
                    138: 
                    139: 
                    140: void casenh(void)
                    141: {
                    142:        hyf = 0;
                    143: }
                    144: 
                    145: 
                    146: max(int aa, int bb)
                    147: {
                    148:        if (aa > bb)
                    149:                return(aa);
                    150:        else 
                    151:                return(bb);
                    152: }
                    153: 
                    154: 
                    155: void casece(void)
                    156: {
                    157:        int i;
                    158: 
                    159:        noscale++;
                    160:        skip();
                    161:        i = max(atoi0(), 0);
                    162:        if (nonumb)
                    163:                i = 1;
                    164:        tbreak();
                    165:        ce = i;
                    166:        noscale = 0;
                    167: }
                    168: 
                    169: 
                    170: void casein(void)
                    171: {
                    172:        int i;
                    173: 
                    174:        if (skip())
                    175:                i = in1;
                    176:        else 
                    177:                i = max(hnumb(&in), 0);
                    178:        tbreak();
                    179:        in1 = in;
                    180:        in = i;
                    181:        if (!nc) {
                    182:                un = in;
                    183:                setnel();
                    184:        }
                    185: }
                    186: 
                    187: 
                    188: void casell(void)
                    189: {
                    190:        int i;
                    191: 
                    192:        if (skip())
                    193:                i = ll1;
                    194:        else 
                    195:                i = max(hnumb(&ll), INCH / 10);
                    196:        ll1 = ll;
                    197:        ll = i;
                    198:        setnel();
                    199: }
                    200: 
                    201: 
                    202: void caselt(void)
                    203: {
                    204:        int i;
                    205: 
                    206:        if (skip())
                    207:                i = lt1;
                    208:        else 
                    209:                i = max(hnumb(&lt), 0);
                    210:        lt1 = lt;
                    211:        lt = i;
                    212: }
                    213: 
                    214: 
                    215: void caseti(void)
                    216: {
                    217:        int i;
                    218: 
                    219:        if (skip())
                    220:                return;
                    221:        i = max(hnumb(&in), 0);
                    222:        tbreak();
                    223:        un1 = i;
                    224:        setnel();
                    225: }
                    226: 
                    227: 
                    228: void casels(void)
                    229: {
                    230:        int i;
                    231: 
                    232:        noscale++;
                    233:        if (skip())
                    234:                i = ls1;
                    235:        else 
                    236:                i = max(inumb(&ls), 1);
                    237:        ls1 = ls;
                    238:        ls = i;
                    239:        noscale = 0;
                    240: }
                    241: 
                    242: 
                    243: void casepo(void)
                    244: {
                    245:        int i;
                    246: 
                    247:        if (skip())
                    248:                i = po1;
                    249:        else {
                    250:                i = max(hnumb(&po), 0);
                    251:                if (nonumb)
                    252:                        i = po1;
                    253:        }
                    254:        po1 = po;
                    255:        po = i;
                    256:        if (TROFF & !ascii)
                    257:                esc += po - po1;
                    258: }
                    259: 
                    260: 
                    261: void casepl(void)
                    262: {
                    263:        int i;
                    264: 
                    265:        skip();
                    266:        if ((i = vnumb(&pl)) == 0)
                    267:                pl = 11 * INCH; /*11in*/
                    268:        else 
                    269:                pl = i;
                    270:        if (numtab[NL].val > pl)
                    271:                numtab[NL].val = pl;
                    272: }
                    273: 
                    274: 
                    275: void casewh(void)
                    276: {
                    277:        int i, j, k;
                    278: 
                    279:        lgf++;
                    280:        skip();
                    281:        i = vnumb((int *)0);
                    282:        if (nonumb)
                    283:                return;
                    284:        skip();
                    285:        j = getrq();
                    286:        if ((k = findn(i)) != NTRAP) {
                    287:                mlist[k] = j;
                    288:                return;
                    289:        }
                    290:        for (k = 0; k < NTRAP; k++)
                    291:                if (mlist[k] == 0)
                    292:                        break;
                    293:        if (k == NTRAP) {
                    294:                flusho();
                    295:                ERROR "cannot plant trap." WARN;
                    296:                return;
                    297:        }
                    298:        mlist[k] = j;
                    299:        nlist[k] = i;
                    300: }
                    301: 
                    302: 
                    303: void casech(void)
                    304: {
                    305:        int i, j, k;
                    306: 
                    307:        lgf++;
                    308:        skip();
                    309:        if (!(j = getrq()))
                    310:                return;
                    311:        else 
                    312:                for (k = 0; k < NTRAP; k++)
                    313:                        if (mlist[k] == j)
                    314:                                break;
                    315:        if (k == NTRAP)
                    316:                return;
                    317:        skip();
                    318:        i = vnumb((int *)0);
                    319:        if (nonumb)
                    320:                mlist[k] = 0;
                    321:        nlist[k] = i;
                    322: }
                    323: 
                    324: 
                    325: findn(int i)
                    326: {
                    327:        int k;
                    328: 
                    329:        for (k = 0; k < NTRAP; k++)
                    330:                if ((nlist[k] == i) && (mlist[k] != 0))
                    331:                        break;
                    332:        return(k);
                    333: }
                    334: 
                    335: 
                    336: void casepn(void)
                    337: {
                    338:        int i;
                    339: 
                    340:        skip();
                    341:        noscale++;
                    342:        i = max(inumb(&numtab[PN].val), 0);
                    343:        noscale = 0;
                    344:        if (!nonumb) {
                    345:                npn = i;
                    346:                npnflg++;
                    347:        }
                    348: }
                    349: 
                    350: 
                    351: void casebp(void)
                    352: {
                    353:        int i;
                    354:        Stack *savframe;
                    355: 
                    356:        if (dip != d)
                    357:                return;
                    358:        savframe = frame;
                    359:        skip();
                    360:        if ((i = inumb(&numtab[PN].val)) < 0)
                    361:                i = 0;
                    362:        tbreak();
                    363:        if (!nonumb) {
                    364:                npn = i;
                    365:                npnflg++;
                    366:        } else if (dip->nls)
                    367:                return;
                    368:        eject(savframe);
                    369: }
                    370: 
                    371: void casetm(void)
                    372: {
                    373:        casetm1(0);
                    374: }
                    375: 
                    376: void casetm1(int ab) 
                    377: {
                    378:        int i, j, c;
                    379:        char *p;
                    380:        char tmbuf[NTM];
                    381: 
                    382:        lgf++;
                    383:        copyf++;
                    384:        if (skip() && ab)
                    385:                ERROR "User Abort" WARN;
                    386:        for (i = 0; i < NTM - 2; ) {
                    387:                if ((c = cbits(getch())) == '\n' || c == RIGHT)
                    388:                        break;
                    389:                else if (c == MINUS) {  /* special pleading for strange encodings */
                    390:                        tmbuf[i++] = '\\';
                    391:                        tmbuf[i++] = '-';
                    392:                } else if (c == PRESC) {
                    393:                        tmbuf[i++] = '\\';
                    394:                        tmbuf[i++] = 'e';
                    395:                } else if (c == FILLER) {
                    396:                        tmbuf[i++] = '\\';
                    397:                        tmbuf[i++] = '&';
                    398:                } else if (c == UNPAD) {
                    399:                        tmbuf[i++] = '\\';
                    400:                        tmbuf[i++] = ' ';
                    401:                } else if (c == OHC) {
                    402:                        tmbuf[i++] = '\\';
                    403:                        tmbuf[i++] = '%';
                    404:                } else if (c >= ALPHABET && c < nchnames + ALPHABET) {  /* \N DOESN'T WORK YET */
                    405:                        p = chname(c);
                    406:                        if ((j = strlen(p)) == 2)
                    407:                                sprintf(&tmbuf[i], "\\(%s", p);
                    408:                        else {
                    409:                                sprintf(&tmbuf[i], "\\C'%s'", p);
                    410:                                j += 2;
                    411:                        }
                    412:                        i += j + 2;
                    413:                } else
                    414:                        tmbuf[i++] = c;
                    415:        }
                    416:        tmbuf[i] = 0;
                    417:        if (ab) /* truncate output */
                    418:                obufp = obuf;   /* should be a function in n2.c */
                    419:        flusho();
                    420:        fprintf(stderr, "%s\n", tmbuf);
                    421:        copyf--;
                    422:        lgf--;
                    423: }
                    424: 
                    425: 
                    426: void casesp(void)
                    427: {
                    428:        casesp1(0);
                    429: }
                    430: 
                    431: void casesp1(int a)
                    432: {
                    433:        int i, j, savlss;
                    434: 
                    435:        tbreak();
                    436:        if (dip->nls || trap)
                    437:                return;
                    438:        i = findt1();
                    439:        if (!a) {
                    440:                skip();
                    441:                j = vnumb((int *)0);
                    442:                if (nonumb)
                    443:                        j = lss;
                    444:        } else 
                    445:                j = a;
                    446:        if (j == 0)
                    447:                return;
                    448:        if (i < j)
                    449:                j = i;
                    450:        savlss = lss;
                    451:        if (dip != d)
                    452:                i = dip->dnl; 
                    453:        else 
                    454:                i = numtab[NL].val;
                    455:        if ((i + j) < 0)
                    456:                j = -i;
                    457:        lss = j;
                    458:        newline(0);
                    459:        lss = savlss;
                    460: }
                    461: 
                    462: 
                    463: void casert(void)
                    464: {
                    465:        int a, *p;
                    466: 
                    467:        skip();
                    468:        if (dip != d)
                    469:                p = &dip->dnl; 
                    470:        else 
                    471:                p = &numtab[NL].val;
                    472:        a = vnumb(p);
                    473:        if (nonumb)
                    474:                a = dip->mkline;
                    475:        if ((a < 0) || (a >= *p))
                    476:                return;
                    477:        nb++;
                    478:        casesp1(a - *p);
                    479: }
                    480: 
                    481: 
                    482: void caseem(void)
                    483: {
                    484:        lgf++;
                    485:        skip();
                    486:        em = getrq();
                    487: }
                    488: 
                    489: 
                    490: void casefl(void)
                    491: {
                    492:        tbreak();
                    493:        if (!ascii)
                    494:                ptflush();
                    495:        flusho();
                    496: }
                    497: 
                    498: 
                    499: void caseev(void)
                    500: {
                    501:        int nxev;
                    502: 
                    503:        if (skip()) {
                    504: e0:
                    505:                if (evi == 0)
                    506:                        return;
                    507:                nxev =  evlist[--evi];
                    508:                goto e1;
                    509:        }
                    510:        noscale++;
                    511:        nxev = atoi0();
                    512:        noscale = 0;
                    513:        if (nonumb)
                    514:                goto e0;
                    515:        flushi();
                    516:        if (nxev >= NEV || nxev < 0 || evi >= EVLSZ) {
                    517:                flusho();
                    518:                ERROR "cannot do .ev %d", nxev WARN;
                    519:                if (error)
                    520:                        done2(040);
                    521:                else 
                    522:                        edone(040);
                    523:                return;
                    524:        }
                    525:        evlist[evi++] = ev;
                    526: e1:
                    527:        if (ev == nxev)
                    528:                return;
                    529:        ev = nxev;
                    530:        envp = &env[ev];
                    531: }
                    532: 
                    533: void envcopy(Env *e1, Env *e2) /* copy env e2 to e1 */
                    534: {
                    535:        *e1 = *e2;      /* rumor hath that this fails on some machines */
                    536: }
                    537: 
                    538: 
                    539: void caseel(void)
                    540: {
                    541:        if (--ifx < 0) {
                    542:                ifx = 0;
                    543:                iflist[0] = 0;
                    544:        }
                    545:        caseif1(2);
                    546: }
                    547: 
                    548: 
                    549: void caseie(void)
                    550: {
                    551:        if (ifx >= NIF) {
                    552:                ERROR "if-else overflow." WARN;
                    553:                ifx = 0;
                    554:                edone(040);
                    555:        }
                    556:        caseif1(1);
                    557:        ifx++;
                    558: }
                    559: 
                    560: 
                    561: void caseif(void)
                    562: {
                    563:        caseif1(0);
                    564: }
                    565: 
                    566: void caseif1(int x)
                    567: {
                    568:        extern int falsef;
                    569:        int notflag, true;
                    570:        Tchar i;
                    571: 
                    572:        if (x == 2) {
                    573:                notflag = 0;
                    574:                true = iflist[ifx];
                    575:                goto i1;
                    576:        }
                    577:        true = 0;
                    578:        skip();
                    579:        if ((cbits(i = getch())) == '!') {
                    580:                notflag = 1;
                    581:        } else {
                    582:                notflag = 0;
                    583:                ch = i;
                    584:        }
                    585:        i = atoi0();
                    586:        if (!nonumb) {
                    587:                if (i > 0)
                    588:                        true++;
                    589:                goto i1;
                    590:        }
                    591:        i = getch();
                    592:        switch (cbits(i)) {
                    593:        case 'e':
                    594:                if (!(numtab[PN].val & 01))
                    595:                        true++;
                    596:                break;
                    597:        case 'o':
                    598:                if (numtab[PN].val & 01)
                    599:                        true++;
                    600:                break;
                    601:        case 'n':
                    602:                if (NROFF)
                    603:                        true++;
                    604:                break;
                    605:        case 't':
                    606:                if (TROFF)
                    607:                        true++;
                    608:                break;
                    609:        case ' ':
                    610:                break;
                    611:        default:
                    612:                true = cmpstr(i);
                    613:        }
                    614: i1:
                    615:        true ^= notflag;
                    616:        if (x == 1)
                    617:                iflist[ifx] = !true;
                    618:        if (true) {
                    619: i2:
                    620:                while ((cbits(i = getch())) == ' ')
                    621:                        ;
                    622:                if (cbits(i) == LEFT)
                    623:                        goto i2;
                    624:                ch = i;
                    625:                nflush++;
                    626:        } else {
                    627:                copyf++;
                    628:                falsef++;
                    629:                eatblk(0);
                    630:                copyf--;
                    631:                falsef--;
                    632:        }
                    633: }
                    634: 
                    635: void eatblk(int inblk)
                    636: {
                    637:        int cnt, i;
                    638: 
                    639:        cnt = 0;
                    640:        do {
                    641:                if (ch) {
                    642:                        i = cbits(ch);
                    643:                        ch = 0;
                    644:                } else
                    645:                        i = cbits(getch0());
                    646:                if (i == ESC)
                    647:                        cnt++;
                    648:                else {
                    649:                        if (cnt == 1)
                    650:                                switch (i) {
                    651:                                case '{':  i = LEFT; break;
                    652:                                case '}':  i = RIGHT; break;
                    653:                                case '\n': i = 'x'; break;
                    654:                                }
                    655:                        cnt = 0;
                    656:                }
                    657:                if (i == LEFT) eatblk(1);
                    658:        } while ((!inblk && (i != '\n')) || (inblk && (i != RIGHT)));
                    659:        if (i == '\n')
                    660:                nlflg++;
                    661: }
                    662: 
                    663: 
                    664: cmpstr(Tchar c)
                    665: {
                    666:        int j, delim;
                    667:        Tchar i;
                    668:        int val;
                    669:        int savapts, savapts1, savfont, savfont1, savpts, savpts1;
                    670:        Tchar string[1280];
                    671:        Tchar *sp;
                    672: 
                    673:        if (ismot(c))
                    674:                return(0);
                    675:        delim = cbits(c);
                    676:        savapts = apts;
                    677:        savapts1 = apts1;
                    678:        savfont = font;
                    679:        savfont1 = font1;
                    680:        savpts = pts;
                    681:        savpts1 = pts1;
                    682:        sp = string;
                    683:        while ((j = cbits(i = getch()))!=delim && j!='\n' && sp<&string[1280-1])
                    684:                *sp++ = i;
                    685:        if (sp >= string + 1280) {
                    686:                ERROR "too-long string compare." WARN;
                    687:                edone(0100);
                    688:        }
                    689:        if (nlflg) {
                    690:                val = sp==string;
                    691:                goto rtn;
                    692:        }
                    693:        *sp = 0;
                    694:        apts = savapts;
                    695:        apts1 = savapts1;
                    696:        font = savfont;
                    697:        font1 = savfont1;
                    698:        pts = savpts;
                    699:        pts1 = savpts1;
                    700:        mchbits();
                    701:        val = 1;
                    702:        sp = string;
                    703:        while ((j = cbits(i = getch())) != delim && j != '\n') {
                    704:                if (*sp != i) {
                    705:                        eat(delim);
                    706:                        val = 0;
                    707:                        goto rtn;
                    708:                }
                    709:                sp++;
                    710:        }
                    711:        if (*sp)
                    712:                val = 0;
                    713: rtn:
                    714:        apts = savapts;
                    715:        apts1 = savapts1;
                    716:        font = savfont;
                    717:        font1 = savfont1;
                    718:        pts = savpts;
                    719:        pts1 = savpts1;
                    720:        mchbits();
                    721:        return(val);
                    722: }
                    723: 
                    724: 
                    725: void caserd(void)
                    726: {
                    727: 
                    728:        lgf++;
                    729:        skip();
                    730:        getname();
                    731:        if (!iflg) {
                    732:                if (quiet) {
                    733:                        if (NROFF) {
                    734:                                echo_off();
                    735:                                flusho();
                    736:                        }
                    737:                        fprintf(stderr, "\007"); /*bell*/
                    738:                } else {
                    739:                        if (nextf[0]) {
                    740:                                fprintf(stderr, "%s:", nextf);
                    741:                        } else {
                    742:                                fprintf(stderr, "\007"); /*bell*/
                    743:                        }
                    744:                }
                    745:        }
                    746:        collect();
                    747:        tty++;
                    748:        pushi(RD_OFFSET, PAIR('r','d'));
                    749: }
                    750: 
                    751: 
                    752: rdtty(void)
                    753: {
                    754:        char    onechar;
                    755: 
                    756:        onechar = 0;
                    757:        if (read(0, &onechar, 1) == 1) {
                    758:                if (onechar == '\n')
                    759:                        tty++;
                    760:                else 
                    761:                        tty = 1;
                    762:                if (tty != 3)
                    763:                        return(onechar);
                    764:        }
                    765:        tty = 0;
                    766:        if (NROFF && quiet)
                    767:                echo_on();
                    768:        return(0);
                    769: }
                    770: 
                    771: 
                    772: void caseec(void)
                    773: {
                    774:        eschar = chget('\\');
                    775: }
                    776: 
                    777: 
                    778: void caseeo(void)
                    779: {
                    780:        eschar = 0;
                    781: }
                    782: 
                    783: 
                    784: void caseta(void)
                    785: {
                    786:        int i;
                    787: 
                    788:        tabtab[0] = nonumb = 0;
                    789:        for (i = 0; ((i < (NTAB - 1)) && !nonumb); i++) {
                    790:                if (skip())
                    791:                        break;
                    792:                tabtab[i] = max(hnumb(&tabtab[max(i-1,0)]), 0) & TABMASK;
                    793:                if (!nonumb) 
                    794:                        switch (cbits(ch)) {
                    795:                        case 'C':
                    796:                                tabtab[i] |= CTAB;
                    797:                                break;
                    798:                        case 'R':
                    799:                                tabtab[i] |= RTAB;
                    800:                                break;
                    801:                        default: /*includes L*/
                    802:                                break;
                    803:                        }
                    804:                nonumb = ch = 0;
                    805:        }
                    806:        tabtab[i] = 0;
                    807: }
                    808: 
                    809: 
                    810: void casene(void)
                    811: {
                    812:        int i, j;
                    813: 
                    814:        skip();
                    815:        i = vnumb((int *)0);
                    816:        if (nonumb)
                    817:                i = lss;
                    818:        if (i > (j = findt1())) {
                    819:                i = lss;
                    820:                lss = j;
                    821:                dip->nls = 0;
                    822:                newline(0);
                    823:                lss = i;
                    824:        }
                    825: }
                    826: 
                    827: 
                    828: void casetr(void)
                    829: {
                    830:        int i, j;
                    831:        Tchar k;
                    832: 
                    833:        lgf++;
                    834:        skip();
                    835:        while ((i = cbits(k=getch())) != '\n') {
                    836:                if (ismot(k))
                    837:                        return;
                    838:                if (ismot(k = getch()))
                    839:                        return;
                    840:                if ((j = cbits(k)) == '\n')
                    841:                        j = ' ';
                    842:                trtab[i] = j;
                    843:        }
                    844: }
                    845: 
                    846: 
                    847: void casecu(void)
                    848: {
                    849:        cu++;
                    850:        caseul();
                    851: }
                    852: 
                    853: 
                    854: void caseul(void)
                    855: {
                    856:        int i;
                    857: 
                    858:        noscale++;
                    859:        if (skip())
                    860:                i = 1;
                    861:        else 
                    862:                i = atoi0();
                    863:        if (ul && (i == 0)) {
                    864:                font = sfont;
                    865:                ul = cu = 0;
                    866:        }
                    867:        if (i) {
                    868:                if (!ul) {
                    869:                        sfont = font;
                    870:                        font = ulfont;
                    871:                }
                    872:                ul = i;
                    873:        }
                    874:        noscale = 0;
                    875:        mchbits();
                    876: }
                    877: 
                    878: 
                    879: void caseuf(void)
                    880: {
                    881:        int i, j;
                    882: 
                    883:        if (skip() || !(i = getrq()) || i == 'S' ||  (j = findft(i))  == -1)
                    884:                ulfont = ULFONT; /*default underline position*/
                    885:        else 
                    886:                ulfont = j;
                    887:        if (NROFF && ulfont == FT)
                    888:                ulfont = ULFONT;
                    889: }
                    890: 
                    891: 
                    892: void caseit(void)
                    893: {
                    894:        int i;
                    895: 
                    896:        lgf++;
                    897:        it = itmac = 0;
                    898:        noscale++;
                    899:        skip();
                    900:        i = atoi0();
                    901:        skip();
                    902:        if (!nonumb && (itmac = getrq()))
                    903:                it = i;
                    904:        noscale = 0;
                    905: }
                    906: 
                    907: 
                    908: void casemc(void)
                    909: {
                    910:        int i;
                    911: 
                    912:        if (icf > 1)
                    913:                ic = 0;
                    914:        icf = 0;
                    915:        if (skip())
                    916:                return;
                    917:        ic = getch();
                    918:        icf = 1;
                    919:        skip();
                    920:        i = max(hnumb((int *)0), 0);
                    921:        if (!nonumb)
                    922:                ics = i;
                    923: }
                    924: 
                    925: 
                    926: void casemk(void)
                    927: {
                    928:        int i, j;
                    929: 
                    930:        if (dip != d)
                    931:                j = dip->dnl; 
                    932:        else 
                    933:                j = numtab[NL].val;
                    934:        if (skip()) {
                    935:                dip->mkline = j;
                    936:                return;
                    937:        }
                    938:        if ((i = getrq()) == 0)
                    939:                return;
                    940:        numtab[findr(i)].val = j;
                    941: }
                    942: 
                    943: 
                    944: void casesv(void)
                    945: {
                    946:        int i;
                    947: 
                    948:        skip();
                    949:        if ((i = vnumb((int *)0)) < 0)
                    950:                return;
                    951:        if (nonumb)
                    952:                i = 1;
                    953:        sv += i;
                    954:        caseos();
                    955: }
                    956: 
                    957: 
                    958: void caseos(void)
                    959: {
                    960:        int savlss;
                    961: 
                    962:        if (sv <= findt1()) {
                    963:                savlss = lss;
                    964:                lss = sv;
                    965:                newline(0);
                    966:                lss = savlss;
                    967:                sv = 0;
                    968:        }
                    969: }
                    970: 
                    971: 
                    972: void casenm(void)
                    973: {
                    974:        int i;
                    975: 
                    976:        lnmod = nn = 0;
                    977:        if (skip())
                    978:                return;
                    979:        lnmod++;
                    980:        noscale++;
                    981:        i = inumb(&numtab[LN].val);
                    982:        if (!nonumb)
                    983:                numtab[LN].val = max(i, 0);
                    984:        getnm(&ndf, 1);
                    985:        getnm(&nms, 0);
                    986:        getnm(&ni, 0);
                    987:        getnm(&nmwid, 3);       /* really kludgy! */
                    988:        noscale = 0;
                    989:        nmbits = chbits;
                    990: }
                    991: 
                    992: 
                    993: void getnm(int *p, int min)
                    994: {
                    995:        int i;
                    996: 
                    997:        eat(' ');
                    998:        if (skip())
                    999:                return;
                   1000:        i = atoi0();
                   1001:        if (nonumb)
                   1002:                return;
                   1003:        *p = max(i, min);
                   1004: }
                   1005: 
                   1006: 
                   1007: void casenn(void)
                   1008: {
                   1009:        noscale++;
                   1010:        skip();
                   1011:        nn = max(atoi0(), 1);
                   1012:        noscale = 0;
                   1013: }
                   1014: 
                   1015: 
                   1016: void caseab(void)
                   1017: {
                   1018:        casetm1(1);
                   1019:        done3(0);
                   1020: }
                   1021: 
                   1022: 
                   1023: /* nroff terminal handling has been pretty well excised */
                   1024: /* as part of the merge with troff.  these are ghostly remnants, */
                   1025: /* called, but doing nothing. restore them at your peril. */
                   1026: 
                   1027: 
                   1028: void save_tty(void)                    /*save any tty settings that may be changed*/
                   1029: {
                   1030: }
                   1031: 
                   1032: 
                   1033: void restore_tty(void)                 /*restore tty settings from beginning*/
                   1034: {
                   1035: }
                   1036: 
                   1037: 
                   1038: void set_tty(void)
                   1039: {
                   1040: }
                   1041: 
                   1042: 
                   1043: void echo_off(void)                    /*turn off ECHO for .rd in "-q" mode*/
                   1044: {
                   1045: }
                   1046: 
                   1047: 
                   1048: void echo_on(void)                     /*restore ECHO after .rd in "-q" mode*/
                   1049: {
                   1050: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.