mdoc version three plus some changes by bostic (cael)
[unix-history] / usr / src / bin / stty / stty.1
CommitLineData
daacd5f0
CL
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
f899fcd3 3.\"
daacd5f0 4.\" %sccs.include.redist.man%
f899fcd3 5.\"
d3da8ba2 6.\" @(#)stty.1 6.10 (Berkeley) %G%
daacd5f0
CL
7.\"
8.Dd
9.Dt STTY 1
ee9b0a0a 10.Os
daacd5f0
CL
11.Sh NAME
12.Nm stty
11bf6c15 13.Nd set the options for a terminal device interface
daacd5f0
CL
14.Sh SYNOPSIS
15.Nm stty
d3da8ba2
KB
16.Op Fl a | Fl e | Fl g
17.Op Fl f Ar file
18.Op operands
daacd5f0 19.Sh DESCRIPTION
d3da8ba2
KB
20The
21.Nm stty
22utility sets or reports on terminal
23.Tn I/O
daacd5f0 24characteristics for the device that is its standard input.
d3da8ba2
KB
25If no options or operands are specified, it reports the
26settings of certain characteristics if they differ
27from their default values.
daacd5f0
CL
28Otherwise it modifies
29the terminal state according to the specified arguments.
30Some combinations of arguments are mutually
31exclusive on some terminal types.
32.Pp
33The following options are available:
d3da8ba2
KB
34.Bl -tag -width Ds
35.It Fl a
36Display all the current settings for the terminal to standard output
37in the
38.St -p1003.2 .
39.It Fl e
40Display all the current settings for the terminal to standard output
41in the traditional
42.Tn BSD
43``all'' and ``everything'' formats.
44.It Fl f
45Display the current settings for the terminal named by
46.Ar file .
47.It Fl g
48Display all the current settings for the terminal to standard output
49in a form that may be used as an argument to another invocation of
50.Nm stty .
51.El
daacd5f0
CL
52.Pp
53The following arguments are available to set the terminal
54characteristics:
d3da8ba2
KB
55.Bl -tag -width Fl
56.It Cm parenb Pq Fl parenb
daacd5f0
CL
57Enable (disable) parity generation
58and detection.
d3da8ba2 59.It Cm parodd Pq Fl parodd
daacd5f0 60Select odd (even) parity.
d3da8ba2 61.It Cm cs5 cs6 cs7 cs8
daacd5f0 62Select character size, if possible.
d3da8ba2 63.It Ar number
daacd5f0
CL
64Set terminal baud rate to the
65number given, if possible.
66If the
67baud rate is set to zero, modem
68control is no longer
69asserted.
d3da8ba2 70.It Cm ispeed Ar number
daacd5f0
CL
71Set terminal input baud rate to the
72number given, if possible.
73If the
74input baud rate is set to zero, the
75input baud rate is set to the
76value of the output baud
77rate.
d3da8ba2 78.It Cm ospeed Ar number
daacd5f0
CL
79Set terminal output baud rate to
80the number given, if possible.
81If
82the output baud rate is set to
83zero, modem control is
84no longer asserted.
d3da8ba2 85.It Cm hupcl Pq Fl hupcl
daacd5f0
CL
86Stop asserting modem control
87(do not stop asserting modem control) on last close.
d3da8ba2 88.It Cm hup Pq Fl hup
daacd5f0 89Same as hupcl
d3da8ba2
KB
90.Pq Fl hupcl .
91.It Cm cstopb Pq Fl cstopb
daacd5f0 92Use two (one) stop bits per character.
d3da8ba2 93.It Cm cread Pq Fl cread
daacd5f0 94Enable (disable) the receiver.
d3da8ba2 95.It Cm clocal Pq Fl clocal
daacd5f0
CL
96Assume a line without (with) modem
97control.
d3da8ba2 98.It Cm ignbrk Pq Fl ignbrk
daacd5f0
CL
99Ignore (do not ignore) break on
100input.
d3da8ba2
KB
101.It Cm brkint Pq Fl brkint
102Signal (do not signal)
103.Dv INTR
104on
daacd5f0 105break.
d3da8ba2 106.It Cm ignpar Pq Fl ignpar
daacd5f0
CL
107Ignore (do not ignore) parity
108errors.
d3da8ba2 109.It Cm parmrk Pq Fl parmrk
daacd5f0 110Mark (do not mark) parity errors.
d3da8ba2 111.It Cm inpck Pq Fl inpck
daacd5f0
CL
112Enable (disable) input parity
113checking.
d3da8ba2 114.It Cm istrip Pq Fl istrip
daacd5f0
CL
115Strip (do not strip) input characters
116to seven bits.
d3da8ba2
KB
117.It Cm inlcr Pq Fl inlcr
118Map (do not map)
119.Dv NL
120to
121.Dv CR
122on input.
123.It Cm igncr Pq Fl igncr
124Ignore (do not ignore)
125.Dv CR
126on input.
127.It Cm icrnl Pq Fl icrnl
128Map (do not map)
129.Dv CR
130to
131.Dv NL
132on input.
133.It Cm ixon Pq Fl ixon
134Enable (disable)
135.Dv START/STOP
136output
daacd5f0
CL
137control.
138Output from the system is
139stopped when the system receives
d3da8ba2
KB
140.Dv STOP
141and started when the system
142receives
143.Dv START .
144.It Cm ixoff Pq Fl ixoff
daacd5f0 145Request that the system send (not
d3da8ba2
KB
146send)
147.Dv START/STOP
148characters when
daacd5f0
CL
149the input queue is nearly
150empty/full.
d3da8ba2 151.It Cm opost Pq Fl opost
daacd5f0
CL
152Post-process output (do not
153post-process output; ignore all other
154output modes).
d3da8ba2 155.It Cm isig Pq Fl isig
daacd5f0
CL
156Enable (disable) the checking of
157characters against the special control
d3da8ba2
KB
158characters
159.Dv INTR , QUIT ,
160and
161.Dv SUSP .
162.It Cm icanon Pq Fl icanon
daacd5f0 163Enable (disable) canonical input
d3da8ba2
KB
164.Pf ( Dv ERASE
165and
166.Dv KILL
167processing).
168.It Cm iexten Pq Fl iexten
daacd5f0
CL
169Enable (disable) any implementation
170defined special control characters
171not currently controlled by icanon,
172isig, or ixon.
d3da8ba2 173.It Cm echo Pq Fl echo
daacd5f0
CL
174Echo back (do not echo back) every
175character typed.
d3da8ba2
KB
176.It Cm echoe Pq Fl echoe
177The
178.Dv ERASE
179character shall (shall
daacd5f0
CL
180not) visually erase the last character
181in the current line from the
182display, if possible.
d3da8ba2
KB
183.It Cm echok Pq Fl echok
184Echo (do not echo)
185.Dv NL
186after
187.Dv KILL
daacd5f0 188character.
d3da8ba2
KB
189.It Cm echonl Pq Fl echonl
190Echo (do not echo)
191.Dv NL ,
192even if echo
daacd5f0 193is disabled.
d3da8ba2
KB
194.It Cm noflsh Pq Fl noflsh
195Disable (enable) flush after
196.Dv INTR , QUIT , SUSP .
197.It Cm control-character Ar string
daacd5f0
CL
198Set control-character to string.
199If string is a single character,
200the control character is set to
201that character.
202If string is the
203two character sequence "^-" or the
204string "undef" the control character
d3da8ba2
KB
205is set to
206.Pf { Dv _POSIX_VDISABLE Ns }
207if
daacd5f0 208it is in effect for the device; if
d3da8ba2
KB
209.Pf { Dv _POSIX_VDISABLE Ns }
210is not in effect
daacd5f0
CL
211for the device, it is an
212error.
213.Pp
214Recognized control-characters:
d3da8ba2
KB
215.Bd -ragged -offset indent
216.Bl -column character Subscript
217.It control- Ta Tn POSIX.1
218.It character Subscript Description
219.It _________ _________ _______________
220.It eof Ta Tn VEOF EOF No character
221.It eol Ta Tn VEOL EOL No character
222.It erase Ta Tn VERASE ERASE No character
223.It intr Ta Tn VINTR INTR No character
224.It kill Ta Tn VKILL KILL No character
225.It quit Ta Tn VQUIT QUIT No character
226.It susp Ta Tn VSUSP SUSP No character
227.It start Ta Tn VSTART START No character
228.It stop Ta Tn VSTOP STOP No character
229.El
230.Ed
231.It Cm saved settings
daacd5f0
CL
232Set the current terminal
233characteristics to the saved settings
11bf6c15
MK
234produced by the
235.Fl g
236option.
d3da8ba2
KB
237.It Cm min Ar number
238.It Cm time Ar number
daacd5f0
CL
239Set the value of min or time to
240number.
d3da8ba2
KB
241.Dv MIN
242and
243.Dv TIME
244are used in
daacd5f0
CL
245Non-Canonical mode input processing
246(-icanon).
d3da8ba2 247.It Cm evenp No or Cm parity
daacd5f0
CL
248Enable parenb and cs7; disable
249parodd.
d3da8ba2 250.It Cm oddp
daacd5f0 251Enable parenb, cs7, and parodd.
d3da8ba2 252.It Fl parity , evenp , oddp
daacd5f0 253Disable parenb, and set cs8.
d3da8ba2 254.It Cm nl Pq Fl nl
daacd5f0
CL
255Enable (disable) icrnl.
256In addition
257-nl unsets inlcr and igncr.
d3da8ba2
KB
258.It Cm ek
259Reset
260.Dv ERASE
261and
262.Dv KILL
263characters
daacd5f0 264back to system defaults.
d3da8ba2 265.It Cm sane
11bf6c15 266Resets all modes to reasonable values for interactive terminal use.
d3da8ba2
KB
267.It Cm tty
268Set the line discipline to the standard terminal line discipline
269.Dv TTYDISC .
270.El
daacd5f0 271.Pp
11bf6c15
MK
272If the
273.Fl g
274option is specified, stty writes to standard output
daacd5f0
CL
275the current settings in a form that can be used as arguments
276to another instance of stty on the same system.
277.Pp
11bf6c15
MK
278If the
279.Fl a
280option is specified, all of the information about the current setting
281is written to standard output
282in the same format described for the arguments above.
283Unless otherwise specified, this information is displayed as
284<space>-separated tokens, on one or
285more lines, with one or more tokens per line.
daacd5f0 286.Pp
11bf6c15
MK
287If no options are specified, a subset of the
288information displayed for the
289.Fl a
290option is displayed.
daacd5f0
CL
291.Pp
292If the terminal input speed and output speed are the same,
293the speed information is displayed as follows:
d3da8ba2 294.Bd -ragged -offset indent
daacd5f0 295"speed %d baud;", <speed>
d3da8ba2 296.Ed
5325ced3 297.Pp
daacd5f0
CL
298Otherwise speeds are displayed as:
299.Pp
d3da8ba2 300.Bd -ragged -offset indent
daacd5f0 301"ispeed %d baud; ospeed %d baud;", <ispeed>, <ospeed>
d3da8ba2 302.Ed
5325ced3 303.Pp
daacd5f0
CL
304Control characters are displayed as:
305.Pp
d3da8ba2 306.Bd -ragged -offset indent
daacd5f0 307"%s = %s;", <control-character name>, <value>
d3da8ba2 308.Ed
5325ced3 309.Pp
daacd5f0
CL
310where value is either the character, or some visual
311representation of the character if it is non-printing, or
312the string "<undef>" if the character is disabled.
313.Pp
314The
315.Nm stty
316utility exits with one of the following values:
d3da8ba2
KB
317.Bl -tag -width indent
318.It Li \&0
daacd5f0 319The terminal options were read or set successfully.
d3da8ba2 320.It Li \&>0
daacd5f0 321An error occurred.
d3da8ba2 322.El
daacd5f0
CL
323.Sh SEE ALSO
324.Xr stty 4
325.Sh STANDARDS
326The
327.Nm stty
d3da8ba2
KB
328function is expected to be
329.St -p1003.2
330compatible.