Annotation of cci/usr/src/bin/stty.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char *sccsid ="@(#)stty.c       4.14 (Berkeley) 7/6/83";
                      3: #endif
                      4: /*
                      5:  * set teletype modes
                      6:  */
                      7: 
                      8: #include <stdio.h>
                      9: #include <sgtty.h>
                     10: 
                     11: struct
                     12: {
                     13:        char    *string;
                     14:        int     speed;
                     15: } speeds[] = {
                     16:        "0",    B0,
                     17:        "50",   B50,
                     18:        "75",   B75,
                     19:        "110",  B110,
                     20:        "134",  B134,
                     21:        "134.5",B134,
                     22:        "150",  B150,
                     23:        "200",  B200,
                     24:        "300",  B300,
                     25:        "600",  B600,
                     26:        "1200", B1200,
                     27:        "1800", B1800,
                     28:        "2400", B2400,
                     29:        "4800", B4800,
                     30:        "9600", B9600,
                     31:        "exta", EXTA,
                     32:        "19200", EXTA,
                     33:        "extb", EXTB,
                     34:        "38400", EXTB,
                     35:        0,
                     36: };
                     37: struct
                     38: {
                     39:        char    *string;
                     40:        int     numbits;
                     41: } stopbits[] = {
                     42:        "1",    STOP1,
                     43:        "2",    STOP2,
                     44:        "3",    STOP3,
                     45:        0,
                     46: };
                     47: struct
                     48: {
                     49:        char    *string;
                     50:        int     set;
                     51:        int     reset;
                     52:        int     lset;
                     53:        int     lreset;
                     54: } modes[] = {
                     55:        "even",         EVENP, 0, 0, 0,
                     56:        "-even",        0, EVENP, 0, 0,
                     57:        "odd",          ODDP, 0, 0, 0,
                     58:        "-odd",         0, ODDP, 0, 0,
                     59:        "raw",          RAW, 0, 0, 0,
                     60:        "-raw",         0, RAW, 0, 0,
                     61:        "cooked",       0, RAW, 0, 0,
                     62:        "-nl",          CRMOD, 0, 0, 0,
                     63:        "nl",           0, CRMOD, 0, 0,
                     64:        "echo",         ECHO, 0, 0, 0,
                     65:        "-echo",        0, ECHO, 0, 0,
                     66:        "LCASE",        LCASE, 0, 0, 0,
                     67:        "lcase",        LCASE, 0, 0, 0,
                     68:        "-LCASE",       0, LCASE, 0, 0,
                     69:        "-lcase",       0, LCASE, 0, 0,
                     70:        "-tabs",        XTABS, 0, 0, 0,
                     71:        "tabs",         0, XTABS, 0, 0,
                     72:        "tandem",       TANDEM, 0, 0, 0,
                     73:        "-tandem",      0, TANDEM, 0, 0,
                     74:        "cbreak",       CBREAK, 0, 0, 0,
                     75:        "-cbreak",      0, CBREAK, 0, 0,
                     76:        "cr0",          CR0, CR3, 0, 0,
                     77:        "cr1",          CR1, CR3, 0, 0,
                     78:        "cr2",          CR2, CR3, 0, 0,
                     79:        "cr3",          CR3, CR3, 0, 0,
                     80:        "tab0",         TAB0, XTABS, 0, 0,
                     81:        "tab1",         TAB1, XTABS, 0, 0,
                     82:        "tab2",         TAB2, XTABS, 0, 0,
                     83:        "nl0",          NL0, NL3, 0, 0,
                     84:        "nl1",          NL1, NL3, 0, 0,
                     85:        "nl2",          NL2, NL3, 0, 0,
                     86:        "nl3",          NL3, NL3, 0, 0,
                     87:        "ff0",          FF0, FF1, 0, 0,
                     88:        "ff1",          FF1, FF1, 0, 0,
                     89:        "bs0",          BS0, BS1, 0, 0,
                     90:        "bs1",          BS1, BS1, 0, 0,
                     91:        "33",           CR1, ALLDELAY, 0, 0,
                     92:        "tty33",        CR1, ALLDELAY, 0, 0,
                     93:        "37",           FF1+CR2+TAB1+NL1, ALLDELAY, 0, 0,
                     94:        "tty37",        FF1+CR2+TAB1+NL1, ALLDELAY, 0, 0,
                     95:        "05",           NL2, ALLDELAY, 0, 0,
                     96:        "vt05",         NL2, ALLDELAY, 0, 0,
                     97:        "tn",           CR1, ALLDELAY, 0, 0,
                     98:        "tn300",        CR1, ALLDELAY, 0, 0,
                     99:        "ti",           CR2, ALLDELAY, 0, 0,
                    100:        "ti700",        CR2, ALLDELAY, 0, 0,
                    101:        "tek",          FF1, ALLDELAY, 0, 0,
                    102:        "crtbs",        0, 0, LCRTBS, LPRTERA,
                    103:        "-crtbs",       0, 0, 0, LCRTBS,
                    104:        "prterase",     0, 0, LPRTERA, LCRTBS+LCRTKIL+LCRTERA,
                    105:        "-prterase",    0, 0, 0, LPRTERA,
                    106:        "crterase",     0, 0, LCRTERA, LPRTERA,
                    107:        "-crterase",    0, 0, 0, LCRTERA,
                    108:        "crtkill",      0, 0, LCRTKIL, LPRTERA,
                    109:        "-crtkill",     0, 0, 0, LCRTKIL,
                    110:        "tilde",        0, 0, LTILDE, 0,
                    111:        "-tilde",       0, 0, 0, LTILDE,
                    112:        "mdmbuf",       0, 0, LMDMBUF, 0,
                    113:        "-mdmbuf",      0, 0, 0, LMDMBUF,
                    114:        "litout",       0, 0, LLITOUT, 0,
                    115:        "-litout",      0, 0, 0, LLITOUT,
                    116:        "tostop",       0, 0, LTOSTOP, 0,
                    117:        "-tostop",      0, 0, 0, LTOSTOP,
                    118:        "flusho",       0, 0, LFLUSHO, 0,
                    119:        "-flusho",      0, 0, 0, LFLUSHO,
                    120:        "nohang",       0, 0, LNOHANG, 0,
                    121:        "-nohang",      0, 0, 0, LNOHANG,
                    122: #ifdef notdef
                    123:        "etxack",       0, 0, LETXACK, 0,
                    124:        "-etxack",      0, 0, 0, LETXACK,
                    125: #endif
                    126:        "ctlecho",      0, 0, LCTLECH, 0,
                    127:        "-ctlecho",     0, 0, 0, LCTLECH,
                    128:        "pendin",       0, 0, LPENDIN, 0,
                    129:        "-pendin",      0, 0, 0, LPENDIN,
                    130:        "decctlq",      0, 0, LDECCTQ, 0,
                    131:        "-decctlq",     0, 0, 0, LDECCTQ,
                    132:        "noflsh",       0, 0, LNOFLSH, 0,
                    133:        "-noflsh",      0, 0, 0, LNOFLSH,
                    134:        0,
                    135: };
                    136: 
                    137: struct tchars tc;
                    138: struct ltchars ltc;
                    139: struct sgttyb mode;
                    140: int    lmode;
                    141: int    oldisc, ldisc;
                    142: 
                    143: struct special {
                    144:        char    *name;
                    145:        char    *cp;
                    146:        char    def;
                    147: } special[] = {
                    148:        "erase",        &mode.sg_erase,         CERASE,
                    149:        "kill",         &mode.sg_kill,          CKILL,
                    150:        "intr",         &tc.t_intrc,            CINTR,
                    151:        "quit",         &tc.t_quitc,            CQUIT,
                    152:        "start",        &tc.t_startc,           CSTART,
                    153:        "stop",         &tc.t_stopc,            CSTOP,
                    154:        "eof",          &tc.t_eofc,             CEOF,
                    155:        "brk",          &tc.t_brkc,             CBRK,
                    156:        "susp",         &ltc.t_suspc,           CSUSP,
                    157:        "dsusp",        &ltc.t_dsuspc,          CDSUSP,
                    158:        "rprnt",        &ltc.t_rprntc,          CRPRNT,
                    159:        "flush",        &ltc.t_flushc,          CFLUSH,
                    160:        "werase",       &ltc.t_werasc,          CWERASE,
                    161:        "lnext",        &ltc.t_lnextc,          CLNEXT,
                    162:        0
                    163: };
                    164: char   *arg;
                    165: 
                    166: int    argc;
                    167: char   **argv;
                    168: main(iargc, iargv)
                    169: char   **iargv;
                    170: {
                    171:        int i;
                    172:        register struct special *sp;
                    173:        char obuf[BUFSIZ];
                    174: 
                    175:        setbuf(stderr, obuf);
                    176:        argc = iargc;
                    177:        argv = iargv;
                    178:        ioctl(1, TIOCGETP, &mode);
                    179:        ioctl(1, TIOCGETD, &ldisc);
                    180:        oldisc = ldisc;
                    181:        ioctl(1, TIOCGETC, &tc);
                    182:        ioctl(1, TIOCLGET, &lmode);
                    183:        ioctl(1, TIOCGLTC, &ltc);
                    184:        if(argc == 1) {
                    185:                prmodes(0);
                    186:                exit(0);
                    187:        }
                    188:        if (argc == 2 && !strcmp(argv[1], "all")) {
                    189:                prmodes(1);
                    190:                exit(0);
                    191:        }
                    192:        if (argc == 2 && !strcmp(argv[1], "everything")) {
                    193:                prmodes(2);
                    194:                exit(0);
                    195:        }
                    196: /*
                    197:        if (argc == 2 && !strcmp(argv[1], "all")) {
                    198:                prmodes(2);
                    199:                exit(0);
                    200:        }
                    201: */
                    202:        while(--argc > 0) {
                    203:                arg = *++argv;
                    204:                if (eq("ek")){
                    205:                        mode.sg_erase = '#';
                    206:                        mode.sg_kill = '@';
                    207:                        continue;
                    208:                }
                    209:                if (eq("new")){
                    210:                        ldisc = NTTYDISC;
                    211:                        if (ioctl(1, TIOCSETD, &ldisc)<0)
                    212:                                perror("ioctl");
                    213:                        continue;
                    214:                }
                    215:                if (eq("newcrt")){
                    216:                        ldisc = NTTYDISC;
                    217:                        lmode &= ~LPRTERA;
                    218:                        lmode |= LCRTBS|LCTLECH;
                    219:                        if (mode.sg_ospeed >= B1200)
                    220:                                lmode |= LCRTERA|LCRTKIL;
                    221:                        if (ioctl(1, TIOCSETD, &ldisc)<0)
                    222:                                perror("ioctl");
                    223:                        continue;
                    224:                }
                    225:                if (eq("crt")){
                    226:                        lmode &= ~LPRTERA;
                    227:                        lmode |= LCRTBS|LCTLECH;
                    228:                        if (mode.sg_ospeed >= B1200)
                    229:                                lmode |= LCRTERA|LCRTKIL;
                    230:                        continue;
                    231:                }
                    232:                if (eq("old")){
                    233:                        ldisc = 0;
                    234:                        if (ioctl(1, TIOCSETD, &ldisc)<0)
                    235:                                perror("ioctl");
                    236:                        continue;
                    237:                }
                    238:                if (eq("dec")){
                    239:                        mode.sg_erase = 0177;
                    240:                        mode.sg_kill = CTRL(u);
                    241:                        tc.t_intrc = CTRL(c);
                    242:                        ldisc = NTTYDISC;
                    243:                        lmode &= ~LPRTERA;
                    244:                        lmode |= LCRTBS|LCTLECH|LDECCTQ;
                    245:                        if (mode.sg_ospeed >= B1200)
                    246:                                lmode |= LCRTERA|LCRTKIL;
                    247:                        if (ioctl(1, TIOCSETD, &ldisc)<0)
                    248:                                perror("ioctl");
                    249:                        continue;
                    250:                }
                    251:                for (sp = special; sp->name; sp++)
                    252:                        if (eq(sp->name)) {
                    253:                                if (--argc == 0)
                    254:                                        goto done;
                    255:                                if (**++argv == 'u')
                    256:                                        *sp->cp = 0377;
                    257:                                else if (**argv == '^')
                    258:                                        *sp->cp = ((*argv)[1] == '?') ?
                    259:                                            0177 : (*argv)[1] & 037;
                    260:                                else
                    261:                                        *sp->cp = **argv;
                    262:                                goto cont;
                    263:                        }
                    264:                if (eq("gspeed")) {
                    265:                        mode.sg_ispeed = B300;
                    266:                        mode.sg_ospeed = B9600;
                    267:                        continue;
                    268:                }
                    269:                if (eq("hup")) {
                    270:                        ioctl(1, TIOCHPCL, NULL);
                    271:                        continue;
                    272:                }
                    273:                for(i=0; speeds[i].string; i++)
                    274:                        if(eq(speeds[i].string)) {
                    275:                                mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed;
                    276:                                goto cont;
                    277:                        }
                    278:                for(i=0; stopbits[i].string; i++)
                    279:                        if(eq(stopbits[i].string)) {
                    280:                                mode.sg_stopbits = stopbits[i].numbits;
                    281:                                goto cont;
                    282:                        }
                    283:                if (eq("speed")) {
                    284:                        ioctl(open("/dev/tty", 0), TIOCGETP, &mode);
                    285:                        for(i=0; speeds[i].string; i++)
                    286:                                if (mode.sg_ospeed == speeds[i].speed) {
                    287:                                        printf("%s\n", speeds[i].string);
                    288:                                        exit(0);
                    289:                                }
                    290:                        printf("unknown\n");
                    291:                        exit(1);
                    292:                }
                    293:                for(i=0; modes[i].string; i++)
                    294:                        if(eq(modes[i].string)) {
                    295:                                mode.sg_flags &= ~modes[i].reset;
                    296:                                mode.sg_flags |= modes[i].set;
                    297:                                lmode &= ~modes[i].lreset;
                    298:                                lmode |= modes[i].lset;
                    299:                        }
                    300:                if(arg)
                    301:                        fprintf(stderr,"unknown mode: %s\n", arg);
                    302: cont:
                    303:                ;
                    304:        }
                    305: done:
                    306:        ioctl(1, TIOCSETN, &mode);
                    307:        ioctl(1, TIOCSETC, &tc);
                    308:        ioctl(1, TIOCSLTC, &ltc);
                    309:        ioctl(1, TIOCLSET, &lmode);
                    310: }
                    311: 
                    312: eq(string)
                    313: char *string;
                    314: {
                    315:        int i;
                    316: 
                    317:        if(!arg)
                    318:                return(0);
                    319:        i = 0;
                    320: loop:
                    321:        if(arg[i] != string[i])
                    322:                return(0);
                    323:        if(arg[i++] != '\0')
                    324:                goto loop;
                    325:        arg = 0;
                    326:        return(1);
                    327: }
                    328: 
                    329: prmodes(all)
                    330: {
                    331:        register m;
                    332:        int any ;
                    333:        int numbits = 1;
                    334: 
                    335:        if(ldisc==NETLDISC)
                    336:                fprintf(stderr, "net discipline, ");
                    337:        else if(ldisc==NTTYDISC)
                    338:                fprintf(stderr, "new tty, ");
                    339:        else if(all==2)
                    340:                fprintf(stderr, "old tty, ");
                    341:        if(mode.sg_ispeed != mode.sg_ospeed) {
                    342:                prspeed("input speed ", mode.sg_ispeed);
                    343:                prspeed("output speed ", mode.sg_ospeed);
                    344:        } else
                    345:                prspeed("speed ", mode.sg_ispeed);
                    346:        if (all==2) {
                    347:                switch (mode.sg_stopbits) {
                    348:                case STOP1:
                    349:                        numbits=1;
                    350:                        break;
                    351:                
                    352:                case STOP2:
                    353:                        numbits=2;
                    354:                        break;
                    355:                
                    356:                case STOP3:
                    357:                        numbits=3;
                    358:                }
                    359:                fprintf(stderr, "; stopbits = %d", numbits);
                    360:        }
                    361:        fprintf(stderr, all==2 ? "\n" : "; ");
                    362:        m = mode.sg_flags;
                    363:        if(all==2 || (m&(EVENP|ODDP))!=(EVENP|ODDP)) {
                    364:                if(m & EVENP)   fprintf(stderr,"even ");
                    365:                if(m & ODDP)    fprintf(stderr,"odd ");
                    366:        }
                    367:        if(all==2 || m&RAW)
                    368:                fprintf(stderr,"-raw "+((m&RAW)!=0));
                    369:        if(all==2 || (m&CRMOD)==0)
                    370:                fprintf(stderr,"-nl "+((m&CRMOD)==0));
                    371:        if(all==2 || (m&ECHO)==0)
                    372:                fprintf(stderr,"-echo "+((m&ECHO)!=0));
                    373:        if(all==2 || (m&LCASE))
                    374:                fprintf(stderr,"-lcase "+((m&LCASE)!=0));
                    375:        if(all==2 || (m&TANDEM))
                    376:                fprintf(stderr,"-tandem "+((m&TANDEM)!=0));
                    377:        fprintf(stderr,"-tabs "+((m&XTABS)!=XTABS));
                    378:        if(all==2 || (m&CBREAK))
                    379:                fprintf(stderr,"-cbreak "+((m&CBREAK)!=0));
                    380:        if(all==2 || (m&NLDELAY))
                    381:                delay((m&NLDELAY)/NL1,  "nl");
                    382:        if ((m&TBDELAY)!=XTABS)
                    383:                delay((m&TBDELAY)/TAB1, "tab");
                    384:        if(all==2 || (m&CRDELAY))
                    385:                delay((m&CRDELAY)/CR1,  "cr");
                    386:        if(all==2 || (m&VTDELAY))
                    387:                delay((m&VTDELAY)/FF1,  "ff");
                    388:        if(all==2 || (m&BSDELAY))
                    389:                delay((m&BSDELAY)/BS1,  "bs");
                    390:        if (all)
                    391:                fprintf(stderr,"\n");
                    392: #define        lpit(what,str) \
                    393:        if (all==2||(lmode&what)) { \
                    394:                fprintf(stderr,str+((lmode&what)!=0)); any++; \
                    395:        }
                    396:        if (ldisc == NTTYDISC) {
                    397:                int newcrt = (lmode&(LCTLECH|LCRTBS)) == (LCTLECH|LCRTBS) &&
                    398:                    (lmode&(LCRTERA|LCRTKIL)) ==
                    399:                      ((mode.sg_ospeed > B300) ? LCRTERA|LCRTKIL : 0);
                    400:                int nothing = 1;
                    401:                if (newcrt) {
                    402:                        if (all==2)
                    403:                                fprintf(stderr, "crt: (crtbs crterase crtkill ctlecho) ");
                    404:                        else
                    405:                                fprintf(stderr, "crt ");
                    406:                        any++;
                    407:                } else {
                    408:                        lpit(LCRTBS, "-crtbs ");
                    409:                        lpit(LCRTERA, "-crterase ");
                    410:                        lpit(LCRTKIL, "-crtkill ");
                    411:                        lpit(LCTLECH, "-ctlecho ");
                    412:                        lpit(LPRTERA, "-prterase ");
                    413:                }
                    414:                lpit(LTOSTOP, "-tostop ");
                    415:                if (all==2) {
                    416:                        fprintf(stderr, "\n");
                    417:                        any = 0;
                    418:                        nothing = 0;
                    419:                }
                    420:                lpit(LTILDE, "-tilde ");
                    421:                lpit(LFLUSHO, "-flusho ");
                    422:                lpit(LMDMBUF, "-mdmbuf ");
                    423:                lpit(LLITOUT, "-litout ");
                    424:                lpit(LNOHANG, "-nohang ");
                    425:                if (any) {
                    426:                        fprintf(stderr,"\n");
                    427:                        any = 0;
                    428:                        nothing = 0;
                    429:                }
                    430: #ifdef notdef
                    431:                lpit(LETXACK, "-etxack ");
                    432: #endif
                    433:                lpit(LPENDIN, "-pendin ");
                    434:                lpit(LDECCTQ, "-decctlq ");
                    435:                lpit(LNOFLSH, "-noflsh ");
                    436:                if (any || nothing)
                    437:                        fprintf(stderr,"\n");
                    438:        } else if (!all)
                    439:                fprintf(stderr,"\n");
                    440:        if (all) {
                    441:                switch (ldisc) {
                    442: 
                    443:                case 0:
                    444:                        fprintf(stderr,"\
                    445: erase  kill   intr   quit   stop   eof\
                    446: \n");
                    447:                        pcol(mode.sg_erase, -1);
                    448:                        pcol(mode.sg_kill, -1);
                    449:                        pcol(tc.t_intrc, -1);
                    450:                        pcol(tc.t_quitc, -1);
                    451:                        pcol(tc.t_stopc, tc.t_startc);
                    452:                        pcol(tc.t_eofc, tc.t_brkc);
                    453:                        fprintf(stderr,"\n");
                    454:                        break;
                    455: 
                    456:                case NTTYDISC:
                    457:                        fprintf(stderr,"\
                    458: erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof\
                    459: \n"); 
                    460:                        pcol(mode.sg_erase, -1);
                    461:                        pcol(mode.sg_kill, -1);
                    462:                        pcol(ltc.t_werasc, -1);
                    463:                        pcol(ltc.t_rprntc, -1);
                    464:                        pcol(ltc.t_flushc, -1);
                    465:                        pcol(ltc.t_lnextc, -1);
                    466:                        pcol(ltc.t_suspc, ltc.t_dsuspc);
                    467:                        pcol(tc.t_intrc, -1);
                    468:                        pcol(tc.t_quitc, -1);
                    469:                        pcol(tc.t_stopc, tc.t_startc);
                    470:                        pcol(tc.t_eofc, tc.t_brkc);
                    471:                        fprintf(stderr,"\n");
                    472:                        break;
                    473:                }
                    474:        } else if (ldisc != NETLDISC) {
                    475:                register struct special *sp;
                    476:                int first = 1;
                    477: 
                    478:                for (sp = special; sp->name; sp++) {
                    479:                        if ((*sp->cp&0377) != (sp->def&0377)) {
                    480:                                pit(*sp->cp, sp->name, first ? "" : ", ");
                    481:                                first = 0;
                    482:                        };
                    483:                        if (sp->cp == &tc.t_brkc && ldisc == 0)
                    484:                                break;
                    485:                }
                    486:                if (!first)
                    487:                        fprintf(stderr, "\n");
                    488:        }
                    489: }
                    490: 
                    491: pcol(ch1, ch2)
                    492:        int ch1, ch2;
                    493: {
                    494:        int nout = 0;
                    495: 
                    496:        ch1 &= 0377;
                    497:        ch2 &= 0377;
                    498:        if (ch1 == ch2)
                    499:                ch2 = 0377;
                    500:        for (; ch1 != 0377 || ch2 != 0377; ch1 = ch2, ch2 = 0377) {
                    501:                if (ch1 == 0377)
                    502:                        continue;
                    503:                if (ch1 & 0200) {
                    504:                        fprintf(stderr, "M-");
                    505:                        nout += 2;
                    506:                        ch1 &= ~ 0200;
                    507:                }
                    508:                if (ch1 == 0177) {
                    509:                        fprintf(stderr, "^");
                    510:                        nout++;
                    511:                        ch1 = '?';
                    512:                } else if (ch1 < ' ') {
                    513:                        fprintf(stderr, "^");
                    514:                        nout++;
                    515:                        ch1 += '@';
                    516:                }
                    517:                fprintf(stderr, "%c", ch1);
                    518:                nout++;
                    519:                if (ch2 != 0377) {
                    520:                        fprintf(stderr, "/");
                    521:                        nout++;
                    522:                }
                    523:        }
                    524:        while (nout < 7) {
                    525:                fprintf(stderr, " ");
                    526:                nout++;
                    527:        }
                    528: }
                    529: 
                    530: pit(what, itsname, sep)
                    531:        unsigned what;
                    532:        char *itsname, *sep;
                    533: {
                    534: 
                    535:        what &= 0377;
                    536:        fprintf(stderr, "%s%s", sep, itsname);
                    537:        if (what == 0377) {
                    538:                fprintf(stderr, " <undef>");
                    539:                return;
                    540:        }
                    541:        fprintf(stderr, " = ");
                    542:        if (what & 0200) {
                    543:                fprintf(stderr, "M-");
                    544:                what &= ~ 0200;
                    545:        }
                    546:        if (what == 0177) {
                    547:                fprintf(stderr, "^");
                    548:                what = '?';
                    549:        } else if (what < ' ') {
                    550:                fprintf(stderr, "^");
                    551:                what += '@';
                    552:        }
                    553:        fprintf(stderr, "%c", what);
                    554: }
                    555: 
                    556: delay(m, s)
                    557: char *s;
                    558: {
                    559: 
                    560:        if(m)
                    561:                fprintf(stderr,"%s%d ", s, m);
                    562: }
                    563: 
                    564: int    speed[] = {
                    565:        0,50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,19200,38400
                    566: };
                    567: 
                    568: prspeed(c, s)
                    569: char *c;
                    570: {
                    571: 
                    572:        fprintf(stderr,"%s%d baud",  c, speed[s]);
                    573: }

unix.superglobalmegacorp.com

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