[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.10

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