unix-2.3.0.0: POSIX functionalitySource codeContentsIndex
System.Posix.Terminal
Portabilitynon-portable (requires POSIX)
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
Terminal support
Terminal attributes
Terminal operations
Process groups
Testing a file descriptor
Pseudoterminal operations
Description
POSIX Terminal support
Synopsis
data TerminalAttributes
getTerminalAttributes :: Fd -> IO TerminalAttributes
data TerminalState
= Immediately
| WhenDrained
| WhenFlushed
setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO ()
data TerminalMode
= InterruptOnBreak
| MapCRtoLF
| IgnoreBreak
| IgnoreCR
| IgnoreParityErrors
| MapLFtoCR
| CheckParity
| StripHighBit
| StartStopInput
| StartStopOutput
| MarkParityErrors
| ProcessOutput
| LocalMode
| ReadEnable
| TwoStopBits
| HangupOnClose
| EnableParity
| OddParity
| EnableEcho
| EchoErase
| EchoKill
| EchoLF
| ProcessInput
| ExtendedFunctions
| KeyboardInterrupts
| NoFlushOnInterrupt
| BackgroundWriteInterrupt
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributes
terminalMode :: TerminalMode -> TerminalAttributes -> Bool
bitsPerByte :: TerminalAttributes -> Int
withBits :: TerminalAttributes -> Int -> TerminalAttributes
data ControlCharacter
= EndOfFile
| EndOfLine
| Erase
| Interrupt
| Kill
| Quit
| Start
| Stop
| Suspend
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe Char
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributes
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributes
inputTime :: TerminalAttributes -> Int
withTime :: TerminalAttributes -> Int -> TerminalAttributes
minInput :: TerminalAttributes -> Int
withMinInput :: TerminalAttributes -> Int -> TerminalAttributes
data BaudRate
= B0
| B50
| B75
| B110
| B134
| B150
| B200
| B300
| B600
| B1200
| B1800
| B2400
| B4800
| B9600
| B19200
| B38400
inputSpeed :: TerminalAttributes -> BaudRate
withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
outputSpeed :: TerminalAttributes -> BaudRate
withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributes
sendBreak :: Fd -> Int -> IO ()
drainOutput :: Fd -> IO ()
data QueueSelector
= InputQueue
| OutputQueue
| BothQueues
discardData :: Fd -> QueueSelector -> IO ()
data FlowAction
= SuspendOutput
| RestartOutput
| TransmitStop
| TransmitStart
controlFlow :: Fd -> FlowAction -> IO ()
getTerminalProcessGroupID :: Fd -> IO ProcessGroupID
setTerminalProcessGroupID :: Fd -> ProcessGroupID -> IO ()
queryTerminal :: Fd -> IO Bool
getTerminalName :: Fd -> IO FilePath
getControllingTerminalName :: IO FilePath
openPseudoTerminal :: IO (Fd, Fd)
getSlaveTerminalName :: Fd -> IO FilePath
Terminal support
Terminal attributes
data TerminalAttributes Source
getTerminalAttributes :: Fd -> IO TerminalAttributesSource
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
InterruptOnBreak
MapCRtoLF
IgnoreBreak
IgnoreCR
IgnoreParityErrors
MapLFtoCR
CheckParity
StripHighBit
StartStopInput
StartStopOutput
MarkParityErrors
ProcessOutput
LocalMode
ReadEnable
TwoStopBits
HangupOnClose
EnableParity
OddParity
EnableEcho
EchoErase
EchoKill
EchoLF
ProcessInput
ExtendedFunctions
KeyboardInterrupts
NoFlushOnInterrupt
BackgroundWriteInterrupt
withoutMode :: TerminalAttributes -> TerminalMode -> TerminalAttributesSource
withMode :: TerminalAttributes -> TerminalMode -> TerminalAttributesSource
terminalMode :: TerminalMode -> TerminalAttributes -> BoolSource
bitsPerByte :: TerminalAttributes -> IntSource
withBits :: TerminalAttributes -> Int -> TerminalAttributesSource
data ControlCharacter Source
Constructors
EndOfFile
EndOfLine
Erase
Interrupt
Kill
Quit
Start
Stop
Suspend
controlChar :: TerminalAttributes -> ControlCharacter -> Maybe CharSource
withCC :: TerminalAttributes -> (ControlCharacter, Char) -> TerminalAttributesSource
withoutCC :: TerminalAttributes -> ControlCharacter -> TerminalAttributesSource
inputTime :: TerminalAttributes -> IntSource
withTime :: TerminalAttributes -> Int -> TerminalAttributesSource
minInput :: TerminalAttributes -> IntSource
withMinInput :: TerminalAttributes -> Int -> TerminalAttributesSource
data BaudRate Source
Constructors
B0
B50
B75
B110
B134
B150
B200
B300
B600
B1200
B1800
B2400
B4800
B9600
B19200
B38400
inputSpeed :: TerminalAttributes -> BaudRateSource
withInputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributesSource
outputSpeed :: TerminalAttributes -> BaudRateSource
withOutputSpeed :: TerminalAttributes -> BaudRate -> TerminalAttributesSource
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.
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
SuspendOutputTCOOFF
RestartOutputTCOON
TransmitStopTCIOFF
TransmitStartTCION
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 ProcessGroupIDSource
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 BoolSource
queryTerminal fd calls isatty to determine whether or not Fd fd is associated with a terminal.
getTerminalName :: Fd -> IO FilePathSource
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 FilePathSource
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.
Pseudoterminal operations
openPseudoTerminal :: IO (Fd, Fd)Source
openPseudoTerminal creates a pseudoterminal (pty) pair, and returns the newly created pair as a (master, slave) tuple.
getSlaveTerminalName :: Fd -> IO FilePathSource
getSlaveTerminalName calls ptsname to obtain the name of the slave terminal associated with a pseudoterminal pair. The file descriptor to pass in must be that of the master.
Produced by Haddock version 0.8