Skip to content

Usage

API

# TERMIOS.TERMIOSModule.

This package provides an interface to the POSIX calls for tty I/O control.

For a complete description of these calls, see the termios(3) manual page.

Usage

Example:

using TERMIOS
const T = TERMIOS
term_stdin = T.termios()
T.tcgetattr(stdin, term_stdin)
term_stdin.c_iflag |= T.IGNBRK
T.tcsetattr(stdin, T.TCSANOW, term_stdin)

source

# TERMIOS.ALTWERASEConstant.

Use alternate WERASE algorithm

source

# TERMIOS.BRKINTConstant.

Map BREAK to SIGINTR

source

# TERMIOS.BS0Constant.

BS delay type 0.

source

# TERMIOS.BS1Constant.

BS delay type 1.

source

# TERMIOS.CCAR_OFLOWConstant.

DCD flow control of output

source

# TERMIOS.CCTS_OFLOWConstant.

CTS flow control of output

source

# TERMIOS.CDSR_OFLOWConstant.

DSR flow control of output

source

# TERMIOS.CDTR_IFLOWConstant.

DTR flow control of input

source

# TERMIOS.CIGNOREConstant.

Ignore control flags

source

# TERMIOS.CLOCALConstant.

Ignore modem status lines

source

# TERMIOS.CR0Constant.

CR delay type 0.

source

# TERMIOS.CR1Constant.

CR delay type 1.

source

# TERMIOS.CR2Constant.

CR delay type 2.

source

# TERMIOS.CR3Constant.

CR delay type 3.

source

# TERMIOS.CREADConstant.

Enable receiver

source

# TERMIOS.CRTS_IFLOWConstant.

RTS flow control of input

source

# TERMIOS.CS5Constant.

5 bits (pseudo)

source

# TERMIOS.CS6Constant.

6 bits

source

# TERMIOS.CS7Constant.

7 bits

source

# TERMIOS.CS8Constant.

8 bits

source

# TERMIOS.CSIZEConstant.

Character size mask

source

# TERMIOS.CSTOPBConstant.

Send 2 stop bits

source

# TERMIOS.ECHOConstant.

Enable echoing

source

# TERMIOS.ECHOCTLConstant.

Echo control chars as ^(Char)

source

# TERMIOS.ECHOEConstant.

Visually erase chars

source

# TERMIOS.ECHOKConstant.

Echo NL after line kill

source

# TERMIOS.ECHOKEConstant.

Visual erase for line kill

source

# TERMIOS.ECHONLConstant.

Echo NL even if ECHO is off

source

# TERMIOS.ECHOPRTConstant.

Visual erase mode for hardcopy

source

# TERMIOS.EXTPROCConstant.

External processing

source

# TERMIOS.FF0Constant.

FF delay type 0.

source

# TERMIOS.FF1Constant.

FF delay type 1.

source

# TERMIOS.FFDLYConstant.

Form feed delay

source

# TERMIOS.FLUSHOConstant.

Output being flushed (state)

source

# TERMIOS.HUPCLConstant.

Hang up on last close

source

# TERMIOS.ICANONConstant.

Canonicalize input lines

source

# TERMIOS.ICRNLConstant.

Map CR to NL (ala CRMOD)

source

# TERMIOS.IEXTENConstant.

Enable DISCARD and LNEXT

source

# TERMIOS.IGNBRKConstant.

Ignore BREAK condition

source

# TERMIOS.IGNCRConstant.

Ignore CR

source

# TERMIOS.IGNPARConstant.

Ignore (discard) parity errors

source

# TERMIOS.IMAXBELConstant.

Ring bell on input queue full

source

# TERMIOS.INLCRConstant.

Map NL into CR

source

# TERMIOS.INPCKConstant.

Enable checking of parity errors

source

# TERMIOS.ISIGConstant.

Enable signals INTR, QUIT, [D]SUSP

source

# TERMIOS.ISTRIPConstant.

Strip 8th bit off chars

source

# TERMIOS.IUCLCConstant.

(glibc) Translate upper case input to lower case.

source

# TERMIOS.IUTF8Constant.

(macos) maintain state for UTF-8 VERASE

source

# TERMIOS.IXANYConstant.

Any char will restart after stop

source

# TERMIOS.IXOFFConstant.

Enable input flow control

source

# TERMIOS.IXONConstant.

Enable output flow control

source

# TERMIOS.MDMBUFConstant.

Old name for CCAR_OFLOW

source

# TERMIOS.NL0Constant.

NL type 0.

source

# TERMIOS.NOFLSHConstant.

Don't flush after interrupt

source

# TERMIOS.NOKERNINFOConstant.

No kernel output from VSTATUS

source

# TERMIOS.OCRNLConstant.

