1*3955Sroot static char *sccsid ="@(#)stty.c 4.6 (Berkeley) 07/08/81"; 21179Sbill /* 31179Sbill * set teletype modes 41179Sbill */ 51179Sbill 61179Sbill #include <stdio.h> 71179Sbill #include <sgtty.h> 81179Sbill 91179Sbill struct 101179Sbill { 111179Sbill char *string; 121179Sbill int speed; 131179Sbill } speeds[] = { 141179Sbill "0", B0, 151179Sbill "50", B50, 161179Sbill "75", B75, 171179Sbill "110", B110, 181179Sbill "134", B134, 191179Sbill "134.5",B134, 201179Sbill "150", B150, 211179Sbill "200", B200, 221179Sbill "300", B300, 231179Sbill "600", B600, 241179Sbill "1200", B1200, 251179Sbill "1800", B1800, 261179Sbill "2400", B2400, 271179Sbill "4800", B4800, 281179Sbill "9600", B9600, 291179Sbill "exta", EXTA, 301179Sbill "extb", EXTB, 311179Sbill 0, 321179Sbill }; 331179Sbill struct 341179Sbill { 351179Sbill char *string; 361179Sbill int set; 371179Sbill int reset; 381179Sbill int lset; 391179Sbill int lreset; 401179Sbill } modes[] = { 411179Sbill "even", EVENP, 0, 0, 0, 421179Sbill "-even", 0, EVENP, 0, 0, 431179Sbill "odd", ODDP, 0, 0, 0, 441179Sbill "-odd", 0, ODDP, 0, 0, 451179Sbill "raw", RAW, 0, 0, 0, 461179Sbill "-raw", 0, RAW, 0, 0, 471179Sbill "cooked", 0, RAW, 0, 0, 481179Sbill "-nl", CRMOD, 0, 0, 0, 491179Sbill "nl", 0, CRMOD, 0, 0, 501179Sbill "echo", ECHO, 0, 0, 0, 511179Sbill "-echo", 0, ECHO, 0, 0, 521179Sbill "LCASE", LCASE, 0, 0, 0, 531179Sbill "lcase", LCASE, 0, 0, 0, 541179Sbill "-LCASE", 0, LCASE, 0, 0, 551179Sbill "-lcase", 0, LCASE, 0, 0, 561179Sbill "-tabs", XTABS, 0, 0, 0, 571179Sbill "tabs", 0, XTABS, 0, 0, 581179Sbill "tandem", TANDEM, 0, 0, 0, 591179Sbill "-tandem", 0, TANDEM, 0, 0, 601179Sbill "cbreak", CBREAK, 0, 0, 0, 611179Sbill "-cbreak", 0, CBREAK, 0, 0, 621179Sbill "cr0", CR0, CR3, 0, 0, 631179Sbill "cr1", CR1, CR3, 0, 0, 641179Sbill "cr2", CR2, CR3, 0, 0, 651179Sbill "cr3", CR3, CR3, 0, 0, 661179Sbill "tab0", TAB0, XTABS, 0, 0, 671179Sbill "tab1", TAB1, XTABS, 0, 0, 681179Sbill "tab2", TAB2, XTABS, 0, 0, 691179Sbill "nl0", NL0, NL3, 0, 0, 701179Sbill "nl1", NL1, NL3, 0, 0, 711179Sbill "nl2", NL2, NL3, 0, 0, 721179Sbill "nl3", NL3, NL3, 0, 0, 731179Sbill "ff0", FF0, FF1, 0, 0, 741179Sbill "ff1", FF1, FF1, 0, 0, 751179Sbill "bs0", BS0, BS1, 0, 0, 761179Sbill "bs1", BS1, BS1, 0, 0, 771179Sbill "33", CR1, ALLDELAY, 0, 0, 781179Sbill "tty33", CR1, ALLDELAY, 0, 0, 791179Sbill "37", FF1+CR2+TAB1+NL1, ALLDELAY, 0, 0, 801179Sbill "tty37", FF1+CR2+TAB1+NL1, ALLDELAY, 0, 0, 811179Sbill "05", NL2, ALLDELAY, 0, 0, 821179Sbill "vt05", NL2, ALLDELAY, 0, 0, 831179Sbill "tn", CR1, ALLDELAY, 0, 0, 841179Sbill "tn300", CR1, ALLDELAY, 0, 0, 851179Sbill "ti", CR2, ALLDELAY, 0, 0, 861179Sbill "ti700", CR2, ALLDELAY, 0, 0, 871179Sbill "tek", FF1, ALLDELAY, 0, 0, 881179Sbill "crtbs", 0, 0, LCRTBS, LPRTERA, 891179Sbill "-crtbs", 0, 0, 0, LCRTBS, 901179Sbill "prterase", 0, 0, LPRTERA, LCRTBS+LCRTKIL+LCRTERA, 911179Sbill "-prterase", 0, 0, 0, LPRTERA, 921179Sbill "crterase", 0, 0, LCRTERA, LPRTERA, 931179Sbill "-crterase", 0, 0, 0, LCRTERA, 941179Sbill "crtkill", 0, 0, LCRTKIL, LPRTERA, 951179Sbill "-crtkill", 0, 0, 0, LCRTKIL, 961179Sbill "tilde", 0, 0, LTILDE, 0, 971179Sbill "-tilde", 0, 0, 0, LTILDE, 981179Sbill "mdmbuf", 0, 0, LMDMBUF, 0, 991179Sbill "-mdmbuf", 0, 0, 0, LMDMBUF, 1001179Sbill "litout", 0, 0, LLITOUT, 0, 1011179Sbill "-litout", 0, 0, 0, LLITOUT, 1021179Sbill "tostop", 0, 0, LTOSTOP, 0, 1031179Sbill "-tostop", 0, 0, 0, LTOSTOP, 1041179Sbill "flusho", 0, 0, LFLUSHO, 0, 1051179Sbill "-flusho", 0, 0, 0, LFLUSHO, 1061179Sbill "nohang", 0, 0, LNOHANG, 0, 1071179Sbill "-nohang", 0, 0, 0, LNOHANG, 1081179Sbill "etxack", 0, 0, LETXACK, 0, 1091179Sbill "-etxack", 0, 0, 0, LETXACK, 1101179Sbill "intrup", 0, 0, LINTRUP, 0, 1111179Sbill "-intrup", 0, 0, 0, LINTRUP, 1121179Sbill "ctlecho", 0, 0, LCTLECH, 0, 1131179Sbill "-ctlecho", 0, 0, 0, LCTLECH, 1141179Sbill "pendin", 0, 0, LPENDIN, 0, 1151179Sbill "-pendin", 0, 0, 0, LPENDIN, 1163797Sroot "decctlq", 0, 0, LDECCTQ, 0, 1173797Sroot "-decctlq", 0, 0, 0, LDECCTQ, 1181179Sbill 0, 1191179Sbill }; 1201179Sbill 1211179Sbill struct tchars tc; 1221179Sbill struct ltchars ltc; 1231179Sbill struct sgttyb mode; 1241179Sbill int lmode; 1251179Sbill int oldisc, ldisc; 1261179Sbill 1271179Sbill #define CTRL(x) ('x'&037) 1281179Sbill 1291179Sbill struct special { 1301179Sbill char *name; 1311179Sbill char *cp; 1321179Sbill char def; 1331179Sbill } special[] = { 1341179Sbill "erase", &mode.sg_erase, CTRL(h), 1351179Sbill "kill", &mode.sg_kill, '@', 1361179Sbill "intr", &tc.t_intrc, 0177, 1371179Sbill "quit", &tc.t_quitc, CTRL(\\\\), 1381179Sbill "start", &tc.t_startc, CTRL(q), 1391179Sbill "stop", &tc.t_stopc, CTRL(s), 1401179Sbill "eof", &tc.t_eofc, CTRL(d), 1411179Sbill "brk", &tc.t_brkc, 0377, 1421179Sbill "susp", <c.t_suspc, CTRL(z), 1431179Sbill "dsusp", <c.t_dsuspc, CTRL(y), 1441179Sbill "rprnt", <c.t_rprntc, CTRL(r), 1451179Sbill "flush", <c.t_flushc, CTRL(o), 1461179Sbill "werase", <c.t_werasc, CTRL(w), 1471179Sbill "lnext", <c.t_lnextc, CTRL(v), 1481179Sbill 0 1491179Sbill }; 1501179Sbill char *arg; 1511179Sbill 1521179Sbill int argc; 1531179Sbill char **argv; 1541179Sbill main(iargc, iargv) 1551179Sbill char **iargv; 1561179Sbill { 1571179Sbill int i; 1581179Sbill register struct special *sp; 1591179Sbill char obuf[BUFSIZ]; 1601179Sbill 1611179Sbill setbuf(stderr, obuf); 1621179Sbill argc = iargc; 1631179Sbill argv = iargv; 1641179Sbill gtty(1, &mode); 1651179Sbill ioctl(1, TIOCGETD, &ldisc); 1661179Sbill oldisc = ldisc; 1671179Sbill ioctl(1, TIOCGETC, &tc); 1681179Sbill ioctl(1, TIOCLGET, &lmode); 1691179Sbill ioctl(1, TIOCGLTC, <c); 1701179Sbill if(argc == 1) { 1711179Sbill prmodes(0); 1721179Sbill exit(0); 1731179Sbill } 1741179Sbill if (argc == 2 && !strcmp(argv[1], "all")) { 1751179Sbill prmodes(1); 1761179Sbill exit(0); 1771179Sbill } 1781179Sbill if (argc == 2 && !strcmp(argv[1], "everything")) { 1791179Sbill prmodes(2); 1801179Sbill exit(0); 1811179Sbill } 1821179Sbill /* 1831179Sbill if (argc == 2 && !strcmp(argv[1], "all")) { 1841179Sbill prmodes(2); 1851179Sbill exit(0); 1861179Sbill } 1871179Sbill */ 1881179Sbill while(--argc > 0) { 1891179Sbill arg = *++argv; 1901179Sbill if (eq("ek")){ 1911179Sbill mode.sg_erase = '#'; 1921179Sbill mode.sg_kill = '@'; 1931179Sbill continue; 1941179Sbill } 1951179Sbill if (eq("new")){ 1961179Sbill ldisc = NTTYDISC; 1971179Sbill if (ioctl(1, TIOCSETD, &ldisc)<0) 1981179Sbill perror("ioctl"); 1991179Sbill continue; 2001179Sbill } 2011179Sbill if (eq("newcrt")){ 2021179Sbill ldisc = NTTYDISC; 2031179Sbill lmode &= ~LPRTERA; 2041179Sbill lmode |= LCRTBS|LCTLECH; 2051179Sbill if (mode.sg_ospeed >= B1200) 2061179Sbill lmode |= LCRTERA|LCRTKIL; 2071179Sbill if (ioctl(1, TIOCSETD, &ldisc)<0) 2081179Sbill perror("ioctl"); 2091179Sbill continue; 2101179Sbill } 2111179Sbill if (eq("crt")){ 2121179Sbill lmode &= ~LPRTERA; 2131179Sbill lmode |= LCRTBS|LCTLECH; 2141179Sbill if (mode.sg_ospeed >= B1200) 2151179Sbill lmode |= LCRTERA|LCRTKIL; 2161179Sbill continue; 2171179Sbill } 2181179Sbill if (eq("old")){ 2191179Sbill ldisc = 0; 2201179Sbill if (ioctl(1, TIOCSETD, &ldisc)<0) 2211179Sbill perror("ioctl"); 2221179Sbill continue; 2231179Sbill } 2243797Sroot if (eq("dec")){ 2253797Sroot mode.sg_erase = 0177; 2263797Sroot mode.sg_kill = CTRL(u); 2273797Sroot tc.t_intrc = CTRL(c); 2283797Sroot ldisc = NTTYDISC; 2293797Sroot lmode &= ~LPRTERA; 2303797Sroot lmode |= LCRTBS|LCTLECH|LDECCTQ; 2313797Sroot if (mode.sg_ospeed >= B1200) 2323797Sroot lmode |= LCRTERA|LCRTKIL; 2333797Sroot if (ioctl(1, TIOCSETD, &ldisc)<0) 2343797Sroot perror("ioctl"); 2353797Sroot continue; 2363797Sroot } 2371179Sbill for (sp = special; sp->name; sp++) 2381179Sbill if (eq(sp->name)) { 2391179Sbill if (--argc == 0) 2401179Sbill goto done; 2411179Sbill if (**++argv == 'u') 2421179Sbill *sp->cp = 0377; 2431179Sbill else if (**argv == '^') 244*3955Sroot *sp->cp = ((*argv)[1] == '?') ? 2451179Sbill 0177 : (*argv)[1] & 037; 2461179Sbill else 2471179Sbill *sp->cp = **argv; 2481179Sbill goto cont; 2491179Sbill } 2501179Sbill if (eq("gspeed")) { 2511179Sbill mode.sg_ispeed = B300; 2521179Sbill mode.sg_ospeed = B9600; 2531179Sbill continue; 2541179Sbill } 2551179Sbill if (eq("hup")) { 2561179Sbill ioctl(1, TIOCHPCL, NULL); 2571179Sbill continue; 2581179Sbill } 2591179Sbill for(i=0; speeds[i].string; i++) 2601179Sbill if(eq(speeds[i].string)) { 2611179Sbill mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed; 2621179Sbill goto cont; 2631179Sbill } 2641179Sbill if (eq("speed")) { 2651179Sbill gtty(open("/dev/tty", 0), &mode); 2661179Sbill for(i=0; speeds[i].string; i++) 2671179Sbill if (mode.sg_ospeed == speeds[i].speed) { 2681179Sbill printf("%s\n", speeds[i].string); 2691179Sbill exit(0); 2701179Sbill } 2711179Sbill printf("unknown\n"); 2721179Sbill exit(1); 2731179Sbill } 2741179Sbill for(i=0; modes[i].string; i++) 2751179Sbill if(eq(modes[i].string)) { 2761179Sbill mode.sg_flags &= ~modes[i].reset; 2771179Sbill mode.sg_flags |= modes[i].set; 2781179Sbill lmode &= ~modes[i].lreset; 2791179Sbill lmode |= modes[i].lset; 2801179Sbill } 2811179Sbill if(arg) 2821179Sbill fprintf(stderr,"unknown mode: %s\n", arg); 2831179Sbill cont: 2841179Sbill ; 2851179Sbill } 2861179Sbill done: 2871179Sbill ioctl(1, TIOCSETN, &mode); 2881179Sbill ioctl(1, TIOCSETC, &tc); 2891179Sbill ioctl(1, TIOCSLTC, <c); 2901179Sbill ioctl(1, TIOCLSET, &lmode); 2911179Sbill } 2921179Sbill 2931179Sbill eq(string) 2941179Sbill char *string; 2951179Sbill { 2961179Sbill int i; 2971179Sbill 2981179Sbill if(!arg) 2991179Sbill return(0); 3001179Sbill i = 0; 3011179Sbill loop: 3021179Sbill if(arg[i] != string[i]) 3031179Sbill return(0); 3041179Sbill if(arg[i++] != '\0') 3051179Sbill goto loop; 3061179Sbill arg = 0; 3071179Sbill return(1); 3081179Sbill } 3091179Sbill 3101179Sbill prmodes(all) 3111179Sbill { 3121179Sbill register m; 3131179Sbill int any; 3141179Sbill 3151179Sbill if(ldisc==NETLDISC) 3161179Sbill fprintf(stderr, "net discipline, "); 3171179Sbill else if(ldisc==NTTYDISC) 3181179Sbill fprintf(stderr, "new tty, "); 3191179Sbill else if(all==2) 3201179Sbill fprintf(stderr, "old tty, "); 3211179Sbill if(mode.sg_ispeed != mode.sg_ospeed) { 3221179Sbill prspeed("input speed ", mode.sg_ispeed); 3231179Sbill prspeed("output speed ", mode.sg_ospeed); 3241179Sbill } else 3251179Sbill prspeed("speed ", mode.sg_ispeed); 3261179Sbill fprintf(stderr, all==2 ? "\n" : "; "); 3271179Sbill m = mode.sg_flags; 3281179Sbill if(all==2 || (m&(EVENP|ODDP))!=(EVENP|ODDP)) { 3291179Sbill if(m & EVENP) fprintf(stderr,"even "); 3301179Sbill if(m & ODDP) fprintf(stderr,"odd "); 3311179Sbill } 3321179Sbill if(all==2 || m&RAW) 3331179Sbill fprintf(stderr,"-raw "+((m&RAW)!=0)); 3341179Sbill if(all==2 || (m&CRMOD)==0) 3351179Sbill fprintf(stderr,"-nl "+((m&CRMOD)==0)); 3361179Sbill if(all==2 || (m&ECHO)==0) 3371179Sbill fprintf(stderr,"-echo "+((m&ECHO)!=0)); 3381179Sbill if(all==2 || (m&LCASE)) 3391179Sbill fprintf(stderr,"-lcase "+((m&LCASE)!=0)); 3401179Sbill if(all==2 || (m&TANDEM)) 3411179Sbill fprintf(stderr,"-tandem "+((m&TANDEM)!=0)); 3421179Sbill fprintf(stderr,"-tabs "+((m&XTABS)!=XTABS)); 3431179Sbill if(all==2 || (m&CBREAK)) 3441179Sbill fprintf(stderr,"-cbreak "+((m&CBREAK)!=0)); 3451179Sbill if(all==2 || (m&NLDELAY)) 3461179Sbill delay((m&NLDELAY)/NL1, "nl"); 3471179Sbill if ((m&TBDELAY)!=XTABS) 3481179Sbill delay((m&TBDELAY)/TAB1, "tab"); 3491179Sbill if(all==2 || (m&CRDELAY)) 3501179Sbill delay((m&CRDELAY)/CR1, "cr"); 3511179Sbill if(all==2 || (m&VTDELAY)) 3521179Sbill delay((m&VTDELAY)/FF1, "ff"); 3531179Sbill if(all==2 || (m&BSDELAY)) 3541179Sbill delay((m&BSDELAY)/BS1, "bs"); 3551179Sbill if (all) 3561179Sbill fprintf(stderr,"\n"); 3571179Sbill #define lpit(what,str) \ 3581179Sbill if (all==2||(lmode&what)) { \ 3591179Sbill fprintf(stderr,str+((lmode&what)!=0)); any++; \ 3601179Sbill } 3611179Sbill if (ldisc == NTTYDISC) { 3621179Sbill int newcrt = (lmode&(LCTLECH|LCRTBS)) == (LCTLECH|LCRTBS) && 3631179Sbill (lmode&(LCRTERA|LCRTKIL)) == 3641179Sbill ((mode.sg_ospeed > B300) ? LCRTERA|LCRTKIL : 0); 3651179Sbill if (newcrt) { 3661179Sbill if (all==2) 3671402Sbill fprintf(stderr, "crt: (crtbs crterase crtkill ctlecho) "); 3681179Sbill else 3691402Sbill fprintf(stderr, "crt "); 3701179Sbill any++; 3711179Sbill } else { 3721179Sbill lpit(LCRTBS, "-crtbs "); 3731179Sbill lpit(LCRTERA, "-crterase "); 3741179Sbill lpit(LCRTKIL, "-crtkill "); 3751179Sbill lpit(LCTLECH, "-ctlecho "); 3761179Sbill lpit(LPRTERA, "-prterase "); 3771179Sbill } 3781179Sbill lpit(LTOSTOP, "-tostop "); 3791179Sbill lpit(LINTRUP, "-intrup "); 3801179Sbill if (all==2) { 3811179Sbill fprintf(stderr, "\n"); 3821179Sbill any = 0; 3831179Sbill } 3841179Sbill lpit(LTILDE, "-tilde "); 3851179Sbill lpit(LFLUSHO, "-flusho "); 3861179Sbill lpit(LMDMBUF, "-mdmbuf "); 3871179Sbill lpit(LLITOUT, "-litout "); 3881179Sbill lpit(LNOHANG, "-nohang "); 3891179Sbill lpit(LETXACK, "-etxack "); 3901179Sbill lpit(LPENDIN, "-pendin "); 3911179Sbill if (any) 3921179Sbill fprintf(stderr,"\n"); 3931179Sbill } else if (!all) 3941179Sbill fprintf(stderr,"\n"); 3951179Sbill if (all) { 3961179Sbill switch (ldisc) { 3971179Sbill 3981179Sbill case 0: 3991179Sbill fprintf(stderr,"\ 4001179Sbill erase kill intr quit stop eof\ 4011179Sbill \n"); 4021179Sbill pcol(mode.sg_erase, -1); 4031179Sbill pcol(mode.sg_kill, -1); 4041179Sbill pcol(tc.t_intrc, -1); 4051179Sbill pcol(tc.t_quitc, -1); 4061179Sbill pcol(tc.t_stopc, tc.t_startc); 4071179Sbill pcol(tc.t_eofc, tc.t_brkc); 4081179Sbill fprintf(stderr,"\n"); 4091179Sbill break; 4101179Sbill 4111179Sbill case NTTYDISC: 4121179Sbill fprintf(stderr,"\ 4131179Sbill erase kill werase rprnt flush lnext susp intr quit stop eof\ 4141179Sbill \n"); 4151179Sbill pcol(mode.sg_erase, -1); 4161179Sbill pcol(mode.sg_kill, -1); 4171179Sbill pcol(ltc.t_werasc, -1); 4181179Sbill pcol(ltc.t_rprntc, -1); 4191179Sbill pcol(ltc.t_flushc, -1); 4201179Sbill pcol(ltc.t_lnextc, -1); 4211179Sbill pcol(ltc.t_suspc, ltc.t_dsuspc); 4221179Sbill pcol(tc.t_intrc, -1); 4231179Sbill pcol(tc.t_quitc, -1); 4241179Sbill pcol(tc.t_stopc, tc.t_startc); 4251179Sbill pcol(tc.t_eofc, tc.t_brkc); 4261179Sbill fprintf(stderr,"\n"); 4271179Sbill break; 4281179Sbill } 4291179Sbill } else if (ldisc != NETLDISC) { 4301179Sbill register struct special *sp; 4311179Sbill int first = 1; 4321179Sbill for (sp = special; sp->name; sp++) { 4331179Sbill if ((*sp->cp&0377) != (sp->def&0377)) { 4341179Sbill pit(*sp->cp, sp->name, first ? "" : ", "); 4351179Sbill first = 0; 4361179Sbill }; 4371179Sbill if (sp->cp == &tc.t_brkc && ldisc == 0) 4381179Sbill break; 4391179Sbill } 4401179Sbill if (first == 0) 4411179Sbill fprintf(stderr, "\n"); 4421179Sbill } 4431179Sbill } 4441179Sbill 4451179Sbill pcol(ch1, ch2) 4461179Sbill int ch1, ch2; 4471179Sbill { 4481179Sbill int nout = 0; 4491179Sbill 4501179Sbill ch1 &= 0377; 4511179Sbill ch2 &= 0377; 4521179Sbill if (ch1 == ch2) 4531179Sbill ch2 = 0377; 4541179Sbill for (; ch1 != 0377 || ch2 != 0377; ch1 = ch2, ch2 = 0377) { 4551179Sbill if (ch1 == 0377) 4561179Sbill continue; 4571179Sbill if (ch1 & 0200) { 4581179Sbill fprintf(stderr, "M-"); 4591179Sbill nout += 2; 4601179Sbill ch1 &= ~ 0200; 4611179Sbill } 4621179Sbill if (ch1 == 0177) { 4631179Sbill fprintf(stderr, "^"); 4641179Sbill nout++; 4651179Sbill ch1 = '?'; 4661179Sbill } else if (ch1 < ' ') { 4671179Sbill fprintf(stderr, "^"); 4681179Sbill nout++; 4691179Sbill ch1 += '@'; 4701179Sbill } 4711179Sbill fprintf(stderr, "%c", ch1); 4721179Sbill nout++; 4731179Sbill if (ch2 != 0377) { 4741179Sbill fprintf(stderr, "/"); 4751179Sbill nout++; 4761179Sbill } 4771179Sbill } 4781179Sbill while (nout < 7) { 4791179Sbill fprintf(stderr, " "); 4801179Sbill nout++; 4811179Sbill } 4821179Sbill } 4831179Sbill 4841179Sbill pit(what, itsname, sep) 4851179Sbill unsigned what; 4861179Sbill char *itsname, *sep; 4871179Sbill { 4881179Sbill 4891179Sbill what &= 0377; 4901179Sbill fprintf(stderr, "%s%s", sep, itsname); 4911179Sbill if (what == 0377) { 4921179Sbill fprintf(stderr, " <undef>"); 4931179Sbill return; 4941179Sbill } 4951179Sbill fprintf(stderr, " = "); 4961179Sbill if (what & 0200) { 4971179Sbill fprintf(stderr, "M-"); 4981179Sbill what &= ~ 0200; 4991179Sbill } 5001179Sbill if (what == 0177) { 5011179Sbill fprintf(stderr, "^"); 5021179Sbill what = '?'; 5031179Sbill } else if (what < ' ') { 5041179Sbill fprintf(stderr, "^"); 5051179Sbill what += '@'; 5061179Sbill } 5071179Sbill fprintf(stderr, "%c", what); 5081179Sbill } 5091179Sbill 5101179Sbill delay(m, s) 5111179Sbill char *s; 5121179Sbill { 5131179Sbill 5141179Sbill if(m) 5151179Sbill fprintf(stderr,"%s%d ", s, m); 5161179Sbill } 5171179Sbill 5181179Sbill int speed[] = { 5191179Sbill 0,50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,0,0 5201179Sbill }; 5211179Sbill 5221179Sbill prspeed(c, s) 5231179Sbill char *c; 5241179Sbill { 5251179Sbill 5261179Sbill fprintf(stderr,"%s%d baud", c, speed[s]); 5271179Sbill } 528