unix-2.7.2.2: 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.ByteString

Contents

Description

POSIX Terminal support

Synopsis

Terminal support

Terminal attributes

getTerminalAttributes :: Fd -> IO TerminalAttributes Source #

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

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

BRKINT - Signal interrupt on break

MapCRtoLF

ICRNL - Map CR to NL on input

IgnoreBreak

IGNBRK - Ignore break condition

IgnoreCR

IGNCR - Ignore CR

IgnoreParityErrors

IGNPAR - Ignore characters with parity errors

MapLFtoCR

INLCR - Map NL to CR on input

CheckParity

INPCK - Enable input parity check

StripHighBit

ISTRIP - Strip character

RestartOnAny

IXANY - Enable any character to restart output

StartStopInput

IXOFF - Enable start/stop input control

StartStopOutput

IXON - Enable start/stop output control

MarkParityErrors

PARMRK - Mark parity errors

ProcessOutput

OPOST - Post-process output

MapLFtoCRLF

ONLCR - (XSI) Map NL to CR-NL on output

Since: 2.8.0.0

OutputMapCRtoLF

OCRNL - (XSI) Map CR to NL on output

Since: 2.8.0.0

NoCRAtColumnZero

ONOCR - (XSI) No CR output at column 0

Since: 2.8.0.0

ReturnMeansLF

ONLRET - (XSI) NL performs CR function

Since: 2.8.0.0

TabDelayMask0

TABDLY(TAB0) - (XSI) Select horizontal-tab delays: type 0

Since: 2.8.0.0

TabDelayMask3

TABDLY(TAB3) - (XSI) Select horizontal-tab delays: type 3

Since: 2.8.0.0

LocalMode

CLOCAL - Ignore modem status lines

ReadEnable

CREAD - Enable receiver

TwoStopBits

CSTOPB - Send two stop bits, else one

HangupOnClose

HUPCL - Hang up on last close

EnableParity

PARENB - Parity enable

OddParity

PARODD - Odd parity, else even

EnableEcho

ECHO - Enable echo

EchoErase

ECHOE - Echo erase character as error-correcting backspace

EchoKill

ECHOK - Echo KILL

EchoLF

ECHONL - Echo NL

ProcessInput

ICANON - Canonical input (erase and kill processing)

ExtendedFunctions

IEXTEN - Enable extended input character processing

KeyboardInterrupts

ISIG - Enable signals

NoFlushOnInterrupt

NOFLSH - Disable flush after interrupt or quit

BackgroundWriteInterrupt

TOSTOP - Send SIGTTOU for background output

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

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.

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

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 RawFilePath Source #

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.