Map CR to NL on output

source

# TERMIOS.OFDELConstant.

Fill is DEL, else NUL

source

# TERMIOS.OFILLConstant.

Use fill characters for delay

source

# TERMIOS.OLCUCConstant.

(glibc) Translate lower case output to upper case.

source

# TERMIOS.ONLCRConstant.

Map NL to CR-NL (ala CRMOD)

source

# TERMIOS.ONLRETConstant.

NL performs CR function

source

# TERMIOS.ONOCRConstant.

No CR output at column 0

source

# TERMIOS.ONOEOTConstant.

Discard EOT's (^D) on output)

source

# TERMIOS.OPOSTConstant.

Enable following output processing

source

# TERMIOS.OXTABSConstant.

Expand tabs to spaces

source

# TERMIOS.PARENBConstant.

Parity enable

source

# TERMIOS.PARMRKConstant.

Mark parity and framing errors

source

# TERMIOS.PARODDConstant.

Odd parity, else even

source

# TERMIOS.PENDINConstant.

XXX retype pending input (state)

source

# TERMIOS.TAB0Constant.

TAB delay type 0.

source

# TERMIOS.TAB1Constant.

TAB delay type 1.

source

# TERMIOS.TAB2Constant.

TAB delay type 2.

source

# TERMIOS.TAB3Constant.

Expand tabs to spaces.

source

# TERMIOS.TABDLYConstant.

Horizontal tab delay

source

# TERMIOS.TCIFLUSHConstant.

Discard data received but not yet read.

source

# TERMIOS.TCIOFFConstant.

Send a STOP character.

source

# TERMIOS.TCIOFLUSHConstant.

Discard all pending data.

source

# TERMIOS.TCIONConstant.

Send a START character.

source

# TERMIOS.TCOFLUSHConstant.

Discard data written but not yet sent.

source

# TERMIOS.TCOOFFConstant.

Suspend output.

source

# TERMIOS.TCOONConstant.

Restart suspended output.

source

# TERMIOS.TCSADRAINConstant.

Drain output, then change

source

# TERMIOS.TCSAFLUSHConstant.

Drain output, flush input

source

# TERMIOS.TCSANOWConstant.

Make change immediate

source

# TERMIOS.TCSASOFTConstant.

Flag - don't alter h.w. state

source

# TERMIOS.TOSTOPConstant.

Stop background jobs from output

source

# TERMIOS.VDISCARDConstant.

Discard character IEXTEN

source

# TERMIOS.VDSUSPConstant.

Delayed suspend character ISIG together with IEXTEN

source

# TERMIOS.VEOFConstant.

End-of-file character ICANON

source

# TERMIOS.VEOLConstant.

End-of-line character ICANON

source

# TERMIOS.VEOL2Constant.

Second EOL character ICANON together with IEXTEN

source

# TERMIOS.VERASEConstant.

Erase character ICANON

source

# TERMIOS.VINTRConstant.

Interrupt character ISIG

source

# TERMIOS.VKILLConstant.

Kill-line character ICANON

source

# TERMIOS.VLNEXTConstant.

Literal-next character IEXTEN

source

# TERMIOS.VMINConstant.

Minimum number of bytes read at once !ICANON

source

# TERMIOS.VQUITConstant.

Quit character ISIG

source

# TERMIOS.VREPRINTConstant.

Reprint-line character ICANON together with IEXTEN

source

# TERMIOS.VSTARTConstant.

Start (X-ON) character IXON, IXOFF

source

# TERMIOS.VSTATUSConstant.

Status character ICANON together with IEXTEN

source

# TERMIOS.VSTOPConstant.

Stop (X-OFF) character IXON, IXOFF

source

# TERMIOS.VSUSPConstant.

Suspend character ISIG

source

# TERMIOS.VT0Constant.

VT delay type 0.

source

# TERMIOS.VT1Constant.

VT delay type 1.

source

# TERMIOS.VTDLYConstant.

Vertical tab delay

source

# TERMIOS.VTIMEConstant.

Time-out value (tenths of a second) !ICANON

source

# TERMIOS.VWERASEConstant.

Word-erase character ICANON together with IEXTEN

source

# TERMIOS.cfgetispeedMethod.

cfgetispeed(term::termios) -> Int

Returns the input baud rate stored in the termios structure.

source

# TERMIOS.cfgetospeedMethod.

cfgetospeed(term::termios) -> Int

Returns the output baud rate stored in the termios structure.

source

# TERMIOS.cfmakerawMethod.

cfmakeraw(term::termios)

Set the terminal to something like the "raw" mode of the old Version 7 terminal driver: input is available character by character, echoing is disabled, and all special processing of terminal input and output characters is disabled. The terminal attributes are set as follows:

