static char *sccsid
="@(#)stty.c 4.10 (Berkeley) %G%";
{ "-tandem", 0, TANDEM
},
{ "-cbreak", 0, CBREAK
},
{ "tty33", CR1
, ALLDELAY
},
{ "37", FF1
+CR2
+TAB1
+NL1
, ALLDELAY
},
{ "tty37", FF1
+CR2
+TAB1
+NL1
, ALLDELAY
},
{ "vt05", NL2
, ALLDELAY
},
{ "tn300", CR1
, ALLDELAY
},
{ "ti700", CR2
, ALLDELAY
},
{ "tek", FF1
, ALLDELAY
},
{ "crtbs", CRTBS
, PRTERA
},
{ "prterase", PRTERA
, CRTBS
+CRTKIL
+CRTERA
},
{ "-prterase", 0, PRTERA
},
{ "crterase", CRTERA
, PRTERA
},
{ "-crterase", 0, CRTERA
},
{ "crtkill", CRTKIL
, PRTERA
},
{ "-crtkill", 0, CRTKIL
},
{ "-mdmbuf", 0, MDMBUF
},
{ "-litout", 0, LITOUT
},
{ "-tostop", 0, TOSTOP
},
{ "-flusho", 0, FLUSHO
},
{ "-nohang", 0, NOHANG
},
{ "-etxack", 0, ETXACK
},
{ "ctlecho", CTLECH
, 0 },
{ "-ctlecho", 0, CTLECH
},
{ "-pendin", 0, PENDIN
},
{ "decctlq", DECCTQ
, 0 },
{ "-decctlq", 0, DECCTQ
},
{ "-noflsh", 0, NOFLSH
},
{ "erase", &tc
.tc_erase
, CERASE
},
{ "kill", &tc
.tc_kill
, CKILL
},
{ "intr", &tc
.tc_intrc
, CINTR
},
{ "quit", &tc
.tc_quitc
, CQUIT
},
{ "start", &tc
.tc_startc
, CSTART
},
{ "stop", &tc
.tc_stopc
, CSTOP
},
{ "eof", &tc
.tc_eofc
, CEOF
},
{ "brk", &tc
.tc_brkc
, CBRK
},
{ "susp", &tc
.tc_suspc
, CSUSP
},
{ "dsusp", &tc
.tc_dsuspc
, CDSUSP
},
{ "rprnt", &tc
.tc_rprntc
, CRPRNT
},
{ "flush", &tc
.tc_flushc
, CFLUSH
},
{ "werase", &tc
.tc_werasc
, CWERASE
},
{ "lnext", &tc
.tc_lnextc
, CLNEXT
},
register struct special
*sp
;
ioctl(1, TIOCCGET
, (char *)&tc
);
ioctl(1, TIOCGET
, (char *)&flags
);
ioctl(1, TIOCGETD
, &ldisc
);
ioctl(1, TIOCGETP
, (char *)&sb
);
if (argc
== 2 && !strcmp(argv
[1], "all")) {
if (argc
== 2 && !strcmp(argv
[1], "everything")) {
if (ioctl(1, TIOCSETD
, &ldisc
) < 0)
if (sb
.sg_ospeed
>= B1200
)
if (ioctl(1, TIOCSETD
, &ldisc
) < 0)
if (sb
.sg_ospeed
>= B1200
)
if (ioctl(1, TIOCSETD
, &ldisc
) < 0)
flags
|= CRTBS
|CTLECH
|DECCTQ
;
if (sb
.sg_ospeed
>= B1200
)
if (ioctl(1, TIOCSETD
, &ldisc
) < 0)
for (sp
= special
; sp
->name
; sp
++)
*sp
->cp
= ((*argv
)[1] == '?') ?
if (ioctl(1, TIOCHPCL
, NULL
) < 0)
for (i
= 0; speeds
[i
].string
; i
++)
if (eq(speeds
[i
].string
)) {
sb
.sg_ispeed
= sb
.sg_ospeed
= speeds
[i
].speed
;
int fd
= open("/dev/tty", 0);
ioctl(fd
, TIOCGETP
, &sb
);
for (i
= 0; speeds
[i
].string
; i
++)
if (sb
.sg_ospeed
== speeds
[i
].speed
) {
printf("%s\n", speeds
[i
].string
);
for (i
= 0; modes
[i
].string
; i
++)
if (eq(modes
[i
].string
)) {
flags
&= ~modes
[i
].reset
;
fprintf(stderr
,"unknown mode: %s\n", arg
);
ioctl(1, TIOCSET
, &flags
);
fprintf(stderr
, "net discipline, ");
else if (ldisc
== NTTYDISC
)
fprintf(stderr
, "new tty, ");
fprintf(stderr
, "old tty, ");
if(sb
.sg_ispeed
!= sb
.sg_ospeed
) {
prspeed("input speed ", sb
.sg_ispeed
);
prspeed("output speed ", sb
.sg_ospeed
);
prspeed("speed ", sb
.sg_ispeed
);
fprintf(stderr
, all
== 2 ? "\n" : "; ");
if (all
== 2 || (m
&(EVENP
|ODDP
)) != (EVENP
|ODDP
)) {
fprintf(stderr
,"-raw " + ((m
&RAW
) != 0));
if (all
== 2 || (m
&CRMOD
) == 0)
fprintf(stderr
,"-nl " + ((m
&CRMOD
) == 0));
if (all
== 2 || (m
&ECHO
) == 0)
fprintf(stderr
,"-echo " + ((m
&ECHO
) != 0));
fprintf(stderr
,"-lcase " + ((m
&LCASE
) != 0));
if (all
== 2 || m
&TANDEM
)
fprintf(stderr
,"-tandem " + ((m
&TANDEM
) != 0));
fprintf(stderr
,"-tabs " + ((m
&XTABS
) != XTABS
));
if (all
== 2 || m
&CBREAK
)
fprintf(stderr
,"-cbreak " + ((m
&CBREAK
) != 0));
if (all
== 2 || m
&NLDELAY
)
delay((m
&NLDELAY
) / NL1
, "nl");
if ((m
&TBDELAY
) != XTABS
)
delay((m
&TBDELAY
)/ TAB1
, "tab");
if (all
== 2 || m
&CRDELAY
)
delay((m
&CRDELAY
) / CR1
, "cr");
if (all
== 2 || m
&VTDELAY
)
delay((m
&VTDELAY
) / FF1
, "ff");
if (all
== 2 || m
&BSDELAY
)
delay((m
&BSDELAY
) / BS1
, "bs");
if (all == 2 || flags&what) { \
fprintf(stderr,str + ((flags&what) != 0)); any++; \
int newcrt
= (flags
&(CTLECH
|CRTBS
)) == (CTLECH
|CRTBS
) &&
(flags
&(CRTERA
|CRTKIL
)) ==
((sb
.sg_ospeed
> B300
) ? CRTERA
|CRTKIL
: 0);
fprintf(stderr
, all
!= 2 ? "crt" :
"crt: (crtbs crterase crtkill ctlecho) ");
lpit(CRTERA
, "-crterase ");
lpit(CRTKIL
, "-crtkill ");
lpit(CTLECH
, "-ctlecho ");
lpit(PRTERA
, "-prterase ");
lpit(TOSTOP
, "-tostop ");
lpit(FLUSHO
, "-flusho ");
lpit(MDMBUF
, "-mdmbuf ");
lpit(LITOUT
, "-litout ");
lpit(NOHANG
, "-nohang ");
lpit(ETXACK
, "-etxack ");
lpit(PENDIN
, "-pendin ");
lpit(DECCTQ
, "-decctlq ");
lpit(NOFLSH
, "-noflsh ");
erase kill intr quit stop eof\
pcol(tc
.tc_stopc
, tc
.tc_startc
);
pcol(tc
.tc_eofc
, tc
.tc_brkc
);
erase kill werase rprnt flush lnext susp intr quit stop eof\
pcol(tc
.tc_suspc
, tc
.tc_dsuspc
);
pcol(tc
.tc_stopc
, tc
.tc_startc
);
pcol(tc
.tc_eofc
, tc
.tc_brkc
);
} else if (ldisc
!= NETLDISC
) {
register struct special
*sp
;
for (sp
= special
; sp
->name
; sp
++) {
if ((*sp
->cp
&0377) != (sp
->def
&0377)) {
pit(*sp
->cp
, sp
->name
, first
? "" : ", ");
if (sp
->cp
== &tc
.tc_brkc
&& ldisc
== 0)
for (; ch1
!= 0377 || ch2
!= 0377; ch1
= ch2
, ch2
= 0377) {
fprintf(stderr
, "%c", ch1
);
fprintf(stderr
, "%s%s", sep
, itsname
);
fprintf(stderr
, " <undef>");
fprintf(stderr
, "%c", what
);
fprintf(stderr
,"%s%d ", s
, m
);
0,50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,19200,38400
fprintf(stderr
,"%s%d baud", c
, speed
[s
]);