Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stty(1)

ioctl(2)

cfgetispeed(3)

cfgetospeed(3)

cfsetispeed(3)

cfsetospeed(3)

tcflow(3)

tcflush(3)

termio(7)



  termios(7)                          CLIX                          termios(7)



  NAME

    termios - POSIX-compliant terminal interface

  DESCRIPTION

    The /usr/include/termios.h header file contains information used by system
    calls that apply to terminal files.  The definitions, values, and
    structure in this file are required for compatibility with the Institute
    of Electrical and Electronics Engineers (IEEE) P1003.1 Portable Operating
    System Interface for Computer Environments (POSIX) standard.

    The general terminal interface information is contained in the <termio.h>
    header file.  The termio structure in the <termio.h> header file defines
    the basic input, output, control, and line discipline modes.  If a calling
    program is identified as requiring POSIX compatibility, the termios
    structure and additional POSIX control packet information in the
    <termios.h> header file are implemented.

    The termios structure in the <termios.h> header file contains the
    following fields:

    c_iflag   Describes the basic terminal input control.  The initial input
              control value is all bits clear.  The possible input modes are:

              IGNBRK    Ignores the break condition.  If set, the break
                        condition is not put on the input queue and is
                        therefore not read by any process.

              BRKINT    Generates an interrupt signal on the break condition.
                        If set, the break condition generates an interrupt
                        signal and flushes both the input and output queues.

              IGNPAR    Ignores characters with parity errors.  If set,
                        characters with other framing and parity errors are
                        ignored.

              PARMRK    Marks parity errors.  If set, a character with a
                        framing or parity error that is not ignored is read as
                        the three character sequence: 0377, 0, x, where the x
                        variable is the data of the character received in
                        error.  If the ISTRIP mode is not set, then a valid
                        character of 0377 is read as 0377, 0377 to avoid
                        ambiguity.  If the PARMRK mode is not set, a framing
                        or parity error that is not ignored is read as the
                        null character.

              INPCK     Enables input parity checking.  If set, input parity
                        checking is enabled.  If not set, input parity
                        checking is disabled.  This allows for output parity
                        generation without input parity errors.



  2/94 - Intergraph Corporation                                              1






  termios(7)                          CLIX                          termios(7)



              ISTRIP    Strips characters.  If set, valid input characters are
                        first stripped to 7 bits; otherwise all 8 bits are
                        processed.

              INLCR     Maps newline character (NL) to carriage return (CR) on
                        input.  If set, a received NL character is translated
                        into a CR character.

              IGNCR     Ignores CR character.  If set, a received CR character
                        is ignored (not read).

              ICRNL     Maps CR character to NL character on input.  If set, a
                        received CR character is translated into a NL
                        character.

              IUCLC     Maps uppercase to lowercase on input.  If set, a
                        received uppercase, alphabetic character is translated
                        into the corresponding lowercase character.

              IXON      Enables start and stop output control.  If set, a
                        received STOP character suspends output, and a
                        received START character restarts output.  The START
                        and STOP characters perform flow control functions but
                        are not read.

              IXANY     Enables any character to restart output.  If set, any
                        input character restarts output that was suspended.

              IXOFF     Enables start and stop input control.  If set, the
                        system transmits a STOP character when the input queue
                        is nearly full and a START character when enough input
                        has been read that the queue is nearly empty again.

    c_oflag   Specifies how the system treats output.  The initial output
              control value is all bits clear.  The possible output modes are:

              OPOST     Post-processes output.  If set, output characters are
                        processed as indicated by the remaining flags.
                        Otherwise, characters are transmitted without change.

              OLCUC     Maps lowercase to uppercase on output.  If set, a
                        lowercase alphabetic character is transmitted as the
                        corresponding uppercase character.  This function is
                        often used in conjunction with the IUCLC input mode.

              ONLCR     Maps NL to CR-NL on output.  If set, the NL character
                        is transmitted as the CR-NL character pair.

              OCRNL     Maps CR to NL on output.  If set, the CR character is
                        transmitted as the NL character.




  2                                              Intergraph Corporation - 2/94






  termios(7)                          CLIX                          termios(7)



              ONOCR     Indicates no CR output at column 0.  If set, no CR
                        character is transmitted at column 0 (first position).

              ONLRET    NL performs CR function.  If set, the NL character is
                        assumed to do the carriage return function.  The
                        column pointer is set to a value of 0 and the delay
                        specified for carriage return is used.  Otherwise the
                        NL character is assumed to do the linefeed function
                        only; the column pointer remains unchanged.  The
                        column pointer is also set to a value of 0 if the CR
                        character is actually transmitted.

                        The delay bits specify how long a transmission stops
                        to allow for mechanical or other movement when certain
                        characters are sent to the terminal.  The actual
                        delays depend on line speed and system load.

              OFILL     Uses fill characters for delay.  If set, fill
                        characters are transmitted for a delay instead of a
                        timed delay.  This is useful for high baud rate
                        terminals that need only a minimal delay.

              OFDEL     Sets fill characters to the DEL value.  If set, the
                        fill character is DEL.  If this flag is not set, the
                        fill character is NULL.

              NLDLY     Selects the new-line character delays.  This is a mask
                        to use before comparing to NL0 and NL1.

              NL0       Specifies no delay.

              NL1       Specifies one delay of approximately 0.10 seconds.  If
                        ONLRET is set, the carriage return delays are used
                        instead of the newline delays.  If OFILL is set, two
                        fill characters are transmitted.

              CRDLY     Selects the carriage return delays.  This is a mask to
                        use before comparing to CR0, CR1, CR2 and CR3.

              CR0       Specifies no delay.

              CR1       Specifies that the delay is dependent on the current
                        column position.  If OFILL is set, this delay
                        transmits two fill characters.

              CR2       Specifies one delay of approximately 0.10 seconds.  If
                        OFILL is set, this delay transmits four fill
                        characters.

              CR3       Specifies one delay of approximately 0.15 seconds.




  2/94 - Intergraph Corporation                                              3






  termios(7)                          CLIX                          termios(7)



              TABDLY    Selects the horizontal tab delays.  This is a mask to
                        use before comparing to TAB0, TAB1, TAB2, and TAB3.
                        If OFILL is set, any of these delays transmit two fill
                        characters.

              TAB0      Specifies no delay.

              TAB1      Specifies that the delay is dependent on the current
                        column position.

              TAB2      Specifies one delay of approximately 0.10 seconds.

              TAB3      Specifies that tabs are to be expanded into spaces.

              BSDLY     Selects the backspace delays.  This is a mask to use
                        before comparing to BS0, BS1.

              BS0       Specifies no delay.

              BS1       Specifies one delay of approximately 0.05 seconds.  If
                        OFILL is set, this delay transmits one fill character.

              VTDLY     Selects the vertical-tab delays.  This is a mask to
                        use before comparing to VT0 and VT1.

              VT0       Specifies no delay.

              VT1       Specifies one delay of approximately 2 seconds.

              FFDLY     Selects the form-feed delays.  This is a mask to use
                        before comparing to FF0 and FF1.

              FF0       Specifies no delay.

              FF1       Specifies one delay of approximately 2 seconds.

    c_cflag   Describes the hardware control of the terminal.  In addition to
              the basic control modes, this field uses the following control
              characters:

              CBAUD     Specifies baud rate.  These bits specify the baud rate
                        for a connection.  For any particular hardware,
                        impossible speed changes are ignored.  (For
                        information on setting input and output baud rates,
                        see cfsetispeed(3), cfsetospeed(3), cfgetispeed(3),
                        and cfgetospeed(3).)

              B0        Hangs up.  The zero baud rate is used to hang up the
                        connection.  If B0 is specified, the ``data terminal
                        ready'' signal is not asserted.  Normally, this
                        disconnects the line.



  4                                              Intergraph Corporation - 2/94






  termios(7)                          CLIX                          termios(7)



              B50       Sets baud rate to 50.

              B75       Sets baud rate to 75.

              B110      Sets baud rate to 110.

              B134      Sets baud rate to 134.

              B150      Sets baud rate to 150.

              B200      Sets baud rate to 200.

              B300      Sets baud rate to 300.

              B600      Sets baud rate to 600.

              B1200     Sets baud rate to 1200.

              B1800     Sets baud rate to 1800.

              B2400     Sets baud rate to 2400.

              B4800     Sets baud rate to 4800.

              B9600     Sets baud rate to 9600.

              B19200    Sets baud rate to 19200.

              B38400    Sets baud rate to 38400.

              EXTA      Driver-specific external drive (A).

              EXTB      Driver-specific external drive (B).

              CSIZE     Specifies the character size.  These bits specify the
                        character size in bits for both transmit and receive
                        operations.  This size does not include the parity
                        bit, if any.

              CS5       Sets character size to 5 bits.

              CS6       Sets character size to 6 bits.

              CS7       Sets character size to 7 bits.

              CS8       Sets character size to 8 bits.

              CSTOPB    Specifies number of stop bits.  If set, 2 stop bits
                        are sent.  Otherwise, only 1 stop bit is sent.  Higher
                        baud rates require 2 stop bits.  (At 110 baud, for
                        example, 2 stop bits are required.)



  2/94 - Intergraph Corporation                                              5






  termios(7)                          CLIX                          termios(7)



              CREAD     Enables receiver.  If set, the receiver is enabled.
                        Otherwise, characters are not received.

              PARENB    Enables parity.  If set, parity generation and
                        detection is enabled and a parity bit is added to each
                        character.

              PARODD    Specifies odd parity.  If parity is enabled, this
                        specifies odd parity.  If not set, even parity is
                        used.

              HUPCL     Hangs up on last close.  If set, the line is
                        disconnected when the last process closes the line or
                        when the process terminates.  That is, the
                        data-terminal-ready signal will not be asserted.

              CLOCAL    Specifies a local line.  If set, the line is assumed
                        to have a local, direct connection with no modem
                        control.  If not set, modem control (dial-up) is
                        assumed.

              LOBLK     Block output of job control layer.  If LOBLK is set,
                        the output of a job control layer will be blocked when
                        it is not the current layer.  Otherwise, the output
                        generated by that layer will be multiplexed onto the
                        current layer.

                        The initial hardware control value after an open is
                        B300, CS8, CREAD, and HUPCL.

    c_lflag   Controls various terminal functions.  The initial value after an
              open is all bits clear.  In addition to the basic modes, this
              field uses the following mask name symbols:

              ISIG      Enables signals.  If set, each input character is
                        checked against the INTR, SWTCH, SUSP, and QUIT
                        special control characters.  If a character matches
                        one of these control characters, the function
                        associated with that character is performed.  If the
                        ISIG function is not set, checking is not done.  Thus,
                        these special input functions are possible only if
                        ISIG is set.  These functions changing the value of
                        the control character to an unlikely or impossible
                        value (such as 0377).

              ICANON    Enables canonical input.  If set, turns on canonical
                        processing, which enables the erase and kill edit
                        functions as well as the assembly of input characters
                        into lines delimited by NL, EOF, and EOL.

                        If the ICANON function is not set, read requests are



  6                                              Intergraph Corporation - 2/94






  termios(7)                          CLIX                          termios(7)



                        satisfied directly from the input queue.  In this
                        case, a read request is not satisfied until one of the
                        following conditions is met:  a) the minimum number of
                        characters specified by MIN are received; or b) the
                        time-out value specified by TIME has expired since the
                        last character was received.  This allows bursts of
                        input to be read, while still allowing single
                        character input.  The MIN and TIME values are stored
                        in the positions for the EOF and EOL characters,
                        respectively.  The time value represents tenths of
                        seconds.

              XCASE     Enables canonical uppercase and lowercase
                        presentation.  If set along with the ICANON function,
                        an uppercase letter (or the uppercase letter
                        translated to lowercase by the IUCLC input mode) is
                        accepted on input by preceding it with a backslash (\)
                        character.  The output is then preceded by a backslash
                        character.  In this mode, the output generates and the
                        input accepts the following escape sequences:

                                            _____________
                                           | for:|  use:|
                                           | *   |  \*  |
                                           | |   |  \!  |
                                           | ~   |  \^  |
                                           | {   |  \(  |
                                           | }   |  \)  |
                                           | \   |  \\  |
                                           |_____|______|

                        For example, A is input as \a, \n as \\n, and \N as
                        \\n.

              ECHO      Enables echo.  If set, characters are displayed on the
                        terminal screen as they are received.

              ECHOE     Echoes erase character as BS-SP-BS.  If the ECHO and
                        ECHOE functions are both set and ECHOPRT is not set,
                        the erase character is implemented as a backspace, a
                        space, and then another backspace (ASCII BS-SP-BS).
                        This clears the last character from the screen.  If
                        ECHOE is set, but ECHO is not set, the erase character
                        is implemented as ASCII SP-BS.

              ECHOK     Echoes NL after kill.  If ECHOK is set, a newline
                        function is performed to clear the line after a KILL
                        character is received.  This emphasizes that the line
                        is deleted.  Note that an escape character preceding
                        the ERASE or KILL character removes any special
                        function.



  2/94 - Intergraph Corporation                                              7






  termios(7)                          CLIX                          termios(7)



              ECHONL    Echoes NL.  If ECHONL is set, the line is cleared when
                        a newline function is performed whether or not the
                        ECHO function is set.  This is useful for terminals
                        that are set to local echo (also referred to as
                        half-duplex).  Unless an escape character precedes an
                        EOF, the EOF character is not displayed.  Because the
                        ASCII EOT character is the default end-of-file
                        character, this prevents terminals that respond to the
                        EOT character from hanging up.

              NOFLSH    Disables queue flushing.  If set, the normal flushing
                        of the input and output queues associated with the
                        quit and interrupt characters is not done.

              TOSTOP    Sends a SIGTTOU signal when a process in a background
                        process group tries to write to its controlling
                        terminal.  The SIGTTOU signal stops the members of the
                        process group.

    c_cc      Specifies an array that defines the special control characters.
              The relative positions and initial values for each function are:

                       ______________________________________________
                      | Relative Position|  Function|  Initial Value|
                      |__________________|__________|_______________|
                      |         0        |  VINTR   |  DEL          |
                      |         1        |  VQUIT   |  FS           |
                      |         2        |  VERASE  |  #            |
                      |         3        |  VKILL   |  @            |
                      |         4        |  VEOF    |  EOT          |
                      |         5        |  VEOL    |  NUL          |
                      |         6        |  VEOL2   |               |
                      |         7        |  VSWTCH  |               |
                      |         8        |  VSUSP   |               |
                      |         9        |  VSTART  |               |
                      |        10        |  VSTOP   |               |
                      |__________________|__________|_______________|

              The character values for INTR, QUIT, SWTCH, ERASE, KILL, EOF,
              and EOL can be changed.  The ERASE, KILL, and EOF characters can
              also be escaped (preceded with a backslash) so that no special
              processing is done.

              If _POSIX_VDISABLE is defined, and the value of one of the
              changeable special control characters is set to _POSIX_VDISABLE,
              that function is disabled; that is, no input data is recognized
              as the disabled special character.

    The following values for the Optional_Actions parameter of the tcsetattr()
    function are also defined in the <termios.h> header file:




  8                                              Intergraph Corporation - 2/94






  termios(7)                          CLIX                          termios(7)



    TCSANOW     Immediately sets the parameters associated with the terminal
                from the referenced termios structure.

    TCSADRAIN   Waits until all output written to the object file has been
                transmitted before setting the terminal parameters from the
                termios structure.

    TCSAFLUSH   Waits until all output written to the object file has been
                transmitted and all input received but not read has been
                discarded before setting the terminal parameters from the
                termios structure.

    The following values for the queueselector parameter of the tcflush()
    function are also defined in this header file:

    TCIFLUSH    Flushes data that is received but not read.

    TCOFLUSH    Flushes data that is written but not transmitted.

    TCIOFLUSH   Flushes both data that is received but not read and data that
                is written but not transmitted.

    The following values for the action parameter of the tcflow() function are
    also defined in the <termios.h> header file:

    TCOOFF   Suspends the output of data by the object file named in the
             tcflow() function.

    TCOON    Restarts data output that was suspended by the TCOOFF parameter.

    TCIOFF   Transmits a stop character to stop data transmission by the
             terminal device.

    TCION    Transmits a start character to start or restart data transmission
             by the terminal device.

  RELATED INFORMATION

    Commands:  stty(1)

    Functions:  ioctl(2), cfgetispeed(3), cfgetospeed(3), cfsetispeed(3),
    cfsetospeed(3), tcflow(3), tcflush(3)

    Files:  termio(7)










  2/94 - Intergraph Corporation                                              9




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026