term.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP
             | INLCR | IGNCR | ICRNL | IXON);
term.c_oflag &= ~OPOST;
term.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
term.c_cflag &= ~(CSIZE | PARENB);
term.c_cflag |= CS8;

source

# TERMIOS.cfsetispeedMethod.

cfsetispeed(term::termios, speed::Integer)

sets the input baud rate stored in the termios structure to speed, which must be one of these constants:

  • TERMIOS.B0
  • TERMIOS.B50
  • TERMIOS.B75
  • TERMIOS.B110
  • TERMIOS.B134
  • TERMIOS.B150
  • TERMIOS.B200
  • TERMIOS.B300
  • TERMIOS.B600
  • TERMIOS.B1200
  • TERMIOS.B1800
  • TERMIOS.B2400
  • TERMIOS.B4800
  • TERMIOS.B9600
  • TERMIOS.B19200
  • TERMIOS.B38400
  • TERMIOS.B57600
  • TERMIOS.B115200
  • TERMIOS.B230400

The zero baud rate, B0, is used to terminate the connection. If B0 is specified, the modem control lines shall no longer be asserted. Normally, this will disconnect the line. CBAUDEX is a mask for the speeds beyond those defined in POSIX.1 (57600 and above). Thus, B57600 & CBAUDEX is nonzero.

source

# TERMIOS.cfsetospeedMethod.

cfsetospeed(term::termios, speed::Integer)

sets the output baud rate stored in the termios structure to speed, which must be one of these constants:

  • TERMIOS.B0
  • TERMIOS.B50
  • TERMIOS.B75
  • TERMIOS.B110
  • TERMIOS.B134
  • TERMIOS.B150
  • TERMIOS.B200
  • TERMIOS.B300
  • TERMIOS.B600
  • TERMIOS.B1200
  • TERMIOS.B1800
  • TERMIOS.B2400
  • TERMIOS.B4800
  • TERMIOS.B9600
  • TERMIOS.B19200
  • TERMIOS.B38400
  • TERMIOS.B57600
  • TERMIOS.B115200
  • TERMIOS.B230400

The zero baud rate, B0, is used to terminate the connection. If B0 is specified, the modem control lines shall no longer be asserted. Normally, this will disconnect the line. CBAUDEX is a mask for the speeds beyond those defined in POSIX.1 (57600 and above). Thus, B57600 & CBAUDEX is nonzero.

source

# TERMIOS.cfsetspeedMethod.

cfsetspeed(term::termios, speed::Int)

is a 4.4BSD extension. It takes the same arguments as cfsetispeed(), and sets both input and output speed.

source

# TERMIOS.tcdrainMethod.

tcdrain(s::Base.LibuvStream)

Wait until all output written to file descriptor fd has been transmitted.

source

# TERMIOS.tcflowMethod.

tcflow(s::Base.LibuvStream, action::Integer)

Suspend transmission or reception of data on the object referred to by fd, depending on the value of action:

  • TERMIOS.TCOOFF to suspend output,
  • TERMIOS.TCOON to restart output
  • TERMIOS.TCIOFF to suspend input,
  • TERMIOS.TCION to restart input.

source

# TERMIOS.tcflushMethod.

tcflush(s::Base.LibuvStream, queue::Integer)

Discard data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of queue_selector:

  • TERMIOS.TCIFLUSH flushes data received but not read.
  • TERMIOS.TCOFLUSH flushes data written but not transmitted.
  • TERMIOS.TCIOFLUSH flushes both data received but not read, and data written but not transmitted.

source

# TERMIOS.tcgetattrMethod.

tcgetattr(fd::RawFD, term::termios)
tcgetattr(s::Base.LibuvStream, term::termios)
tcgetattr(f::Int, term::termios)

Get the tty attributes for file descriptor fd

source

# TERMIOS.tcsendbreakMethod.

tcsendbreak(s::Base.LibuvStream, duration::Integer)

Transmit a continuous stream of zero-valued bits for a specific duration, if the terminal is using asynchronous serial data transmission. If duration is zero, it transmits zero-valued bits for at least 0.25 seconds, and not more that 0.5 seconds. If duration is not zero, it sends zero-valued bits for some implementation-defined length of time.

If the terminal is not using asynchronous serial data transmission, tcsendbreak() returns without taking any action.

source

# TERMIOS.tcsetattrMethod.

tcsetattr(s::Base.LibuvStream, when::Integer, term::termios)

Set the tty attributes for file descriptor fd. The when argument determines when the attributes are changed:

  • TERMIOS.TCSANOW to change immediately
  • TERMIOS.TCSADRAIN to change after transmitting all queued output
  • TERMIOS.TCSAFLUSH to change after transmitting all queued output and discarding all queued input.

source