1NAME
2    Change and print terminal line settings
3
4SYNOPSIS
5        # calling the script directly
6        stty.pl [setting...]
7        stty.pl {-a,-g,-v,--version}
8
9        # Calling Stty module
10        use IO::Stty;
11        IO::Stty::stty(\*TTYHANDLE, @modes);
12
13         use IO::Stty;
14         $old_mode=IO::Stty::stty(\*STDIN,'-g');
15
16         # Turn off echoing.
17         IO::Stty::stty(\*STDIN,'-echo');
18
19         # Do whatever.. grab input maybe?
20         $read_password = <>;
21
22         # Now restore the old mode.
23         IO::Stty::stty(\*STDIN,$old_mode);
24
25         # What settings do we have anyway?
26         print IO::Stty::stty(\*STDIN,'-a');
27
28DESCRIPTION
29    This is the PERL POSIX compliant stty.
30
31INTRO
32    This has not been tailored to the IO::File stuff but will work with it
33    as indicated. Before you go futzing with term parameters it's a good
34    idea to grab the current settings and restore them when you finish.
35
36    stty accepts the following non-option arguments that change aspects of
37    the terminal line operation. A `[-]' before a capability means that it
38    can be turned off by preceding it with a `-'.
39
40stty parameters
41  Control settings
42    [-]parenb
43        Generate parity bit in output and expect parity bit in input.
44
45    [-]parodd
46        Set odd parity (even with `-').
47
48    cs5 cs6 cs7 cs8
49        Set character size to 5, 6, 7, or 8 bits.
50
51    [-]hupcl [-]hup
52        Send a hangup signal when the last process closes the tty.
53
54    [-]cstopb
55        Use two stop bits per character (one with `-').
56
57    [-]cread
58        Allow input to be received.
59
60    [-]clocal
61        Disable modem control signals.
62
63  Input settings
64    [-]ignbrk
65        Ignore break characters.
66
67    [-]brkint
68        Breaks cause an interrupt signal.
69
70    [-]ignpar
71        Ignore characters with parity errors.
72
73    [-]parmrk
74        Mark parity errors (with a 255-0-character sequence).
75
76    [-]inpck
77        Enable input parity checking.
78
79    [-]istrip
80        Clear high (8th) bit of input characters.
81
82    [-]inlcr
83        Translate newline to carriage return.
84
85    [-]igncr
86        Ignore carriage return.
87
88    [-]icrnl
89        Translate carriage return to newline.
90
91    [-]ixon
92        Enable XON/XOFF flow control.
93
94    [-]ixoff
95        Enable sending of stop character when the system input buffer is
96        almost full, and start character when it becomes almost empty again.
97
98  Output settings
99    [-]opost
100        Postprocess output.
101
102  Local settings
103    [-]isig
104        Enable interrupt, quit, and suspend special characters.
105
106    [-]icanon
107        Enable erase, kill, werase, and rprnt special characters.
108
109    [-]echo
110        Echo input characters.
111
112    [-]echoe, [-]crterase
113        Echo erase characters as backspace-space-backspace.
114
115    [-]echok
116        Echo a newline after a kill character.
117
118    [-]echonl
119        Echo newline even if not echoing other characters.
120
121    [-]noflsh
122        Disable flushing after interrupt and quit special characters.
123
124        * Though this claims non-posixhood it is supported by the perl
125        POSIX.pm.
126
127    [-]tostop (np)
128        Stop background jobs that try to write to the terminal.
129
130  Combination settings
131    ek  Reset the erase and kill special characters to their default values.
132
133    sane
134        Same as:
135
136            cread -ignbrk brkint -inlcr -igncr icrnl -ixoff opost
137            isig icanon echo echoe echok -echonl -noflsh -tostop
138
139        also sets all special characters to their default values.
140
141    [-]cooked
142        Same as:
143
144            brkint ignpar istrip icrnl ixon opost isig icanon
145
146        plus sets the eof and eol characters to their default values if they
147        are the same as the min and time characters. With `-', same as raw.
148
149    [-]raw
150        Same as:
151
152            -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr
153            -icrnl -ixon -ixoff -opost -isig -icanon min 1 time 0
154
155        With `-', same as cooked.
156
157    [-]pass8
158        Same as:
159
160            -parenb -istrip cs8
161
162        With `-', same as parenb istrip cs7.
163
164    dec Same as:
165
166            echoe echoctl echoke -ixany
167
168        Also sets the interrupt special character to Ctrl-C, erase to Del,
169        and kill to Ctrl-U.
170
171  Special characters
172    The special characters' default values vary from system to system. They
173    are set with the syntax `name value', where the names are listed below
174    and the value can be given either literally, in hat notation (`^c'), or
175    as an integer which may start with `0x' to indicate hexadecimal, `0' to
176    indicate octal, or any other digit to indicate decimal. Giving a value
177    of `^-' or `undef' disables that special character.
178
179    intr
180        Send an interrupt signal.
181
182    quit
183        Send a quit signal.
184
185    erase
186        Erase the last character typed.
187
188    kill
189        Erase the current line.
190
191    eof Send an end of file (terminate the input).
192
193    eol End the line.
194
195    start
196        Restart the output after stopping it.
197
198    stop
199        Stop the output.
200
201    susp
202        Send a terminal stop signal.
203
204  Special settings
205    min N
206        Set the minimum number of characters that will satisfy a read until
207        the time value has expired, when <E>-icanon<E> is set.
208
209    time N
210        Set the number of tenths of a second before reads time out if the
211        min number of characters have not been read, when -icanon is set.
212
213    N   Set the input and output speeds to N. N can be one of: 0 50 75 110
214        134 134.5 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 exta
215        extb. exta is the same as 19200; extb is the same as 38400. 0 hangs
216        up the line if -clocal is set.
217
218  OPTIONS
219    -a  Print all current settings in human-readable form.
220
221    -g  Print all current settings in a form that can be used as an argument
222        to another stty command to restore the current settings.
223
224    -v,--version
225        Print version info.
226
227Direct Subroutines
228    stty()
229            IO::Stty::stty(\*STDIN, @params);
230
231        From comments:
232
233            I'm not feeling very inspired about this. Terminal parameters are obscure
234            and boring. Basically what this will do is get the current setting,
235            take the parameters, modify the setting and write it back. Zzzz.
236            This is not especially efficent and probably not too fast. Assuming the POSIX
237            spec has been implemented properly it should mostly work.
238
239    show_me_the_crap()
240        Needs documentation
241
242AUTHOR
243    Austin Schutz <auschutz@cpan.org> (Initial version and maintenance)
244
245    Todd Rinaldo <toddr@cpan.org> (Maintenance)
246
247BUGS
248    This is use at your own risk software. Do anything you want with it
249    except blame me for it blowing up your machine because it's full of
250    bugs.
251
252    See above for what functions are supported. It's mostly standard POSIX
253    stuff. If any of the settings are wrong and you actually know what some
254    of these extremely arcane settings (like what 'sane' should be in POSIX
255    land) really should be, please open an RT ticket.
256
257ACKNOWLEDGEMENTS
258    None
259
260COPYRIGHT & LICENSE
261    Copyright 1997 Austin Schutz, all rights reserved.
262
263    This program is free software; you can redistribute it and/or modify it
264    under the same terms as Perl itself.
265
266