Annotation of researchv10no/ncurses/screen/reset_prog.c, revision 1.1

1.1     ! root        1: /*     @(#) reset_prog.c: 1.1 10/15/83 (1.36   3/18/83)        */
        !             2: #include "curses.ext"
        !             3: #include "../local/uparm.h"
        !             4: 
        !             5: extern struct term *cur_term;
        !             6: 
        !             7: #ifdef DIOCSETT
        !             8: /*
        !             9:  * Disable CB/UNIX virtual terminals.
        !            10:  * This really should be a field in the cur_term structure, but
        !            11:  * I didn't do it that way because I'm trying to make ex fit.
        !            12:  * If you're using virtual terminals on a 32 bit machine it
        !            13:  * probably makes sense to change it.
        !            14:  */
        !            15: static struct termcb new, old;
        !            16: #endif
        !            17: #ifdef LTILDE
        !            18: static int newlmode, oldlmode;
        !            19: #endif
        !            20: 
        !            21: /*
        !            22:  * Getting the baud rate is different on the two systems.
        !            23:  * In either case, a baud rate of 0 hangs up the phone.
        !            24:  * Since things are often initialized to 0, getting the phone
        !            25:  * hung up on you is a common result of a bug in your program.
        !            26:  * This is not very friendly, so if the baud rate is 0, we
        !            27:  * assume we're doing a reset_xx_mode with no def_xx_mode, and
        !            28:  * just don't do anything.
        !            29:  */
        !            30: #ifdef USG
        !            31: #define BR(x) (cur_term->x.c_cflag&CBAUD)
        !            32: #else
        !            33: #define BR(x) (cur_term->x.sg_ispeed)
        !            34: #endif
        !            35: 
        !            36: reset_prog_mode()
        !            37: {
        !            38:        if (BR(Nttyb))
        !            39:                ioctl(cur_term -> Filedes,
        !            40: #ifdef USG
        !            41:                        TCSETAW,
        !            42: #else
        !            43:                        TIOCSETN,
        !            44: #endif
        !            45:                        &(cur_term->Nttyb));
        !            46: # ifdef LTILDE
        !            47:        ioctl(cur_term -> Filedes, TIOCLGET, &oldlmode);
        !            48:        newlmode = oldlmode & ~LTILDE;
        !            49:        if (newlmode != oldlmode)
        !            50:                ioctl(cur_term -> Filedes, TIOCLSET, &newlmode);
        !            51: # endif
        !            52: #ifdef DIOCSETT
        !            53:        if (old.st_termt == 0)
        !            54:                ioctl(2, DIOCGETT, &old);
        !            55:        new = old;
        !            56:        new.st_termt = 0;
        !            57:        new.st_flgs |= TM_SET;
        !            58:        ioctl(2, DIOCSETT, &new);
        !            59: #endif
        !            60: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.