"""Terminal utilities.""" # Author: Steen Lumholt. from termios import * __all__ = ["setraw", "setcbreak"] # Indexes for termios list. IFLAG = 0 OFLAG = 1 CFLAG = 2 LFLAG = 3 ISPEED = 4 OSPEED = 5 CC = 6 def setraw(fd, when=TCSAFLUSH): """Put terminal into a raw mode.""" mode = tcgetattr(fd) mode[IFLAG] = mode[IFLAG] & ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON) mode[OFLAG] = mode[OFLAG] & ~(OPOST) mode[CFLAG] = mode[CFLAG] & ~(CSIZE | PARENB) mode[CFLAG] = mode[CFLAG] | CS8 mode[LFLAG] = mode[LFLAG] & ~(ECHO | ICANON | IEXTEN | ISIG) mode[CC][VMIN] = 1 mode[CC][VTIME] = 0 tcsetattr(fd, when, mode) def setcbreak(fd, when=TCSAFLUSH): """Put terminal into a cbreak mode.""" mode = tcgetattr(fd) mode[LFLAG] = mode[LFLAG] & ~(ECHO | ICANON) mode[CC][VMIN] = 1 mode[CC][VTIME] = 0 tcsetattr(fd, when, mode) e='1'/> https://github.com/python/cpython.git
summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* recognize more latex commands; add obindexGuido van Rossum1995-03-172-8/+44
|
* added lots of commentsGuido van Rossum1995-03-171-10/+100
|
* add (c) symbolGuido van Rossum1995-03-172-4/+4
|
* new date and versionGuido van Rossum1995-03-172-2/+2
|
* added table of precedencesGuido van Rossum1995-03-172-0/+102
|
* forget about html.styGuido van Rossum1995-03-172-2/+2
|
* Added some (method) casts.Sjoerd Mullender1995-03-172-52/+52
|
* implement exit_thread through SystemExit exceptionGuido van Rossum1995-03-171-7/+8
|
* added firstkey(), nextkey(), reorganize() methodsGuido van Rossum1995-03-161-0/+64
|
* default mode="r" and add optional bufsizeGuido van Rossum1995-03-161-2/+2
|
* fixed up comments describing interfaceGuido van Rossum1995-03-161-19/+18
|
* use PyCallable_Check; split some linesGuido van Rossum1995-03-161-12/+19
|
* test signal moduleGuido van Rossum1995-03-16