Annotation of coherent/g/usr/bin/me/tinfo.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Routines to use terminfo from emacs.
        !             3:  */
        !             4: #include <stdio.h>
        !             5: #include "ed.h"
        !             6: #include <term.h>
        !             7: #if TERMNFO
        !             8: #define NROW   24      /* default rows on the screen */
        !             9: #define NCOL   80      /* default columns on the screen */
        !            10: 
        !            11: extern int     ttopen();
        !            12: extern int     ttgetc();
        !            13: extern int     ttputc();
        !            14: extern int     ttflush();
        !            15: extern int     ttclose();
        !            16: extern int     tnfomove();
        !            17: extern int     tnfoeeol();
        !            18: extern int     tnfoeeop();
        !            19: extern int     tnfobeep();
        !            20: extern int     tnfoopen();
        !            21: extern int     tnfostand();
        !            22: extern int     tput();
        !            23: extern char    *tgoto();
        !            24: extern char    *tgetstr();
        !            25: extern char    *realloc();
        !            26: 
        !            27: TERM term = {
        !            28:        NROW-1,
        !            29:        NCOL,
        !            30:        tnfoopen,
        !            31:        ttclose,
        !            32:        ttgetc,
        !            33:        ttputc,
        !            34:        ttflush,
        !            35:        tnfomove,
        !            36:        tnfoeeol,
        !            37:        tnfoeeop,
        !            38:        tnfobeep,
        !            39:        tnfostand
        !            40: };
        !            41: 
        !            42: /*
        !            43:  * Get terminfo information
        !            44:  */
        !            45: tnfoopen()
        !            46: {
        !            47:        static int fts;
        !            48:        int status;
        !            49: 
        !            50:        if (fts++) {
        !            51:                ttopen();
        !            52:                return;
        !            53:        }
        !            54:        setupterm(NULL, fileno(stdout), &status);
        !            55:        if (1 != status) {
        !            56:                printf("Terminfo setup failed\n");
        !            57:                exit(1);
        !            58:        }
        !            59:        term.t_ncol = columns;
        !            60:        term.t_nrow = lines - 1;
        !            61:        if (NULL == cursor_address) {
        !            62:                printf("Cursor address is not set in terminfo\n");
        !            63:                exit(1);
        !            64:        }
        !            65:        if (NULL == clear_screen) {
        !            66:                printf("Clear screen is not set in terminfo\n");
        !            67:                exit(1);
        !            68:        }
        !            69:        if (NULL == clr_eol) {
        !            70:                printf("Clear to end of line is not set in terminfo\n");
        !            71:                exit(1);
        !            72:        }
        !            73: 
        !            74:        ttopen();
        !            75: }
        !            76: 
        !            77: /*
        !            78:  * move to row and column.
        !            79:  */
        !            80: tnfomove(row, col)
        !            81: {
        !            82:        putp(tparm(cursor_address, row, col));
        !            83: }
        !            84: 
        !            85: /*
        !            86:  * Clear to end of line.
        !            87:  */
        !            88: tnfoeeol()
        !            89: {
        !            90:        putp(clr_eol);
        !            91: }
        !            92: 
        !            93: /*
        !            94:  * Clear screen.
        !            95:  */
        !            96: tnfoeeop()
        !            97: {
        !            98:        putp(clear_screen);
        !            99: }
        !           100: 
        !           101: /*
        !           102:  * Say beep
        !           103:  */
        !           104: tnfobeep()
        !           105: {
        !           106:        putp(bell);
        !           107: }
        !           108: 
        !           109: /*
        !           110:  * Set or clear standout mode.
        !           111:  */
        !           112: tnfostand(f)
        !           113: {
        !           114:        if (f)
        !           115:                putp(enter_standout_mode);
        !           116:        else
        !           117:                putp(exit_standout_mode);
        !           118: }
        !           119: #endif

unix.superglobalmegacorp.com

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