static char *sccsid
="@(#)stty.c 4.9 (Berkeley) %G%";
"-LCASE", 0, LCASE
, 0, 0,
"-lcase", 0, LCASE
, 0, 0,
"tandem", TANDEM
, 0, 0, 0,
"-tandem", 0, TANDEM
, 0, 0,
"cbreak", CBREAK
, 0, 0, 0,
"-cbreak", 0, CBREAK
, 0, 0,
"tab0", TAB0
, XTABS
, 0, 0,
"tab1", TAB1
, XTABS
, 0, 0,
"tab2", TAB2
, XTABS
, 0, 0,
"33", CR1
, ALLDELAY
, 0, 0,
"tty33", CR1
, ALLDELAY
, 0, 0,
"37", FF1
+CR2
+TAB1
+NL1
, ALLDELAY
, 0, 0,
"tty37", FF1
+CR2
+TAB1
+NL1
, ALLDELAY
, 0, 0,
"05", NL2
, ALLDELAY
, 0, 0,
"vt05", NL2
, ALLDELAY
, 0, 0,
"tn", CR1
, ALLDELAY
, 0, 0,
"tn300", CR1
, ALLDELAY
, 0, 0,
"ti", CR2
, ALLDELAY
, 0, 0,
"ti700", CR2
, ALLDELAY
, 0, 0,
"tek", FF1
, ALLDELAY
, 0, 0,
"crtbs", 0, 0, LCRTBS
, LPRTERA
,
"-crtbs", 0, 0, 0, LCRTBS
,
"prterase", 0, 0, LPRTERA
, LCRTBS
+LCRTKIL
+LCRTERA
,
"-prterase", 0, 0, 0, LPRTERA
,
"crterase", 0, 0, LCRTERA
, LPRTERA
,
"-crterase", 0, 0, 0, LCRTERA
,
"crtkill", 0, 0, LCRTKIL
, LPRTERA
,
"-crtkill", 0, 0, 0, LCRTKIL
,
"tilde", 0, 0, LTILDE
, 0,
"-tilde", 0, 0, 0, LTILDE
,
"mdmbuf", 0, 0, LMDMBUF
, 0,
"-mdmbuf", 0, 0, 0, LMDMBUF
,
"litout", 0, 0, LLITOUT
, 0,
"-litout", 0, 0, 0, LLITOUT
,
"tostop", 0, 0, LTOSTOP
, 0,
"-tostop", 0, 0, 0, LTOSTOP
,
"flusho", 0, 0, LFLUSHO
, 0,
"-flusho", 0, 0, 0, LFLUSHO
,
"nohang", 0, 0, LNOHANG
, 0,
"-nohang", 0, 0, 0, LNOHANG
,
"etxack", 0, 0, LETXACK
, 0,
"-etxack", 0, 0, 0, LETXACK
,
"ctlecho", 0, 0, LCTLECH
, 0,
"-ctlecho", 0, 0, 0, LCTLECH
,
"pendin", 0, 0, LPENDIN
, 0,
"-pendin", 0, 0, 0, LPENDIN
,
"decctlq", 0, 0, LDECCTQ
, 0,
"-decctlq", 0, 0, 0, LDECCTQ
,
"noflsh", 0, 0, LNOFLSH
, 0,
"-noflsh", 0, 0, 0, LNOFLSH
,
#define CTRL(x) ('x'&037)
"erase", &mode
.sg_erase
, CTRL(h
),
"kill", &mode
.sg_kill
, '@',
"intr", &tc
.t_intrc
, 0177,
"quit", &tc
.t_quitc
, CTRL(\\\\),
"start", &tc
.t_startc
, CTRL(q
),
"stop", &tc
.t_stopc
, CTRL(s
),
"eof", &tc
.t_eofc
, CTRL(d
),
"susp", <c
.t_suspc
, CTRL(z
),
"dsusp", <c
.t_dsuspc
, CTRL(y
),
"rprnt", <c
.t_rprntc
, CTRL(r
),
"flush", <c
.t_flushc
, CTRL(o
),
"werase", <c
.t_werasc
, CTRL(w
),
"lnext", <c
.t_lnextc
, CTRL(v
),
register struct special
*sp
;
ioctl(1, TIOCGETD
, &ldisc
);
ioctl(1, TIOCLGET
, &lmode
);
ioctl(1, TIOCGLTC
, <c
);
if (argc
== 2 && !strcmp(argv
[1], "all")) {
if (argc
== 2 && !strcmp(argv
[1], "everything")) {
if (argc == 2 && !strcmp(argv[1], "all")) {
if (ioctl(1, TIOCSETD
, &ldisc
)<0)
if (mode
.sg_ospeed
>= B1200
)
lmode
|= LCRTERA
|LCRTKIL
;
if (ioctl(1, TIOCSETD
, &ldisc
)<0)
if (mode
.sg_ospeed
>= B1200
)
lmode
|= LCRTERA
|LCRTKIL
;
if (ioctl(1, TIOCSETD
, &ldisc
)<0)
lmode
|= LCRTBS
|LCTLECH
|LDECCTQ
;
if (mode
.sg_ospeed
>= B1200
)
lmode
|= LCRTERA
|LCRTKIL
;
if (ioctl(1, TIOCSETD
, &ldisc
)<0)
for (sp
= special
; sp
->name
; sp
++)
*sp
->cp
= ((*argv
)[1] == '?') ?
ioctl(1, TIOCHPCL
, NULL
);
for(i
=0; speeds
[i
].string
; i
++)
if(eq(speeds
[i
].string
)) {
mode
.sg_ispeed
= mode
.sg_ospeed
= speeds
[i
].speed
;
gtty(open("/dev/tty", 0), &mode
);
for(i
=0; speeds
[i
].string
; i
++)
if (mode
.sg_ospeed
== speeds
[i
].speed
) {
printf("%s\n", speeds
[i
].string
);
for(i
=0; modes
[i
].string
; i
++)
if(eq(modes
[i
].string
)) {
mode
.sg_flags
&= ~modes
[i
].reset
;
mode
.sg_flags
|= modes
[i
].set
;
lmode
&= ~modes
[i
].lreset
;
fprintf(stderr
,"unknown mode: %s\n", arg
);
ioctl(1, TIOCSETN
, &mode
);
ioctl(1, TIOCSLTC
, <c
);
ioctl(1, TIOCLSET
, &lmode
);
fprintf(stderr
, "net discipline, ");
fprintf(stderr
, "new tty, ");
fprintf(stderr
, "old tty, ");
if(mode
.sg_ispeed
!= mode
.sg_ospeed
) {
prspeed("input speed ", mode
.sg_ispeed
);
prspeed("output speed ", mode
.sg_ospeed
);
prspeed("speed ", mode
.sg_ispeed
);
fprintf(stderr
, all
==2 ? "\n" : "; ");
if(all
==2 || (m
&(EVENP
|ODDP
))!=(EVENP
|ODDP
)) {
if(m
& EVENP
) fprintf(stderr
,"even ");
if(m
& ODDP
) fprintf(stderr
,"odd ");
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));
fprintf(stderr
,"-tandem "+((m
&TANDEM
)!=0));
fprintf(stderr
,"-tabs "+((m
&XTABS
)!=XTABS
));
fprintf(stderr
,"-cbreak "+((m
&CBREAK
)!=0));
if(all
==2 || (m
&NLDELAY
))
delay((m
&NLDELAY
)/NL1
, "nl");
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||(lmode&what)) { \
fprintf(stderr,str+((lmode&what)!=0)); any++; \
int newcrt
= (lmode
&(LCTLECH
|LCRTBS
)) == (LCTLECH
|LCRTBS
) &&
(lmode
&(LCRTERA
|LCRTKIL
)) ==
((mode
.sg_ospeed
> B300
) ? LCRTERA
|LCRTKIL
: 0);
fprintf(stderr
, "crt: (crtbs crterase crtkill ctlecho) ");
lpit(LCRTERA
, "-crterase ");
lpit(LCRTKIL
, "-crtkill ");
lpit(LCTLECH
, "-ctlecho ");
lpit(LPRTERA
, "-prterase ");
lpit(LTOSTOP
, "-tostop ");
lpit(LFLUSHO
, "-flusho ");
lpit(LMDMBUF
, "-mdmbuf ");
lpit(LLITOUT
, "-litout ");
lpit(LNOHANG
, "-nohang ");
lpit(LETXACK
, "-etxack ");
lpit(LPENDIN
, "-pendin ");
lpit(LDECCTQ
, "-decctlq ");
lpit(LNOFLSH
, "-noflsh ");
erase kill intr quit stop eof\
pcol(tc
.t_stopc
, tc
.t_startc
);
pcol(tc
.t_eofc
, tc
.t_brkc
);
erase kill werase rprnt flush lnext susp intr quit stop eof\
pcol(ltc
.t_suspc
, ltc
.t_dsuspc
);
pcol(tc
.t_stopc
, tc
.t_startc
);
pcol(tc
.t_eofc
, tc
.t_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
.t_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
]);