Annotation of 43BSD/contrib/apl/src/am.c, revision 1.1

1.1     ! root        1: static char Sccsid[] = "am.c @(#)am.c  1.3     7/3/83 Berkeley ";
        !             2: #include "apl.h"
        !             3: #include <sgtty.h>
        !             4: #ifdef VLIMIT
        !             5: #include <sys/resource.h>
        !             6: #endif
        !             7: 
        !             8: /* The following code is so system-dependent that it was moved to
        !             9:  * a separate file.  It conditions the terminal for APL mode if called
        !            10:  * with a non-zero argument, or returns it to its normal state if called
        !            11:  * with a zero argument.
        !            12:  */
        !            13: 
        !            14: extern int mkcore;
        !            15: 
        !            16: 
        !            17: #ifndef PURDUE_EE
        !            18: 
        !            19: aplmod(n)
        !            20: {
        !            21:        static struct sgttyb m;
        !            22: 
        !            23:        if (n){
        !            24: #ifdef VLIMIT
        !            25:                if (!mkcore) {
        !            26:                        struct rlimit rl;
        !            27: 
        !            28:                        getrlimit(RLIMIT_CORE, &rl);
        !            29:                        rl.rlim_cur = 0;
        !            30:                        setrlimit(RLIMIT_CORE, &rl);    /* no core file! */
        !            31:                }
        !            32: #endif
        !            33:                gtty(0, &m);
        !            34:                if ((m.sg_erase == '\b' || m.sg_kill == '\b') && !prwsflg)
        !            35:                        printf("[warning: erase char is ctl-h]\n");
        !            36:        }
        !            37: }
        !            38: 
        !            39: #else
        !            40: 
        !            41: #ifdef vax
        !            42: #include <sys/ioctl.h>
        !            43: static modesave;
        !            44: static aplmode = LAPL;
        !            45: static discsave;
        !            46: static olddisc = OTTYDISC;
        !            47: static turkey = LTURKEY;
        !            48: static ctlech = LCTLECH;
        !            49: #endif
        !            50: 
        !            51: aplmod(n)
        !            52: {
        !            53:        static struct sgttyb m;
        !            54: 
        !            55:        if(n){
        !            56:                gtty(0, &m);
        !            57:                if((m.sg_erase == '\b' || m.sg_kill == '\b') && !prwsflg)
        !            58:                        printf("[warning: erase char is ctl-h]\n");
        !            59: #ifdef VLIMIT
        !            60:                if (!mkcore) {
        !            61:                        struct rlimit rl;
        !            62: 
        !            63:                        getrlimit(RLIMIT_CORE, &rl);
        !            64:                        rl.rlim_cur = 0;
        !            65:                        setrlimit(RLIMIT_CORE, &rl);    /* no core file! */
        !            66:                }
        !            67: #endif
        !            68: #ifdef vax
        !            69:                ioctl(0, TIOCLGET, &modesave);
        !            70:                ioctl(0, TIOCLBIC, &ctlech);
        !            71:                ioctl(0, TIOCLBIC, &turkey);
        !            72: #else
        !            73:                ioctl(0, TIOCNNOCTRL);
        !            74: #endif
        !            75:                /* Turn on apl mode if requested */
        !            76:                if (apl_term){
        !            77: #ifndef vax
        !            78:                        m.sg_flags |= APLMOD;
        !            79:                        stty(0,&m);
        !            80: #else
        !            81:                        ioctl(0, TIOCGETD, &discsave);
        !            82:                        ioctl(0, TIOCSETD, &olddisc);
        !            83:                        ioctl(0, TIOCLBIS, &aplmode);
        !            84: #endif
        !            85:                        printf("set terminal to apl mode\n");
        !            86:                }
        !            87:        } else {
        !            88:                /* Turn off apl mode */
        !            89: #ifndef vax
        !            90:                ioctl(0, TIOCSNOCTRL);
        !            91:                gtty(0, &m);
        !            92:                m.sg_flags &= ~APLMOD;
        !            93:                stty(0,&m);
        !            94: #else
        !            95:                if (apl_term)
        !            96:                        ioctl(0, TIOCSETD, &discsave);
        !            97:                ioctl(0, TIOCLSET, &modesave);
        !            98: #endif
        !            99:        }
        !           100: }
        !           101: #endif
        !           102: 
        !           103: 
        !           104: _cleanup()
        !           105: {
        !           106:        /* This prohibits the loading of the standard I/O "cleanup"
        !           107:         * code.  In addition, should any stdio routines be
        !           108:         * referenced, the loader will scream about multiple
        !           109:         * definitions of "_cleanup" and the offending stdio
        !           110:         * calls can be found and removed.
        !           111:         */
        !           112: }

unix.superglobalmegacorp.com

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