Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ modemap(7) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                               modemap(7)



        _________________________________________________________________
        modemap                                              Special File
        mapping of AT&T and Berkeley terminal modes
        _________________________________________________________________


        DESCRIPTION

        The DG/UX system blends the AT&T and BSD UNIX systems.  However,
        the two systems use different line disciplines to describe
        terminal modes (see ioctl(2), termio(7), and tty(7)).  This entry
        tells how the settings in each discipline are mapped into the
        modes of the other.

        Setting the modes of a given line discipline poses no problem so
        long as you are actually using the line discipline.  However, if
        the terminal is using one discipline and an application program
        is making ioctl system calls using the other discipline, some
        sort of mapping must exist to reflect the program's intent into
        the modes of the other line discipline.  This mapping can be
        performed accurately in most cases.


           BSD to AT&T Conversions

        The table below outlines what happens to the AT&T line discipline
        modes when you set BSD modes (sg_flags and characters in the
        sgttyb structure, or BSD local modes and characters).  When a BSD
        mode in the left column is set, this implies that the
        corresponding mode in the right column is set.

                     BSD Mode          AT&T Mode

        DELAYS       BS0               BS0
                     BS1               BS1
                     FF0               FF0, VT0
                     FF1               FF1, VT1
                     CR0               CR0 if not previously CR1
                     CR1               CR1
                     CR2               CR2
                     CR3               CR0 if not previously CR1
                     TAB0              TAB0
                     TAB1              TAB1
                     TAB2              TAB2
                     XTABS             TAB3
                     NL0               NL0
                     NL1               NL1
                     NL2               NL2
                     NL3               NL3

        PARITY       ~EVENP & ~ODDP    INPCK, ~PARENB



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





                                                               modemap(7)



                     ~EVENP & ODDP     INPCK, PARENB, PARODD
                     EVENP & ~ODDP     INPCK, PARENB, ~PARODD
                     EVENP & ODDP      ~INPCK

        RAW, etc.    RAW               ~OPOST, ~ICANON, ~ISIG, ~ISTRIP, ~IXON
                                       c_cc[VMIN] = 1, c_cc[VTIME] = 0
                     CBREAK            OPOST, ISIG, ISTRIP, IXON
                                       ~ICANON, c_cc[VMIN] = 1,
                                       c_cc[VTIME] = 0
                     cooked            OPOST, ICANON, ISIG, ISTRIP, IXON
                     (~RAW, ~CBREAK)   c_cc[VEOF] = BSD EOF character
                                       c_cc[VEOL] = BSD EOL character

        baud rate    sg_ispeed         c_cflag & CBAUD = sg_ispeed

        special                        t_intrc
        characters   t_quitc
                                       t_eofc
                                       t_brkc
                                       t_bspace

        MISC.        CRMOD             ICRNL, OCRNL, ONLCR
                     ~CRMOD            ~ICRNL, ~OCRNL, ~ONLCR
                     ECHO              ECHO
                     ~ECHO             ~ECHO
                     LCASE             IUCLC, OLCUC, XCASE
                     ~LCASE            ~IUCLC, ~OLCUC, ~XCASE
                     TANDEM            IXOFF
                     ~TANDEM           ~IXOFF
                     LCRTBS            ECHOE
                     ~LCRTBS           ~ECHOE
                                       LNOFLSH
                                       ~LNOFLSH

        Any other BSD modes do not change the AT&T modes at all.  An
        application that depends on behavior provided by a particular BSD
        mode must guarantee that the terminal is using the BSD line
        discipline during execution.


           AT&T to BSD Conversions

        The table below outlines what happens to the BSD line discipline
        modes when you set AT&T modes (various flags in the termio
        structure).  When an AT&T mode in the left column is set, this
        implies that the corresponding mode in the right column is set.

                     AT&T Mode                   BSD Mode

        DELAYS       BS0                         BS0
                     BS1                         BS1



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





                                                               modemap(7)



                     FF0                         FF0
                     FF1                         FF1
                     CR0                         CR0 if not previously CR3
                     CR1                         CR0 if not previously CR3
                     CR2                         CR1
                     CR3                         CR2
                     TAB0                        TAB0
                     TAB1                        TAB1
                     TAB2                        TAB2
                     TAB3                        XTABS
                     NL0                         NL0 if previously NL2
                     NL1                         NL2

        PARITY       ~INPCK                      EVENP, ODDP
                     INPCK, ~PARENB              ~EVENP, ~ODDP
                     INPCK, PARENB, PARODD       ~EVENP, ODDP
                     INPCK, PARENB, ~PARODD      EVENP & ~ODDP
        RAW, etc.    ~ICANON, c_cc[VMIN] = 1,    RAW
                     ~OPOST, ~ISIG, ~ISTRIP
                     ~ICANON, c_cc[VMIN] = 1     CBREAK (unless RAW)

        baud rate    c_cflag & CBAUD

        special                                  c_cc[VINTR]
        characters   c_cc[VQUIT]
                                                 c_cc[VEOF]
                                                 c_cc[VEOL]
                                                 c_cc[VBSPACE]

        MISC.        ICRNL, OCRNL, ONLCR         CRMOD
                     ECHO                        ECHO
                     ~ECHO                       ~ECHO
                     IUCLC, OLCUC, XCASE         LCASE
                     IXOFF                       TANDEM
                     ~IXOFF                      ~TANDEM
                     ECHOE                       LCRTBS
                     ~ECHOE                      ~LCRTBS
                                                 NOFLSH
                                                 NOFLSH

        The mapping of terminal modes is necessarily imperfect, because
        of the one-to-many relationship between a given BSD mode and a
        set of AT&T modes.  The mode mapping is designed to minimize
        damage to the BSD state upon resetting the AT&T state.

        In several situations, saving and restoring with BSD ioctl calls
        can change the AT&T tty state.  An AT&T ioctl call can change the
        BSD tty state in one situation:  when the baud portion of the
        AT&T ccflag word is saved and restored if the BSD sgispeed and
        sgospeed values differ initially.




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





                                                               modemap(7)



        EXAMPLES

        In the following example, saving the BSD state and restoring it
        leaves the AT&T modes in a state different from their initial
        state:
                                       BSD         AT&T

                     Initial state     CRMOD off   ICRNL set
                                                   ONLRC off
                                                   OCRNL off

                     Setting           CRMOD on    ICRNL set
                                                   ONLRC set
                                                   ONRNL set

                     Final state       CRMOD off   ICRNL off
                     after resetting               ONLRC off
                                                   OCRNL off

        In the following example, saving the AT&T state and restoring it
        changes the symbolic value of BSD sgospeed (defined in ioctl.h)
        from B4800 (4800 baud) to B9600 (9600 baud).

                                 AT&T             BSD

               Initial state     c_cflag: B9600   sg_ispeed: B9600
                                                  sg_ospeed: B4800

               Setting           c_cflag: B4800   sg_ispeed: B4800
                                                  sg_ospeed: B4800

               Final state       c_cflag: B9600   sg_ispeed: B9600
               after resetting                    sg_ospeed: B9600


        SEE ALSO

        stty(1), ioctl(2), termio(7), tty(7)


        WARNING

        Some mode names (NL1 and B300, for example) have different
        meanings to the two line disciplines, and different values in the
        flag words of the ioctl structures.  For this reason, in order
        for an application to use both BSD and AT&T ioctl calls, the
        include file berksgtty.h must be included.  Furthermore, the
        mode names for the BSD flags in the sg_flags and baud rate words
        ispeed and ospeed must be prefixed with BERK_ in order to avoid
        confusion with the AT&T mode names.  If only BSD or only AT&T
        ioctls are done (the recommended case), no special action need be



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





                                                               modemap(7)



        taken.





















































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



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