Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tty(7) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                   tty(7)



        _________________________________________________________________
        tty                                                  Special File
        BSD terminal interface
        _________________________________________________________________


        DESCRIPTION

        This section describes the terminal drivers used for interactive
        computing.


           Line disciplines

        The system provides different line disciplines for controlling
        communications lines.  The DG/UX system has two line disciplines:

        AT&T      The standard terminal driver from AT&T System V.  This
                  is used with the standard shell sh(1).  See termio(7).

        Berkeley  A Berkeley 4BSD terminal driver with features for job
                  control.  This must be used with csh(1).  See the
                  following description.

        Line discipline switching is accomplished with the stty command
        or with the TIOCSETD ioctl system call:

             int ldisc = LDISC; ioctl(filedes, TIOCSETD, &ldisc);

        LDISC is OTTYDISC for the standard tty driver and NTTYDISC for
        the BSD driver.  The standard (currently AT&T) tty driver is
        discipline 0 by convention.  The current line discipline can be
        obtained with the TIOCGETD ioctl call.  Pending input is
        discarded when the line discipline is changed.

        All of the low-speed asynchronous communications ports can use
        any of the available line disciplines, no matter what hardware is
        involved.


           The control terminal

        When a terminal file is opened, the process pends until a
        connection is established.  User programs seldom open these
        files; they are opened by init(1M) and become a user's standard
        input and output file.

        If a process having no control terminal opens a terminal file,
        that file becomes the control terminal for that process.  The
        control terminal is thereafter inherited by a child process
        during a fork(2), even if the control terminal is closed.



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        The file /dev/tty is, in each process, a synonym for the control
        terminal associated with that process.  See devtty(7) for a
        complete description of the control terminal.

        Process groups

        As described more completely in jobs(3), command processors such
        as csh(1) can distribute use of the terminal between different
        jobs by placing related jobs in a single process group and
        associating this process group with the terminal.  You can set a
        terminal's associated process group with the TIOCSPGRP ioctl(2):

             ioctl(fildes, TIOCSPGRP, &pgrp)

        or you can examine it with TIOCGPGRP rather than TIOCSPGRP,
        returning the current process group in pgrp. The BSD terminal
        driver restricts access to the terminal by processes that are not
        in the current process group; see "Job access control" below.

        Modes

        The terminal drivers have three major modes, characterized by the
        amount of processing on the input and output characters:

        Cooked    The normal mode.  Lines of input are collected, and
                  input editing is done.  The edited line is made
                  available when you complete it with a new line or enter
                  an EOT (Ctrl-D).  A carriage return is usually made
                  synonymous with new line in this mode, and replaced
                  with a new line whenever it is typed.  All driver
                  functions (input editing, interrupt generation, output
                  processing such as delay generation and tab expansion,
                  etc.) are available in this mode.

        CBREAK    A mode that eliminates the character, word, and line
                  editing input facilities, making the input character
                  available to the user program as it is typed.  Flow
                  control, literal-next, interrupt processing, and output
                  processing are still done.

        Raw       A mode that eliminates all input and output processing.
                  Input characters are made available as they are typed.

        The style of input processing can also be very different when, in
        the BSD terminal driver, a process asks for notification via a
        SIGTTIN signal(2) when input is ready to be read from the control
        terminal (see devtty(7)).  In this case a read(2) from the
        control terminal never blocks, but returns an error indication
        (EIO) if there is no input available.





        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



           Input processing

        A DG/UX System terminal ordinarily operates in full-duplex mode.
        You can type characters at any time, even during output;
        characters are lost only when you have accumulated 256 input
        characters not yet read by some program.  When the input limit is
        reached, the BSD driver either throws buffered input away without
        warning (if the terminal is in RAW mode), or rings the terminal
        bell (if in CBREAK or cooked mode).

        Input editing

        Input characters are normally accepted in either even or odd
        parity, with the parity bit stripped off before the character is
        given to the program.  By clearing the EVEN or ODD bit in the
        flags word, you can discard input characters with that parity
        (see "Data structures" below).

        You can simulate terminal input for any of the line disciplines
        with the TIOCSTI ioctl call, which takes the address of a
        character as its third argument.  The system pretends that this
        character was typed on the argument terminal, which must be the
        control terminal except for the superuser.

        Input characters are normally echoed by putting them in an output
        queue as they arrive.  To disable this, clear the ECHO bit in the
        flags word using the stty(2) call or with the TIOCSETN or
        TIOCSETP ioctl call (see "Data structures" below).

        In cooked mode, terminal input is processed in units of lines.  A
        program attempting to read will normally be suspended until an
        entire line has been received; for exceptions, see the
        description of SIGTTIN in "Modes" above and FIONREAD in "Data
        structures" below.  No matter how many characters are requested
        in the read call, at most one line will be returned.  However,
        you do not need to read a whole line at once; in a read you can
        request any number of characters, even one, without losing
        information.

        Line editing is normally done during input, with the character #
        logically erasing the last character typed and the character @
        logically erasing the entire current input line.  These are often
        reset on CRTs, with Ctrl-H replacing #, and Ctrl-U replacing @.
        These characters never erase beyond the beginning of the current
        input line or a Ctrl-D.  To enter these characters literally,
        precede them with \.

        The drivers normally treat either a carriage return or a new-line
        character as terminating an input line, replacing the return with
        a new line and echoing a return and a line feed.  If the CRMOD
        bit is cleared in the local mode word then the processing for



        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        carriage return is disabled; it is simply echoed as a return, and
        does not terminate cooked mode input.

        The BSD driver uses a literal-next character Ctrl-V.  You can
        type it in both cooked and CBREAK mode before any character to
        prevent its special meaning.  A Ctrl-V is preferred over a \ to
        escape erase and kill characters, but \ is retained for
        historical reasons.

        The BSD terminal driver also provides two other editing
        characters in normal mode.  The word-erase character, normally
        Ctrl-W, erases the preceding word but not any spaces before it.
        A word is a sequence of non-blank characters.  A blank is a space
        or a tab.  Finally, the reprint character, normally Ctrl-R,
        retypes the pending input beginning on a new line.  Retyping
        occurs automatically in cooked mode if characters that would
        normally be erased from the screen are fouled by program output.

        Input echoing and redisplay

        The BSD terminal driver has several ways to echo terminal input,
        controlled by bits in a local mode word.

        Hardcopy terminals. Set the LPRTERA bit in the local mode word
        (see "Local Mode" section below).  Characters that are logically
        erased are then printed out backwards preceded by \ and followed
        by /.

        Crt terminals. Set the LCRTBS bit in the local mode word.  The
        terminal driver then echoes the proper number of erase characters
        when input is erased; if the erase character is Ctrl-H, this
        backs the cursor up to where it was before the logically erased
        character was typed.  If interspersed asynchronous output fouls
        the input, the input is automatically retyped.

        Erasing characters from a CRT. You can set the LCRTERA bit to
        erase input from the screen with a backspace-space-backspace
        sequence when character or word deleting sequences are used.  You
        can also set a LCRTKIL bit to erase the input in this manner on
        line kill sequences as well.

        Echoing of control characters. If the LCTLECH bit is set in the
        local state word, then non-printing (control) characters echo as
        Ctrl-X (for some X) rather than being echoed unmodified; delete
        echoes as Ctrl-?.

        The normal modes for using the BSD terminal driver on CRT
        terminals depend on speed.  At speeds under 1200 baud, LCRTERA
        and LCRTKILL processing is very slow; stty(1) normally just sets
        LCRTBS and LCTLECH.  At speeds of 1200 baud or greater all of
        these bits are normally set.  Stty(1) summarizes these option



        DG/UX 4.00                                                 Page 4
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        settings and the use of the BSD terminal driver as newcrt.


           Output processing

        When one or more characters are written, they are transmitted to
        the terminal as soon as previously written characters have
        finished.  (As noted above, input characters are normally echoed
        by putting them in the output queue as they arrive.)  When a
        process produces characters more rapidly than they can be typed,
        it will be suspended when its output queue exceeds some limit.
        When the queue is shorter, the program resumes.  Even parity is
        normally generated on output.  The EOT character is not
        transmitted in cooked mode to prevent terminals that respond to
        it from hanging up; programs using raw or CBREAK mode should be
        more explicit.

        The terminal drivers process cooked and CBREAK mode output
        including generating delays for certain special characters and
        parity generation.  Delays are available after backspaces (Ctrl-
        H), form-feeds (Ctrl-L), carriage returns (Ctrl-M), tabs (Ctrl-
        I), and new lines (Ctrl-J).  The driver also optionally expands
        tabs into spaces; the tab stops are assumed to be set every eight
        columns.  These functions are controlled by bits in the tty flags
        word; see "Data structures" below.

        The terminal drivers map between upper- and lowercase on
        terminals lacking lowercase, and do other special processing on
        deficient terminals.

        Finally, the BSD terminal driver uses an output flush character,
        normally Ctrl-O, which sets the LFLUSHO bit in the local mode
        word.  Subsequent output is flushed until it is cleared by a
        program or until you type more input.  This character works in
        both cooked and CBREAK modes and retypes any pending input.  The
        driver also uses ioctl to flush the characters in the input and
        output queues (TIOCFLUSH) and to return the number of characters
        still in the output queue (TIOCOUTQ).

        Uppercase terminals and Hazeltines

        If you set the LCASE bit in the tty flags, then all uppercase
        letters are mapped into lowercase.  To generate an uppercase
        letter, precede it with `\'.  If the BSD terminal driver is being
        used, then uppercase letters are preceded by \ when output.  The
        following escape sequences can be generated on output and
        accepted on input:

        For  `    |    ~    {    }
        Use  \'   \!   \^   \(   \)




        DG/UX 4.00                                                 Page 5
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        Hazeltine terminals cannot display a tilde (~).  If you set the
        LTILDE bit in the local mode word when using the BSD terminal
        driver, the character ` replaces each ~ on output.

        Flow control

        The stop character (normally Ctrl-S) suspends output, and the
        start character (normally Ctrl-Q) resumes output.  Extra stop
        characters typed when output is already stopped have no effect,
        unless the start and stop characters are made the same, in which
        case output resumes.

        You can set a bit in the flags word to put the terminal into
        tandem mode.  In this mode the system produces a stop character
        (default Ctrl-S) when the input queue is in danger of
        overflowing, and a start character (default Ctrl-Q) when the
        input has drained sufficiently.  This mode is useful when the
        terminal is another machine that obeys the flow-control
        conventions.


           Line control and breaks

        Several ioctl calls let you control the state of the terminal
        line.  The TIOCSBRK ioctl sets the break bit in the hardware
        interface, creating a break condition; to clear this, use
        TIOCCBRK (usually after a delay with sleep(3)).  Break conditions
        in the input are reflected as a null character in raw mode or as
        the interrupt character in cooked or CBREAK mode.  The TIOCCDTR
        ioctl clears the data terminal ready condition; it can be reset
        with TIOCSDTR.

        When the carrier signal from the dataset drops (usually because
        the user has hung up his terminal) a SIGHUP hangup signal is sent
        to the processes in the distinguished process group of the
        terminal; this usually terminates them (to suppress the SIGHUP,
        set the LNOHANG bit in the driver's local state word).  Access to
        the terminal by other processes is then normally revoked; any
        further reads will fail, and programs that read a terminal and
        test for end-of-file on their input will terminate appropriately.

        If you are using a modem, you can use the TIOCHPCL ioctl to hang
        up the phone line on the last close; this is normally done on the
        outgoing line.

        Interrupt characters

        Several characters generate interrupts in cooked and CBREAK mode.
        These characters are sent to the processes in the control group
        of the terminal, as if a TIOCGPGRP ioctl were done to get the
        process group, followed by a killpg(2) system call.  The



        DG/UX 4.00                                                 Page 6
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        difference is that these characters also flush pending input and
        output when typed at a terminal ('
a
`'la TIOCFLUSH). The characters shown here are the defaults; the field names in the structures (given below) are also shown. The characters may be changed, although this is not often done. Ctrl-? tintrc (Delete) generates a SIGINTR signal. This is the normal way to stop a process or to regain control in an interactive program. ^\ tquitc (FS) generates a SIGQUIT signal. This makes a program terminate and produce a core image, if possible, in the file core in the current directory. Ctrl-Z tsuspc (EM) generates a SIGTSTP signal, which suspends the current process group. Ctrl-Y tdstopc (SUB) generates a SIGTSTP signal as Ctrl-Z does, but the signal is sent when a program tries to read the Ctrl-Y, rather than when it is typed. Job access control If a process is using the BSD terminal driver and is not in the distinguished process group of its control terminal but tries to read from that terminal, its process group is sent a SIGTTIN signal. This normally stops the members of that process group. However, if the process is ignoring or blocking a SIGTTIN signal, is an orphan process, or is in the middle of creating a process with vfork(2)), it is instead returned an end-of-file. (A process becomes an orphan if its parent terminates before it does; the child process is then inherited by the init(1M) process.) A process using the BSD terminal driver with the LTOSTOP bit set in the local modes is prohibited from writing on its control terminal if it is not in the distinguished process group for that terminal. Processes that are holding or ignoring SIGTTOU signals, are orphans, or are in the middle of a vfork(2) are excepted and allowed to produce output. Data structures The BSD terminal driver uses four different structures to contain data. sgtty DG/UX 4.00 Page 7 Licensed material--property of copyright holder(s)


                                                                   tty(7)



        The basic ioctls use the structure defined in sgtty.h and
        berksgtty.h:

             struct sgttyb {
                     char   sg_ispeed;
                     char   sg_ospeed;
                     char   sg_erase;
                     char   sg_kill;
                     short  sg_flags;
             };

        The sg_ispeed and sg_ospeed fields describe the input and output
        speeds of the device according to the following table.  Symbolic
        values in the table are as defined in sgtty.h.

        B0      0    Hang up dataphone.
        B110    1    110 baud
        B134    2    134.5 baud
        B150    3    150 baud
        B300    4    300 baud
        B600    5    600 baud
        B1200   6    1200 baud
        B1800   7    1800 baud
        B2400   8    2400 baud
        B4800   9    4800 baud
        B9600   10   9600 baud
        B19200  11   19200 baud
        B38400  12   38400 baud
                13   Unused
        EXTA    14   External A
        EXTB    15   External B

        These symbolic values are given as BERK_B0, BERK_110, BERK_134,
        etc., in berksgtty.h.

        Speed changes that are not supported by the underlying hardware
        are ignored.  The baud rates EXTA and EXTB are driver specific,
        and the rates supported by a given device are listed in the
        manual entry for that device.

        The sg_erase and sg_kill fields of the argument structure specify
        the erase and kill characters respectively.  (Defaults are # and
        @.)

        The sg_flags field of the argument structure contains bits that
        determine how the system treats the terminal:

        ALLDELAY 0177400 Delay algorithm selection
        BSDELAY  0100000 Select backspace delays (not implemented):
        BS0      0
        BS1      0100000



        DG/UX 4.00                                                 Page 8
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        VTDELAY  0040000 Select form-feed and vertical-tab delays:
        FF0      0
        FF1      0100000
        CRDELAY  0030000 Select carriage-return delays:
        CR0      0
        CR1      0010000
        CR2      0020000
        CR3      0030000
        TBDELAY  0006000 Select tab delays:
        TAB0     0
        TAB1     0001000
        TAB2     0004000
        XTABS    0006000
        NLDELAY  0001400 Select new-line delays:
        NL0      0
        NL1      0000400
        NL2      0001000
        NL3      0001400
        EVENP    0000200 Even parity allowed on input (most terminals)
        ODDP     0000100 Odd parity allowed on input
        RAW      0000040 Raw mode: wake up on all characters, 8-bit interface
        CRMOD    0000020 Map CR into LF; echo LF or CR as CR-LF
        ECHO     0000010 Echo (full duplex)
        LCASE    0000004 Map uppercase to lowercase on input
        CBREAK   0000002 Return each character when typed
        TANDEM   0000001 Automatic flow control

        These symbolic values are given as BERK_ALLDELAY, BERK_BSDELAY,
        BERK_BS0, etc., in berksgtty.h.

        The delay bits specify how long transmission stops to allow
        mechanical or other movement when certain characters are sent to
        the terminal.  In all cases, a value of 0 indicates no delay.

        Backspace delays are currently ignored.

        If a form-feed/vertical tab delay is specified, it lasts for at
        least 2 seconds.

        Carriage-return delay type 1 lasts at least .08 seconds, and
        delay type 2 lasts at least .16 seconds.  Delay type 3 pads lines
        to at least nine characters by sending DEL (0177) characters
        before delivering a CR.

        New-line delay type 1 depends on the current column, and
        increases as the distance of motion (i.e., distance from column
        0) increases.  Type 2 lasts at least .10 seconds.  Type 3 is
        unimplemented, and no delay is performed.

        Tab delay type 1 depends on the amount of movement, and increases
        as the distance of motion (i.e., to next tab stop) increases.



        DG/UX 4.00                                                 Page 9
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        Type 2 is unimplemented, and no delay is currently performed.
        Type 3, called XTABS, is not a delay at all but replaces tabs
        with the appropriate number of spaces on output.

        Input characters with the wrong parity, as determined by bits
        EVENP and ODDP, are ignored in cooked and CBREAK mode.

        Raw mode disables all processing except output flushing with
        LFLUSHO; a full eight bits of input are given as soon as they are
        available; all eight bits are passed on output.  A break
        condition in the input is reported as a null character.  If the
        input queue overflows in raw mode, the currently buffered data is
        discarded.

        CRMOD turns input carriage returns into new lines; input of
        either CR or LF echoes LF-CR for terminals with a new-line
        function.

        In CBREAK mode, programs can read each character as soon as
        typed, instead of waiting for a full line; all processing is done
        except the input editing:  character and word erase and line
        kill, input reprint, and the special treatment of \ or EOT are
        disabled.

        Tandem mode produces a stop character (default Ctrl-S) whenever
        the input queue is in danger of overflowing, and a start
        character (default Ctrl-Q) when the input queue has drained
        sufficiently.  It is useful for flow control when the terminal is
        really another computer that understands the flow-control
        conventions.

        In addition to the TIOCSETD and TIOCGETD disciplines discussed
        under "Line disciplines" above, a large number of other ioctl
        calls apply to terminals, and have the general form:

             #include <sgtty.h> or #include <berksgtty.h>

             ioctl( fildes, code, arg)
             struct sgttyb *arg;

        The applicable codes are:

        TIOCGETP       Fetch the basic parameters associated with the
                       terminal, and store in the pointed-to sgttyb
                       structure.

        TIOCSETP       Set the parameters according to the pointed-to
                       sgttyb structure.  The interface delays until
                       output is quiescent, then throws away any unread
                       characters before changing the modes.




        DG/UX 4.00                                                Page 10
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        TIOCSETN       Set the parameters like TIOCSETP but do not delay
                       or flush input.  Input is not preserved, however,
                       when changing to or from RAW.

        With the following codes, the arg is ignored.

        TIOCEXCL       Set exclusive-use mode:  no further opens are
                       permitted until the file has been closed.

        TIOCNXCL       Turn off exclusive-use mode.

        TIOCHPCL       Hang up the terminal when the file is closed for
                       the last time.  This is useful when the line is
                       associated with an ACU used to place outgoing
                       calls.

        TIOCFLUSH      Flush all characters waiting in input or output
                       queues.

        For the remaining calls, required arguments are described;
        otherwise, give arg as 0.

        TIOCSTI        Pretend that the character at address arg was
                       typed on the terminal.

        TIOCSBRK       Set the break bit in the terminal.

        TIOCCBRK       Clear the break bit.

        TIOCSDTR       Set data terminal ready.

        TIOCCDTR       Clear data terminal ready.

        TIOCGPGRP      Set the word at address arg to the process group
                       number of the control terminal.

        TIOCSPGRP      Set the process group for the control terminal to
                       the word arg (typically a process id).

        FIONREAD       Return in the long integer whose address is arg
                       the number of immediately readable characters from
                       the argument unit.  This works for files, pipes,
                       and terminals, but not (yet) for multiplexed
                       channels.










        DG/UX 4.00                                                Page 11
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        Tchars

        The second structure associated with each terminal special
        characters interpreted by the BSD terminal driver.  The following
        structure is defined in sys/ioctl.h, which is automatically
        included in sgtty.h and in berksgtty.h:

             struct tchars {
                     char  t_intrc;    /* interrupt */
                     char  t_quitc;    /* quit */
                     char  t_startc;   /* start output */
                     char  t_stopc;    /* stop output */
                     char  t_eofc;     /* end-of-file */
                     char  t_brkc;     /* input delimiter (like nl) */
             };

        The default values for these characters are Ctrl-?, Ctrl\, Ctrl-
        Q, Ctrl-S, Ctrl-D, and -1.  A character value of -1 eliminates
        the effect of that character.  The t_brkc character, by default
        -1, acts like a new line in that it terminates a line, is echoed,
        and is passed to the program.  The stop and start characters can
        be the same, to produce a toggle effect.  It is probably
        counterproductive to make other special characters (including
        erase and kill) identical.  The applicable ioctl calls are:

        TIOCGETC    Get the special characters and put them in the
                    specified structure.

        TIOCSETC    Set the special characters to those given in the
                    structure.

        Local mode

        The third structure associated with each terminal is a local mode
        word.  The bits of the local mode word are:

        LCRTBS   000001  Backspace on erase rather than echoing erase
        LPRTERA  000002  Printing terminal erase mode
        LCRTERA  000004  Erase character echoes as backspace-space-backspace
        LTILDE   000010  Convert ~ to ` on output (for Hazeltine terminals)
        LMDMBUF  000020  Stop/start output when carrier drops (unimplemented)
        LLITOUT  000040  Suppress output translations
        LTOSTOP  000100  Send SIGTTOU for background output
        LFLUSHO  000200  Output is being flushed
        LNOHANG  000400  Don't send hangup when carrier drops
        L001000  001000  Reserved (no effect)
        LCRTKIL  002000  BS-space-BS: erase entire line on line kill
        LPASS8   004000  Pass all 8 bits through on input, even in cooked mode.
        LCTLECH  010000  Echo input control chars as Ctrl-X, delete as Ctrl-?
        LPENDIN  020000  Retype pending input at next read or input character
        LDECCTQ  040000  Only Ctrl-Q restarts output after Ctrl-S



        DG/UX 4.00                                                Page 12
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        The applicable ioctl functions are:

        Function    arg is the address of:

        TIOCLBIS    a mask that is the bits to be set in the local mode
                    word.

        TIOCLBIC    a mask of bits to be cleared in the local mode word.

        TIOCLSET    a mask to be placed in the local mode word.

        TIOCLGET    a word into which the current mask is placed.

        Local special characters

        The final structure associated with each terminal is the ltchars
        structure which defines additional special characters for the BSD
        terminal driver.  Its structure is:

             struct ltchars {
                      char  t_suspc;  /* stop-process signal     */
                      char  t_dsuspc; /* delayed stop-process signal */
                      char  t_rprntc; /* reprint line            */
                      char  t_flushc; /* flush output (toggles)  */
                      char  t_werasc; /* word erase              */
                      char  t_lnextc; /* literal next character  */
                      char  t_bspace; /* char to translate Ctrl-h to */
             };

        The default values for these characters are Ctrl-Z, Ctrl-Y,
        Ctrl-R, Ctrl-O, Ctrl-W, and Ctrl-V.  A value of -1 disables the
        character.

        The applicable ioctl functions are:

        Function    arg is the address of:

        TIOCSLTC    a ltchars structure that defines the new local
                    special characters.

        TIOCGLTC    a ltchars structure into which is placed the current
                    set of local special characters.


        FILES

        /dev/tty
        /dev/tty*
        /dev/console





        DG/UX 4.00                                                Page 13
               Licensed material--property of copyright holder(s)





                                                                   tty(7)



        SEE ALSO

        csh(1), getty(1M), init(1M), stty(1), ioctl(2), signal(2),
        sigsys(2), stty(2), modemap(7), termio(7).


        WARNINGS

        The DG/UX System supports two distinct terminal drivers, the AT&T
        driver and the BSD driver.  In a few cases, mode changes using
        the AT&T modes and ioctls can not be accurately reflected in the
        BSD mode set, so a program that changes modes using AT&T ioctls
        must take care that the intent of the mode changes will be
        reflected for terminals using the BSD line driver.  The manual
        entry modemap(7) describes the manner in which modes are mapped
        between the two terminal drivers.

        The include file sgtty.h is typically used by a program to obtain
        the necessary structure and symbolic mode name definitions to
        perform BSD ioctl calls.

        If a program attempts to perform both AT&T and BSD ioctl calls,
        problems can arise.  Certain mode names are used in both BSD and
        AT&T flag words, but are symbols for different values.  For
        example, the mode CR1 has value 010000 and is part of the
        sgflags flag word in the BSD sgttyb structure, as defined in
        sgtty.h.  But CR1 is also a symbol for a flag in the coflag flag
        word in the AT&T termio structure.  Furthermore, the value of the
        AT&T CR1, as defined in termio.h, is 01000, different from the
        BSD value.  This naming conflict can pose serious problems of
        mistaken identity.

        To solve this problem, programs using both BSD and AT&T ioctl
        calls should use the include file berksgtty.h, which defines the
        same BSD structures as sgtty.h , but defines the mode names
        differently.  All mode names in sgflags and the baud rate flags
        sgispeed and sgospeed are preceded in this include file with
        `BERK_', so that NL1 becomes BERKNL1 for the BSD value of the
        flag, and B4800 becomes BERKB4800.

        Note that this is necessary only in the rare case that a program
        attempts both BSD and AT&T ioctls.  In the normal case, a program
        performs only BSD or only AT&T calls, and so needs only to use
        the standard include file for the given line discipline (sgtty.h
        and termio.h, respectively).









        DG/UX 4.00                                                Page 14
               Licensed material--property of copyright holder(s)



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