System.Posix.Terminal
POSIX Terminal support
Terminal support
Terminal attributes
data TerminalAttributes Source #
getTerminalAttributes :: Fd -> IO TerminalAttributes Source #
getTerminalAttributes fd
calls tcgetattr
to obtain
the TerminalAttributes
associated with Fd
fd
.
data TerminalState Source #
Constructors
Immediately | |
WhenDrained | |
WhenFlushed |
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO () Source #
setTerminalAttributes fd attr ts
calls tcsetattr
to change
the TerminalAttributes
associated with Fd
fd
to
attr
, when the terminal is in the state indicated by ts
.
data TerminalMode Source #
Constructors
terminalMode :: TerminalMode -> TerminalAttributes -> Bool Source #
bitsPerByte :: TerminalAttributes -> Int Source #
withBits :: TerminalAttributes -> Int -> TerminalAttributes Source #
data ControlCharacter Source #
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes Source #
inputTime :: TerminalAttributes -> Int Source #
withTime :: TerminalAttributes -> Int -> TerminalAttributes Source #
minInput :: TerminalAttributes -> Int Source #
Constructors
B0 | |
B50 | |
B75 | |
B110 | |
B134 | |
B150 | |
B200 | |
B300 | |
B600 | |
B1200 | |
B1800 | |
B2400 | |
B4800 | |
B9600 | |
B19200 | |
B38400 | |
B57600 | |
B115200 |
Terminal operations
sendBreak :: Fd -> Int -> IO () Source #
sendBreak fd duration
calls tcsendbreak
to transmit a
continuous stream of zero-valued bits on Fd
fd
for the
specified implementation-dependent duration
.
drainOutput :: Fd -> IO () Source #
drainOutput fd
calls tcdrain
to block until all output
written to Fd
fd
has been transmitted.
Throws IOError
("unsupported operation") if platform does not
provide tcdrain(3)
(use #if HAVE_TCDRAIN
CPP guard to
detect availability).
data QueueSelector Source #
Constructors
InputQueue | |
OutputQueue | |
BothQueues |
discardData :: Fd -> QueueSelector -> IO () Source #
discardData fd queues
calls tcflush
to discard
pending input and/or output for Fd
fd
,
as indicated by the QueueSelector
queues
.
data FlowAction Source #
Constructors
SuspendOutput | TCOOFF |
RestartOutput | TCOON |
TransmitStop | TCIOFF |
TransmitStart | TCION |
controlFlow :: Fd -> FlowAction -> IO () Source #
controlFlow fd action
calls tcflow
to control the
flow of data on Fd
fd
, as indicated by
action
.
Process groups
getTerminalProcessGroupID :: Fd -> IO ProcessGroupID Source #
getTerminalProcessGroupID fd
calls tcgetpgrp
to
obtain the ProcessGroupID
of the foreground process group
associated with the terminal attached to Fd
fd
.
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO () Source #
setTerminalProcessGroupID fd pgid
calls tcsetpgrp
to
set the ProcessGroupID
of the foreground process group
associated with the terminal attached to Fd
fd
to pgid
.
Testing a file descriptor
queryTerminal :: Fd -> IO Bool Source #
queryTerminal fd
calls isatty
to determine whether or
not Fd
fd
is associated with a terminal.
getTerminalName :: Fd -> IO FilePath Source #
getTerminalName fd
calls ttyname
to obtain a name associated
with the terminal for Fd
fd
. If fd
is associated
with a terminal, getTerminalName
returns the name of the
terminal.
getControllingTerminalName :: IO FilePath Source #
getControllingTerminalName
calls ctermid
to obtain
a name associated with the controlling terminal for the process. If a
controlling terminal exists,
getControllingTerminalName
returns the name of the
controlling terminal.
Throws IOError
("unsupported operation") if platform does not
provide ctermid(3)
(use #if HAVE_CTERMID
CPP guard to
detect availability).