[BACK]Return to ttykbd.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Annotation of src/usr.bin/mg/ttykbd.c, Revision 1.5

1.1       deraadt     1: /*
                      2:  * Name:       MG 2a
1.2       millert     3:  *             Terminfo keyboard driver using key files
1.1       deraadt     4:  * Created:    22-Nov-1987 Mic Kaczmarczik (mic@emx.cc.utexas.edu)
                      5:  */
                      6:
                      7: #include       "def.h"
1.2       millert     8: #include       "kbd.h"
1.1       deraadt     9: #ifdef XKEYS
1.2       millert    10: #include       <term.h>
1.1       deraadt    11:
1.2       millert    12: #ifdef  FKEYS
1.1       deraadt    13: /*
                     14:  * Get keyboard character.  Very simple if you use keymaps and keys files.
                     15:  * Bob was right -- the old XKEYS code is not the right solution.
                     16:  * FKEYS code is not usefull other than to help debug FKEYS code in
                     17:  * extend.c.
                     18:  */
                     19:
1.5     ! millert    20: char           *keystrings[] = {NULL};
1.1       deraadt    21: #endif
                     22:
                     23: /*
1.2       millert    24:  * Turn on function keys using keypad_xmit, then load a keys file, if
                     25:  * available.  The keys file is located in the same manner as the startup
                     26:  * file is, depending on what startupfile() does on your system.
1.1       deraadt    27:  */
1.5     ! millert    28: extern int      ttputc();
1.1       deraadt    29:
                     30: ttykeymapinit()
                     31: {
1.5     ! millert    32:        extern int      dobindkey();    /* XXX */
        !            33:        char           *cp;
1.2       millert    34: #ifdef FKEYS
                     35:        /* Bind keypad function keys. */
                     36:        if (key_left)
1.3       millert    37:                dobindkey(map_table[0].p_map, "backward-char", key_left);
1.2       millert    38:        if (key_right)
1.3       millert    39:                dobindkey(map_table[0].p_map, "forward-char", key_right);
1.2       millert    40:        if (key_up)
1.3       millert    41:                dobindkey(map_table[0].p_map, "previous-line", key_up);
1.2       millert    42:        if (key_down)
1.3       millert    43:                dobindkey(map_table[0].p_map, "next-line", key_down);
1.2       millert    44:        if (key_beg)
1.3       millert    45:                dobindkey(map_table[0].p_map, "beginning-of-line", key_beg);
1.4       millert    46:        else if (key_home)
                     47:                dobindkey(map_table[0].p_map, "beginning-of-line", key_home);
1.2       millert    48:        if (key_end)
1.3       millert    49:                dobindkey(map_table[0].p_map, "end-of-line", key_end);
1.2       millert    50:        if (key_npage)
1.3       millert    51:                dobindkey(map_table[0].p_map, "scroll-up", key_npage);
1.2       millert    52:        if (key_ppage)
1.3       millert    53:                dobindkey(map_table[0].p_map, "scroll-down", key_ppage);
1.2       millert    54: #endif
1.1       deraadt    55: #ifndef        NO_STARTUP
                     56:        if (cp = gettermtype()) {
1.5     ! millert    57:                extern char    *startupfile();
1.1       deraadt    58:                if (((cp = startupfile(cp)) != NULL)
1.5     ! millert    59:                    && (load(cp) != TRUE))
1.1       deraadt    60:                        ewprintf("Error reading key initialization file");
                     61:        }
                     62: #endif
1.5     ! millert    63:        if (keypad_xmit)        /* turn on keypad        */
1.2       millert    64:                putpad(keypad_xmit, 1);
1.1       deraadt    65: }
                     66:
                     67: /*
                     68:  * Clean up the keyboard -- called by tttidy()
                     69:  */
                     70: ttykeymaptidy()
                     71: {
                     72:
1.2       millert    73:        if (keypad_local)
1.5     ! millert    74:                putpad(keypad_local, 1);        /* turn off keypad       */
1.1       deraadt    75: }
                     76:
                     77: #endif