unix-2.7.3: POSIX functionality
Copyright(c) The University of Glasgow 2002
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilitynon-portable (requires POSIX)
Safe HaskellSafe
LanguageHaskell2010

System.Posix.Terminal

Description

POSIX Terminal support

Synopsis

Terminal support

Terminal attributes

getTerminalAttributes :: Fd -> IOTerminalAttributesSource#

getTerminalAttributes fd calls tcgetattr to obtain the TerminalAttributes associated with Fdfd.

setTerminalAttributes :: Fd -> TerminalAttributes -> TerminalState -> IO () Source#

setTerminalAttributes fd attr ts calls tcsetattr to change the TerminalAttributes associated with Fdfd to attr, when the terminal is in the state indicated by ts.

dataBaudRateSource#

Instances

Instances details
EqBaudRateSource# 
Instance details

Defined in System.Posix.Terminal.Common

ShowBaudRateSource# 
Instance details

Defined in System.Posix.Terminal.Common

Terminal operations

sendBreak :: Fd -> Int -> IO () Source#

sendBreak fd duration calls tcsendbreak to transmit a continuous stream of zero-valued bits on Fdfd for the specified implementation-dependent duration.

drainOutput :: Fd -> IO () Source#

drainOutput fd calls tcdrain to block until all output written to Fdfd has been transmitted.

Throws IOError ("unsupported operation") if platform does not provide tcdrain(3) (use #if HAVE_TCDRAIN CPP guard to detect availability).

discardData :: Fd -> QueueSelector -> IO () Source#

discardData fd queues calls tcflush to discard pending input and/or output for Fdfd, as indicated by the QueueSelectorqueues.

controlFlow :: Fd -> FlowAction -> IO () Source#

controlFlow fd action calls tcflow to control the flow of data on Fdfd, as indicated by action.

Process groups

getTerminalProcessGroupID :: Fd -> IOProcessGroupIDSource#

getTerminalProcessGroupID fd calls tcgetpgrp to obtain the ProcessGroupID of the foreground process group associated with the terminal attached to Fdfd.

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 Fdfd to pgid.

Testing a file descriptor

queryTerminal :: Fd -> IOBoolSource#

queryTerminal fd calls isatty to determine whether or not Fdfd is associated with a terminal.

getTerminalName :: Fd -> IOFilePathSource#

getTerminalName fd calls ttyname to obtain a name associated with the terminal for Fdfd. If fd is associated with a terminal, getTerminalName returns the name of the terminal.

getControllingTerminalName :: IOFilePathSource#

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).

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 -> IOFilePathSource#

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.

close