home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pytexdoc / ext / lib / lib1 / termios / tex
LaTeX Document  |  1996-11-08  |  4.1 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file Python script text executable default (weak)
98% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 42 75 69 6c 74 2d 69 |\section|{Built-i|
|00000010| 6e 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |n Module| \sectco|
|00000020| 64 65 7b 74 65 72 6d 69 | 6f 73 7d 7d 0a 5c 62 69 |de{termi|os}}.\bi|
|00000030| 6d 6f 64 69 6e 64 65 78 | 7b 74 65 72 6d 69 6f 73 |modindex|{termios|
|00000040| 7d 0a 5c 69 6e 64 65 78 | 69 69 7b 50 6f 73 69 78 |}.\index|ii{Posix|
|00000050| 7d 7b 49 2f 4f 20 63 6f | 6e 74 72 6f 6c 7d 0a 5c |}{I/O co|ntrol}.\|
|00000060| 69 6e 64 65 78 69 69 7b | 74 74 79 7d 7b 49 2f 4f |indexii{|tty}{I/O|
|00000070| 20 63 6f 6e 74 72 6f 6c | 7d 0a 0a 5c 72 65 6e 65 | control|}..\rene|
|00000080| 77 63 6f 6d 6d 61 6e 64 | 7b 5c 69 6e 64 65 78 73 |wcommand|{\indexs|
|00000090| 75 62 69 74 65 6d 7d 7b | 28 69 6e 20 6d 6f 64 75 |ubitem}{|(in modu|
|000000a0| 6c 65 20 74 65 72 6d 69 | 6f 73 29 7d 0a 0a 54 68 |le termi|os)}..Th|
|000000b0| 69 73 20 6d 6f 64 75 6c | 65 20 70 72 6f 76 69 64 |is modul|e provid|
|000000c0| 65 73 20 61 6e 20 69 6e | 74 65 72 66 61 63 65 20 |es an in|terface |
|000000d0| 74 6f 20 74 68 65 20 50 | 6f 73 69 78 20 63 61 6c |to the P|osix cal|
|000000e0| 6c 73 20 66 6f 72 20 74 | 74 79 20 49 2f 4f 0a 63 |ls for t|ty I/O.c|
|000000f0| 6f 6e 74 72 6f 6c 2e 20 | 20 46 6f 72 20 61 20 63 |ontrol. | For a c|
|00000100| 6f 6d 70 6c 65 74 65 20 | 64 65 73 63 72 69 70 74 |omplete |descript|
|00000110| 69 6f 6e 20 6f 66 20 74 | 68 65 73 65 20 63 61 6c |ion of t|hese cal|
|00000120| 6c 73 2c 20 73 65 65 20 | 74 68 65 20 50 6f 73 69 |ls, see |the Posi|
|00000130| 78 20 6f 72 0a 5c 55 4e | 49 58 7b 7d 20 6d 61 6e |x or.\UN|IX{} man|
|00000140| 75 61 6c 20 70 61 67 65 | 73 2e 20 20 49 74 20 69 |ual page|s. It i|
|00000150| 73 20 6f 6e 6c 79 20 61 | 76 61 69 6c 61 62 6c 65 |s only a|vailable|
|00000160| 20 66 6f 72 20 74 68 6f | 73 65 20 5c 55 4e 49 58 | for tho|se \UNIX|
|00000170| 7b 7d 20 76 65 72 73 69 | 6f 6e 73 0a 74 68 61 74 |{} versi|ons.that|
|00000180| 20 73 75 70 70 6f 72 74 | 20 50 6f 73 69 78 20 5c | support| Posix \|
|00000190| 63 6f 64 65 7b 74 65 72 | 6d 69 6f 73 7d 20 73 74 |code{ter|mios} st|
|000001a0| 79 6c 65 20 74 74 79 20 | 49 2f 4f 20 63 6f 6e 74 |yle tty |I/O cont|
|000001b0| 72 6f 6c 20 28 61 6e 64 | 20 74 68 65 6e 0a 6f 6e |rol (and| then.on|
|000001c0| 6c 79 20 69 66 20 63 6f | 6e 66 69 67 75 72 65 64 |ly if co|nfigured|
|000001d0| 20 61 74 20 69 6e 73 74 | 61 6c 6c 61 74 69 6f 6e | at inst|allation|
|000001e0| 20 74 69 6d 65 29 2e 0a | 0a 41 6c 6c 20 66 75 6e | time)..|.All fun|
|000001f0| 63 74 69 6f 6e 73 20 69 | 6e 20 74 68 69 73 20 6d |ctions i|n this m|
|00000200| 6f 64 75 6c 65 20 74 61 | 6b 65 20 61 20 66 69 6c |odule ta|ke a fil|
|00000210| 65 20 64 65 73 63 72 69 | 70 74 6f 72 20 5c 76 61 |e descri|ptor \va|
|00000220| 72 7b 66 64 7d 20 61 73 | 20 74 68 65 69 72 0a 66 |r{fd} as| their.f|
|00000230| 69 72 73 74 20 61 72 67 | 75 6d 65 6e 74 2e 20 20 |irst arg|ument. |
|00000240| 54 68 69 73 20 6d 75 73 | 74 20 62 65 20 61 6e 20 |This mus|t be an |
|00000250| 69 6e 74 65 67 65 72 20 | 66 69 6c 65 20 64 65 73 |integer |file des|
|00000260| 63 72 69 70 74 6f 72 2c | 20 73 75 63 68 20 61 73 |criptor,| such as|
|00000270| 0a 72 65 74 75 72 6e 65 | 64 20 62 79 20 5c 63 6f |.returne|d by \co|
|00000280| 64 65 7b 73 79 73 2e 73 | 74 64 69 6e 2e 66 69 6c |de{sys.s|tdin.fil|
|00000290| 65 6e 6f 28 29 7d 2e 0a | 0a 54 68 69 73 20 6d 6f |eno()}..|.This mo|
|000002a0| 64 75 6c 65 20 73 68 6f | 75 6c 64 20 62 65 20 75 |dule sho|uld be u|
|000002b0| 73 65 64 20 69 6e 20 63 | 6f 6e 6a 75 6e 63 74 69 |sed in c|onjuncti|
|000002c0| 6f 6e 20 77 69 74 68 20 | 74 68 65 20 5c 63 6f 64 |on with |the \cod|
|000002d0| 65 7b 54 45 52 4d 49 4f | 53 7d 0a 6d 6f 64 75 6c |e{TERMIO|S}.modul|
|000002e0| 65 2c 20 77 68 69 63 68 | 20 64 65 66 69 6e 65 73 |e, which| defines|
|000002f0| 20 74 68 65 20 72 65 6c | 65 76 61 6e 74 20 73 79 | the rel|evant sy|
|00000300| 6d 62 6f 6c 69 63 20 63 | 6f 6e 73 74 61 6e 74 73 |mbolic c|onstants|
|00000310| 20 28 73 65 65 20 74 68 | 65 20 6e 65 78 74 0a 73 | (see th|e next.s|
|00000320| 65 63 74 69 6f 6e 29 2e | 0a 0a 54 68 65 20 6d 6f |ection).|..The mo|
|00000330| 64 75 6c 65 20 64 65 66 | 69 6e 65 73 20 74 68 65 |dule def|ines the|
|00000340| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 66 75 6e 63 74 | followi|ng funct|
|00000350| 69 6f 6e 73 3a 0a 0a 5c | 62 65 67 69 6e 7b 66 75 |ions:..\|begin{fu|
|00000360| 6e 63 64 65 73 63 7d 7b | 74 63 67 65 74 61 74 74 |ncdesc}{|tcgetatt|
|00000370| 72 7d 7b 66 64 7d 0a 52 | 65 74 75 72 6e 20 61 20 |r}{fd}.R|eturn a |
|00000380| 6c 69 73 74 20 63 6f 6e | 74 61 69 6e 69 6e 67 20 |list con|taining |
|00000390| 74 68 65 20 74 74 79 20 | 61 74 74 72 69 62 75 74 |the tty |attribut|
|000003a0| 65 73 20 66 6f 72 20 66 | 69 6c 65 20 64 65 73 63 |es for f|ile desc|
|000003b0| 72 69 70 74 6f 72 0a 5c | 76 61 72 7b 66 64 7d 2c |riptor.\|var{fd},|
|000003c0| 20 61 73 20 66 6f 6c 6c | 6f 77 73 3a 20 5c 63 6f | as foll|ows: \co|
|000003d0| 64 65 7b 5b 5c 76 61 72 | 7b 69 66 6c 61 67 7d 2c |de{[\var|{iflag},|
|000003e0| 20 5c 76 61 72 7b 6f 66 | 6c 61 67 7d 2c 20 5c 76 | \var{of|lag}, \v|
|000003f0| 61 72 7b 63 66 6c 61 67 | 7d 2c 0a 5c 76 61 72 7b |ar{cflag|},.\var{|
|00000400| 6c 66 6c 61 67 7d 2c 20 | 5c 76 61 72 7b 69 73 70 |lflag}, |\var{isp|
|00000410| 65 65 64 7d 2c 20 5c 76 | 61 72 7b 6f 73 70 65 65 |eed}, \v|ar{ospee|
|00000420| 64 7d 2c 20 5c 76 61 72 | 7b 63 63 7d 5d 7d 20 77 |d}, \var|{cc}]} w|
|00000430| 68 65 72 65 20 5c 76 61 | 72 7b 63 63 7d 20 69 73 |here \va|r{cc} is|
|00000440| 0a 61 20 6c 69 73 74 20 | 6f 66 20 74 68 65 20 74 |.a list |of the t|
|00000450| 74 79 20 73 70 65 63 69 | 61 6c 20 63 68 61 72 61 |ty speci|al chara|
|00000460| 63 74 65 72 73 20 28 65 | 61 63 68 20 61 20 73 74 |cters (e|ach a st|
|00000470| 72 69 6e 67 20 6f 66 20 | 6c 65 6e 67 74 68 20 31 |ring of |length 1|
|00000480| 2c 0a 65 78 63 65 70 74 | 20 74 68 65 20 69 74 65 |,.except| the ite|
|00000490| 6d 73 20 77 69 74 68 20 | 69 6e 64 69 63 65 73 20 |ms with |indices |
|000004a0| 5c 63 6f 64 65 7b 56 4d | 49 4e 7d 20 61 6e 64 20 |\code{VM|IN} and |
|000004b0| 5c 63 6f 64 65 7b 56 54 | 49 4d 45 7d 2c 20 77 68 |\code{VT|IME}, wh|
|000004c0| 69 63 68 20 61 72 65 0a | 69 6e 74 65 67 65 72 73 |ich are.|integers|
|000004d0| 20 77 68 65 6e 20 74 68 | 65 73 65 20 66 69 65 6c | when th|ese fiel|
|000004e0| 64 73 20 61 72 65 20 64 | 65 66 69 6e 65 64 29 2e |ds are d|efined).|
|000004f0| 20 20 54 68 65 20 69 6e | 74 65 72 70 72 65 74 61 | The in|terpreta|
|00000500| 74 69 6f 6e 20 6f 66 20 | 74 68 65 0a 66 6c 61 67 |tion of |the.flag|
|00000510| 73 20 61 6e 64 20 74 68 | 65 20 73 70 65 65 64 73 |s and th|e speeds|
|00000520| 20 61 73 20 77 65 6c 6c | 20 61 73 20 74 68 65 20 | as well| as the |
|00000530| 69 6e 64 65 78 69 6e 67 | 20 69 6e 20 74 68 65 20 |indexing| in the |
|00000540| 5c 76 61 72 7b 63 63 7d | 20 61 72 72 61 79 0a 6d |\var{cc}| array.m|
|00000550| 75 73 74 20 62 65 20 64 | 6f 6e 65 20 75 73 69 6e |ust be d|one usin|
|00000560| 67 20 74 68 65 20 73 79 | 6d 62 6f 6c 69 63 20 63 |g the sy|mbolic c|
|00000570| 6f 6e 73 74 61 6e 74 73 | 20 64 65 66 69 6e 65 64 |onstants| defined|
|00000580| 20 69 6e 20 74 68 65 0a | 5c 63 6f 64 65 7b 54 45 | in the.|\code{TE|
|00000590| 52 4d 49 4f 53 7d 20 6d | 6f 64 75 6c 65 2e 0a 5c |RMIOS} m|odule..\|
|000005a0| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 0a 0a 5c |end{func|desc}..\|
|000005b0| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|000005c0| 74 63 73 65 74 61 74 74 | 72 7d 7b 66 64 5c 2c 20 |tcsetatt|r}{fd\, |
|000005d0| 77 68 65 6e 5c 2c 20 61 | 74 74 72 69 62 75 74 65 |when\, a|ttribute|
|000005e0| 73 7d 0a 53 65 74 20 74 | 68 65 20 74 74 79 20 61 |s}.Set t|he tty a|
|000005f0| 74 74 72 69 62 75 74 65 | 73 20 66 6f 72 20 66 69 |ttribute|s for fi|
|00000600| 6c 65 20 64 65 73 63 72 | 69 70 74 6f 72 20 5c 76 |le descr|iptor \v|
|00000610| 61 72 7b 66 64 7d 20 66 | 72 6f 6d 20 74 68 65 0a |ar{fd} f|rom the.|
|00000620| 5c 76 61 72 7b 61 74 74 | 72 69 62 75 74 65 73 7d |\var{att|ributes}|
|00000630| 2c 20 77 68 69 63 68 20 | 69 73 20 61 20 6c 69 73 |, which |is a lis|
|00000640| 74 20 6c 69 6b 65 20 74 | 68 65 20 6f 6e 65 20 72 |t like t|he one r|
|00000650| 65 74 75 72 6e 65 64 20 | 62 79 0a 5c 63 6f 64 65 |eturned |by.\code|
|00000660| 7b 74 63 67 65 74 61 74 | 74 72 28 29 7d 2e 20 20 |{tcgetat|tr()}. |
|00000670| 54 68 65 20 5c 76 61 72 | 7b 77 68 65 6e 7d 20 61 |The \var|{when} a|
|00000680| 72 67 75 6d 65 6e 74 20 | 64 65 74 65 72 6d 69 6e |rgument |determin|
|00000690| 65 73 20 77 68 65 6e 20 | 74 68 65 0a 61 74 74 72 |es when |the.attr|
|000006a0| 69 62 75 74 65 73 20 61 | 72 65 20 63 68 61 6e 67 |ibutes a|re chang|
|000006b0| 65 64 3a 20 5c 63 6f 64 | 65 7b 54 45 52 4d 49 4f |ed: \cod|e{TERMIO|
|000006c0| 53 2e 54 43 53 41 4e 4f | 57 7d 20 74 6f 20 63 68 |S.TCSANO|W} to ch|
|000006d0| 61 6e 67 65 20 69 6d 6d | 65 64 69 61 74 65 6c 79 |ange imm|ediately|
|000006e0| 2c 0a 5c 63 6f 64 65 7b | 54 45 52 4d 49 4f 53 2e |,.\code{|TERMIOS.|
|000006f0| 54 43 53 41 44 52 41 49 | 4e 7d 20 74 6f 20 63 68 |TCSADRAI|N} to ch|
|00000700| 61 6e 67 65 20 61 66 74 | 65 72 20 74 72 61 6e 73 |ange aft|er trans|
|00000710| 6d 69 74 74 69 6e 67 20 | 61 6c 6c 20 71 75 65 75 |mitting |all queu|
|00000720| 65 64 0a 6f 75 74 70 75 | 74 2c 20 6f 72 20 5c 63 |ed.outpu|t, or \c|
|00000730| 6f 64 65 7b 54 45 52 4d | 49 4f 53 2e 54 43 53 41 |ode{TERM|IOS.TCSA|
|00000740| 46 4c 55 53 48 7d 20 74 | 6f 20 63 68 61 6e 67 65 |FLUSH} t|o change|
|00000750| 20 61 66 74 65 72 20 74 | 72 61 6e 73 6d 69 74 74 | after t|ransmitt|
|00000760| 69 6e 67 20 61 6c 6c 0a | 71 75 65 75 65 64 20 6f |ing all.|queued o|
|00000770| 75 74 70 75 74 20 61 6e | 64 20 64 69 73 63 61 72 |utput an|d discar|
|00000780| 64 69 6e 67 20 61 6c 6c | 20 71 75 65 75 65 64 20 |ding all| queued |
|00000790| 69 6e 70 75 74 2e 0a 5c | 65 6e 64 7b 66 75 6e 63 |input..\|end{func|
|000007a0| 64 65 73 63 7d 0a 0a 5c | 62 65 67 69 6e 7b 66 75 |desc}..\|begin{fu|
|000007b0| 6e 63 64 65 73 63 7d 7b | 74 63 73 65 6e 64 62 72 |ncdesc}{|tcsendbr|
|000007c0| 65 61 6b 7d 7b 66 64 5c | 2c 20 64 75 72 61 74 69 |eak}{fd\|, durati|
|000007d0| 6f 6e 7d 0a 53 65 6e 64 | 20 61 20 62 72 65 61 6b |on}.Send| a break|
|000007e0| 20 6f 6e 20 66 69 6c 65 | 20 64 65 73 63 72 69 70 | on file| descrip|
|000007f0| 74 6f 72 20 5c 76 61 72 | 7b 66 64 7d 2e 20 20 41 |tor \var|{fd}. A|
|00000800| 20 7a 65 72 6f 20 5c 76 | 61 72 7b 64 75 72 61 74 | zero \v|ar{durat|
|00000810| 69 6f 6e 7d 20 73 65 6e | 64 73 0a 61 20 62 72 65 |ion} sen|ds.a bre|
|00000820| 61 6b 20 66 6f 72 20 30 | 2e 32 35 2d 2d 30 2e 35 |ak for 0|.25--0.5|
|00000830| 20 73 65 63 6f 6e 64 73 | 3b 20 61 20 6e 6f 6e 7a | seconds|; a nonz|
|00000840| 65 72 6f 20 5c 76 61 72 | 7b 64 75 72 61 74 69 6f |ero \var|{duratio|
|00000850| 6e 7d 20 68 61 73 20 61 | 20 73 79 73 74 65 6d 0a |n} has a| system.|
|00000860| 64 65 70 65 6e 64 65 6e | 74 20 6d 65 61 6e 69 6e |dependen|t meanin|
|00000870| 67 2e 0a 5c 65 6e 64 7b | 66 75 6e 63 64 65 73 63 |g..\end{|funcdesc|
|00000880| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 66 75 6e 63 64 65 |}..\begi|n{funcde|
|00000890| 73 63 7d 7b 74 63 64 72 | 61 69 6e 7d 7b 66 64 7d |sc}{tcdr|ain}{fd}|
|000008a0| 0a 57 61 69 74 20 75 6e | 74 69 6c 20 61 6c 6c 20 |.Wait un|til all |
|000008b0| 6f 75 74 70 75 74 20 77 | 72 69 74 74 65 6e 20 74 |output w|ritten t|
|000008c0| 6f 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |o file d|escripto|
|000008d0| 72 20 5c 76 61 72 7b 66 | 64 7d 20 68 61 73 20 62 |r \var{f|d} has b|
|000008e0| 65 65 6e 0a 74 72 61 6e | 73 6d 69 74 74 65 64 2e |een.tran|smitted.|
|000008f0| 0a 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0a |.\end{fu|ncdesc}.|
|00000900| 0a 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|00000910| 7d 7b 74 63 66 6c 75 73 | 68 7d 7b 66 64 5c 2c 20 |}{tcflus|h}{fd\, |
|00000920| 71 75 65 75 65 7d 0a 44 | 69 73 63 61 72 64 20 71 |queue}.D|iscard q|
|00000930| 75 65 75 65 64 20 64 61 | 74 61 20 6f 6e 20 66 69 |ueued da|ta on fi|
|00000940| 6c 65 20 64 65 73 63 72 | 69 70 74 6f 72 20 5c 76 |le descr|iptor \v|
|00000950| 61 72 7b 66 64 7d 2e 20 | 20 54 68 65 20 5c 76 61 |ar{fd}. | The \va|
|00000960| 72 7b 71 75 65 75 65 7d | 0a 73 65 6c 65 63 74 6f |r{queue}|.selecto|
|00000970| 72 20 73 70 65 63 69 66 | 69 65 73 20 77 68 69 63 |r specif|ies whic|
|00000980| 68 20 71 75 65 75 65 3a | 20 5c 63 6f 64 65 7b 54 |h queue:| \code{T|
|00000990| 45 52 4d 49 4f 53 2e 54 | 43 49 46 4c 55 53 48 7d |ERMIOS.T|CIFLUSH}|
|000009a0| 20 66 6f 72 20 74 68 65 | 20 69 6e 70 75 74 0a 71 | for the| input.q|
|000009b0| 75 65 75 65 2c 20 5c 63 | 6f 64 65 7b 54 45 52 4d |ueue, \c|ode{TERM|
|000009c0| 49 4f 53 2e 54 43 4f 46 | 4c 55 53 48 7d 20 66 6f |IOS.TCOF|LUSH} fo|
|000009d0| 72 20 74 68 65 20 6f 75 | 74 70 75 74 20 71 75 65 |r the ou|tput que|
|000009e0| 75 65 2c 20 6f 72 0a 5c | 63 6f 64 65 7b 54 45 52 |ue, or.\|code{TER|
|000009f0| 4d 49 4f 53 2e 54 43 49 | 4f 46 4c 55 53 48 7d 20 |MIOS.TCI|OFLUSH} |
|00000a00| 66 6f 72 20 62 6f 74 68 | 20 71 75 65 75 65 73 2e |for both| queues.|
|00000a10| 0a 5c 65 6e 64 7b 66 75 | 6e 63 64 65 73 63 7d 0a |.\end{fu|ncdesc}.|
|00000a20| 0a 5c 62 65 67 69 6e 7b | 66 75 6e 63 64 65 73 63 |.\begin{|funcdesc|
|00000a30| 7d 7b 74 63 66 6c 6f 77 | 7d 7b 66 64 5c 2c 20 61 |}{tcflow|}{fd\, a|
|00000a40| 63 74 69 6f 6e 7d 0a 53 | 75 73 70 65 6e 64 20 6f |ction}.S|uspend o|
|00000a50| 72 20 72 65 73 75 6d 65 | 20 69 6e 70 75 74 20 6f |r resume| input o|
|00000a60| 72 20 6f 75 74 70 75 74 | 20 6f 6e 20 66 69 6c 65 |r output| on file|
|00000a70| 20 64 65 73 63 72 69 70 | 74 6f 72 20 5c 76 61 72 | descrip|tor \var|
|00000a80| 7b 66 64 7d 2e 20 20 54 | 68 65 0a 5c 76 61 72 7b |{fd}. T|he.\var{|
|00000a90| 61 63 74 69 6f 6e 7d 20 | 61 72 67 75 6d 65 6e 74 |action} |argument|
|00000aa0| 20 63 61 6e 20 62 65 20 | 5c 63 6f 64 65 7b 54 45 | can be |\code{TE|
|00000ab0| 52 4d 49 4f 53 2e 54 43 | 4f 4f 46 46 7d 20 74 6f |RMIOS.TC|OOFF} to|
|00000ac0| 20 73 75 73 70 65 6e 64 | 20 6f 75 74 70 75 74 2c | suspend| output,|
|00000ad0| 0a 5c 63 6f 64 65 7b 54 | 45 52 4d 49 4f 53 2e 54 |.\code{T|ERMIOS.T|
|00000ae0| 43 4f 4f 4e 7d 20 74 6f | 20 72 65 73 74 61 72 74 |COON} to| restart|
|00000af0| 20 6f 75 74 70 75 74 2c | 20 5c 63 6f 64 65 7b 54 | output,| \code{T|
|00000b00| 45 52 4d 49 4f 53 2e 54 | 43 49 4f 46 46 7d 20 74 |ERMIOS.T|CIOFF} t|
|00000b10| 6f 0a 73 75 73 70 65 6e | 64 20 69 6e 70 75 74 2c |o.suspen|d input,|
|00000b20| 20 6f 72 20 5c 63 6f 64 | 65 7b 54 45 52 4d 49 4f | or \cod|e{TERMIO|
|00000b30| 53 2e 54 43 49 4f 4e 7d | 20 74 6f 20 72 65 73 74 |S.TCION}| to rest|
|00000b40| 61 72 74 20 69 6e 70 75 | 74 2e 0a 5c 65 6e 64 7b |art inpu|t..\end{|
|00000b50| 66 75 6e 63 64 65 73 63 | 7d 0a 0a 5c 73 75 62 73 |funcdesc|}..\subs|
|00000b60| 65 63 74 69 6f 6e 7b 45 | 78 61 6d 70 6c 65 7d 0a |ection{E|xample}.|
|00000b70| 5c 6e 6f 64 65 6e 61 6d | 65 7b 74 65 72 6d 69 6f |\nodenam|e{termio|
|00000b80| 73 20 45 78 61 6d 70 6c | 65 7d 0a 0a 48 65 72 65 |s Exampl|e}..Here|
|00000b90| 27 73 20 61 20 66 75 6e | 63 74 69 6f 6e 20 74 68 |'s a fun|ction th|
|00000ba0| 61 74 20 70 72 6f 6d 70 | 74 73 20 66 6f 72 20 61 |at promp|ts for a|
|00000bb0| 20 70 61 73 73 77 6f 72 | 64 20 77 69 74 68 20 65 | passwor|d with e|
|00000bc0| 63 68 6f 69 6e 67 20 74 | 75 72 6e 65 64 20 6f 66 |choing t|urned of|
|00000bd0| 66 2e 0a 4e 6f 74 65 20 | 74 68 65 20 74 65 63 68 |f..Note |the tech|
|00000be0| 6e 69 71 75 65 20 75 73 | 69 6e 67 20 61 20 73 65 |nique us|ing a se|
|00000bf0| 70 61 72 61 74 65 20 5c | 63 6f 64 65 7b 74 65 72 |parate \|code{ter|
|00000c00| 6d 69 6f 73 2e 74 63 67 | 65 74 61 74 74 72 28 29 |mios.tcg|etattr()|
|00000c10| 7d 20 63 61 6c 6c 0a 61 | 6e 64 20 61 20 5c 63 6f |} call.a|nd a \co|
|00000c20| 64 65 7b 74 72 79 20 7b | 5c 6c 64 6f 74 73 7d 20 |de{try {|\ldots} |
|00000c30| 66 69 6e 61 6c 6c 79 7d | 20 73 74 61 74 65 6d 65 |finally}| stateme|
|00000c40| 6e 74 20 74 6f 20 65 6e | 73 75 72 65 20 74 68 61 |nt to en|sure tha|
|00000c50| 74 20 74 68 65 20 6f 6c | 64 20 74 74 79 0a 61 74 |t the ol|d tty.at|
|00000c60| 74 72 69 62 75 74 65 73 | 20 61 72 65 20 72 65 73 |tributes| are res|
|00000c70| 74 6f 72 65 64 20 65 78 | 61 63 74 6c 79 20 6e 6f |tored ex|actly no|
|00000c80| 20 6d 61 74 74 65 72 20 | 77 68 61 74 20 68 61 70 | matter |what hap|
|00000c90| 70 65 6e 73 3a 0a 0a 5c | 62 65 67 69 6e 7b 76 65 |pens:..\|begin{ve|
|00000ca0| 72 62 61 74 69 6d 7d 0a | 64 65 66 20 67 65 74 70 |rbatim}.|def getp|
|00000cb0| 61 73 73 28 70 72 6f 6d | 70 74 20 3d 20 22 50 61 |ass(prom|pt = "Pa|
|00000cc0| 73 73 77 6f 72 64 3a 20 | 22 29 3a 0a 20 20 20 20 |ssword: |"):. |
|00000cd0| 69 6d 70 6f 72 74 20 74 | 65 72 6d 69 6f 73 2c 20 |import t|ermios, |
|00000ce0| 54 45 52 4d 49 4f 53 2c | 20 73 79 73 0a 20 20 20 |TERMIOS,| sys. |
|00000cf0| 20 66 64 20 3d 20 73 79 | 73 2e 73 74 64 69 6e 2e | fd = sy|s.stdin.|
|00000d00| 66 69 6c 65 6e 6f 28 29 | 0a 20 20 20 20 6f 6c 64 |fileno()|. old|
|00000d10| 20 3d 20 74 65 72 6d 69 | 6f 73 2e 74 63 67 65 74 | = termi|os.tcget|
|00000d20| 61 74 74 72 28 66 64 29 | 0a 20 20 20 20 6e 65 77 |attr(fd)|. new|
|00000d30| 20 3d 20 74 65 72 6d 69 | 6f 73 2e 74 63 67 65 74 | = termi|os.tcget|
|00000d40| 61 74 74 72 28 66 64 29 | 0a 20 20 20 20 6e 65 77 |attr(fd)|. new|
|00000d50| 5b 33 5d 20 3d 20 6e 65 | 77 5b 33 5d 20 26 20 7e |[3] = ne|w[3] & ~|
|00000d60| 54 45 52 4d 49 4f 53 2e | 45 43 48 4f 20 20 20 20 |TERMIOS.|ECHO |
|00000d70| 20 20 20 20 20 20 23 20 | 6c 66 6c 61 67 73 0a 20 | # |lflags. |
|00000d80| 20 20 20 74 72 79 3a 0a | 20 20 20 20 20 20 20 20 | try:.| |
|00000d90| 74 65 72 6d 69 6f 73 2e | 74 63 73 65 74 61 74 74 |termios.|tcsetatt|
|00000da0| 72 28 66 64 2c 20 54 45 | 52 4d 49 4f 53 2e 54 43 |r(fd, TE|RMIOS.TC|
|00000db0| 53 41 44 52 41 49 4e 2c | 20 6e 65 77 29 0a 20 20 |SADRAIN,| new). |
|00000dc0| 20 20 20 20 20 20 70 61 | 73 73 77 64 20 3d 20 72 | pa|sswd = r|
|00000dd0| 61 77 5f 69 6e 70 75 74 | 28 70 72 6f 6d 70 74 29 |aw_input|(prompt)|
|00000de0| 0a 20 20 20 20 66 69 6e | 61 6c 6c 79 3a 0a 20 20 |. fin|ally:. |
|00000df0| 20 20 20 20 20 20 74 65 | 72 6d 69 6f 73 2e 74 63 | te|rmios.tc|
|00000e00| 73 65 74 61 74 74 72 28 | 66 64 2c 20 54 45 52 4d |setattr(|fd, TERM|
|00000e10| 49 4f 53 2e 54 43 53 41 | 44 52 41 49 4e 2c 20 6f |IOS.TCSA|DRAIN, o|
|00000e20| 6c 64 29 0a 20 20 20 20 | 72 65 74 75 72 6e 20 70 |ld). |return p|
|00000e30| 61 73 73 77 64 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |asswd.\e|nd{verba|
|00000e40| 74 69 6d 7d 0a 0a 0a 5c | 73 65 63 74 69 6f 6e 7b |tim}...\|section{|
|00000e50| 53 74 61 6e 64 61 72 64 | 20 4d 6f 64 75 6c 65 20 |Standard| Module |
|00000e60| 5c 73 65 63 74 63 6f 64 | 65 7b 54 45 52 4d 49 4f |\sectcod|e{TERMIO|
|00000e70| 53 7d 7d 0a 5c 73 74 6d | 6f 64 69 6e 64 65 78 7b |S}}.\stm|odindex{|
|00000e80| 54 45 52 4d 49 4f 53 7d | 0a 5c 69 6e 64 65 78 69 |TERMIOS}|.\indexi|
|00000e90| 69 7b 50 6f 73 69 78 7d | 7b 49 2f 4f 20 63 6f 6e |i{Posix}|{I/O con|
|00000ea0| 74 72 6f 6c 7d 0a 5c 69 | 6e 64 65 78 69 69 7b 74 |trol}.\i|ndexii{t|
|00000eb0| 74 79 7d 7b 49 2f 4f 20 | 63 6f 6e 74 72 6f 6c 7d |ty}{I/O |control}|
|00000ec0| 0a 0a 5c 72 65 6e 65 77 | 63 6f 6d 6d 61 6e 64 7b |..\renew|command{|
|00000ed0| 5c 69 6e 64 65 78 73 75 | 62 69 74 65 6d 7d 7b 28 |\indexsu|bitem}{(|
|00000ee0| 69 6e 20 6d 6f 64 75 6c | 65 20 54 45 52 4d 49 4f |in modul|e TERMIO|
|00000ef0| 53 29 7d 0a 0a 54 68 69 | 73 20 6d 6f 64 75 6c 65 |S)}..Thi|s module|
|00000f00| 20 64 65 66 69 6e 65 73 | 20 74 68 65 20 73 79 6d | defines| the sym|
|00000f10| 62 6f 6c 69 63 20 63 6f | 6e 73 74 61 6e 74 73 20 |bolic co|nstants |
|00000f20| 72 65 71 75 69 72 65 64 | 20 74 6f 20 75 73 65 20 |required| to use |
|00000f30| 74 68 65 0a 5c 63 6f 64 | 65 7b 74 65 72 6d 69 6f |the.\cod|e{termio|
|00000f40| 73 7d 20 6d 6f 64 75 6c | 65 20 28 73 65 65 20 74 |s} modul|e (see t|
|00000f50| 68 65 20 70 72 65 76 69 | 6f 75 73 20 73 65 63 74 |he previ|ous sect|
|00000f60| 69 6f 6e 29 2e 20 20 53 | 65 65 20 74 68 65 20 50 |ion). S|ee the P|
|00000f70| 6f 73 69 78 20 6f 72 0a | 5c 55 4e 49 58 7b 7d 20 |osix or.|\UNIX{} |
|00000f80| 6d 61 6e 75 61 6c 20 70 | 61 67 65 73 20 28 6f 72 |manual p|ages (or|
|00000f90| 20 74 68 65 20 73 6f 75 | 72 63 65 29 20 66 6f 72 | the sou|rce) for|
|00000fa0| 20 61 20 6c 69 73 74 20 | 6f 66 20 74 68 6f 73 65 | a list |of those|
|00000fb0| 20 63 6f 6e 73 74 61 6e | 74 73 2e 0a 0a 4e 6f 74 | constan|ts...Not|
|00000fc0| 65 3a 20 74 68 69 73 20 | 6d 6f 64 75 6c 65 20 72 |e: this |module r|
|00000fd0| 65 73 69 64 65 73 20 69 | 6e 20 61 20 73 79 73 74 |esides i|n a syst|
|00000fe0| 65 6d 2d 64 65 70 65 6e | 64 65 6e 74 20 73 75 62 |em-depen|dent sub|
|00000ff0| 64 69 72 65 63 74 6f 72 | 79 20 6f 66 20 74 68 65 |director|y of the|
|00001000| 0a 50 79 74 68 6f 6e 20 | 6c 69 62 72 61 72 79 20 |.Python |library |
|00001010| 64 69 72 65 63 74 6f 72 | 79 2e 20 20 59 6f 75 20 |director|y. You |
|00001020| 6d 61 79 20 68 61 76 65 | 20 74 6f 20 67 65 6e 65 |may have| to gene|
|00001030| 72 61 74 65 20 69 74 20 | 66 6f 72 20 79 6f 75 72 |rate it |for your|
|00001040| 0a 70 61 72 74 69 63 75 | 6c 61 72 20 73 79 73 74 |.particu|lar syst|
|00001050| 65 6d 20 75 73 69 6e 67 | 20 74 68 65 20 73 63 72 |em using| the scr|
|00001060| 69 70 74 20 5c 66 69 6c | 65 7b 54 6f 6f 6c 73 2f |ipt \fil|e{Tools/|
|00001070| 73 63 72 69 70 74 73 2f | 68 32 70 79 2e 70 79 7d |scripts/|h2py.py}|
|00001080| 2e 0a | |.. | |
+--------+-------------------------+-------------------------+--------+--------+