Module posix.termio

Control Terminal I/O.

Functions and constants for controlling terminal behaviour.

Functions

tcdrain (fd) Wait for all written output to reach the terminal.
tcflow (fd, action) Suspend transmission or receipt of data.
tcflush (fd, action) Discard any data already written but not yet sent to the terminal.
tcgetattr (fd) Get termios state.
tcsendbreak (fd, duration) Send a stream of zero valued bits.
tcsetattr (fd, actions, a) Set termios state.

Tables

ccs Control characters.
termios Terminal attributes.


Functions

tcdrain (fd)
Wait for all written output to reach the terminal.

Parameters:

  • fd int terminal descriptor to act on

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

tcflow (fd, action)
Suspend transmission or receipt of data.

Parameters:

  • fd int terminal descriptor to act on
  • action int one of TCOOFF, TCOON, TCIOFF or TCION

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

tcflush (fd, action)
Discard any data already written but not yet sent to the terminal.

Parameters:

  • fd int terminal descriptor to act on
  • action int one of TCIFLUSH, TCOFLUSH, TCIOFLUSH

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

tcgetattr (fd)
Get termios state.

Parameters:

  • fd int terminal descriptor

Returns:

    error message if failed

Or

    termios terminal attributes, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

Usage:

    local termios, errmsg = tcgetattr (fd)
tcsendbreak (fd, duration)
Send a stream of zero valued bits.

Parameters:

  • fd int terminal descriptor
  • duration int if non-zero, stream for some implementation defined time

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

tcsetattr (fd, actions, a)
Set termios state.

Parameters:

  • fd int terminal descriptor to act on
  • actions int bitwise OR of one or more of TCSANOW, TCSADRAIN, TCSAFLUSH and TSASOFT
  • a termios table with fields from iflag, oflag, cflag, lflag and cc, each formed by bor operations with various posix constants

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

Usage:

    local termio = require "posix.termio"
    ok, errmsg = tcsetattr (fd, 0, { cc = { [termio.VTIME] = 0, [termio.VMIN] = 1 })

Tables

ccs
Control characters. The field names below are not strings, but index constants each referring to a terminal control character.

Fields:

  • VINTR int interrupt control character
  • VQUIT int quit control character
  • WERASE int erase control character
  • VKILL int kill control character
  • VEOF int end-of-file control character
  • VEOL int end-of-line control charactor
  • VEOL2 int another end-of-line control charactor
  • VMIN int 1
  • VTIME int 0
  • VSTART int xon/xoff start control character
  • VSTOP int xon/xoff stop control character
  • VSUSP int suspend control character
termios
Terminal attributes. The constants named below are all available in this submodule's namespace, as long as they are supported by the underlying system.

Fields:

  • cc ccs array of terminal control characters
  • cflag int bitwise OR of zero or more of CSIZE, CS5, CS6, CS7, CS8, CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL and CRTSCTS
  • iflag int input flags; bitwise OR of zero or more of IGNBRK, BRKINT, IGNPAR, PARMRK, INPCK, ISTRIP, INLCR, IGNCR, ICRNL, IXON, IXOFF, IXANY, and IMAXBEL
  • lflag int local flags; bitwise OR of zero or more of ISIG, ICANON, ECHO, ECHOE, ECHOK', 'ECHONL, NOFLSH, IEXTEN and TOSTOP
  • oflag int output flags; bitwise OR of zero or more of OPOST, ONLCR, OXTABS, ONOEOT, OCRNL, ONOCR, ONLRET, OFILL, NLDLY, TABDLY, CRDLY, FFDLY, BSDLY, VTDLY and OFDEL
  • ispeed int the input baud rate, one of B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, B57600, B115200,
  • ospeed int the output baud rate (see ispeed for possible values)
generated by LDoc 1.5.0 Last updated 2023-06-16 20:19:12