1 /* $OpenBSD: ttykbd.c,v 1.16 2012/04/12 04:47:59 lum Exp $ */
3 /* This file is in the public domain. */
7 * Terminfo keyboard driver using key files
8 * Created: 22-Nov-1987 Mic Kaczmarczik (mic@emx.cc.utexas.edu)
19 * Get keyboard character. Very simple if you use keymaps and keys files.
20 * Bob was right -- the old XKEYS code is not the right solution.
21 * FKEYS code is not useful other than to help debug FKEYS code in
25 char *keystrings[] = {NULL};
29 * Turn on function keys using keypad_xmit, then load a keys file, if
30 * available. The keys file is located in the same manner as the startup
31 * file is, depending on what startupfile() does on your system.
39 /* Bind keypad function keys. */
41 dobindkey(fundamental_map, "backward-char", key_left);
43 dobindkey(fundamental_map, "forward-char", key_right);
45 dobindkey(fundamental_map, "previous-line", key_up);
47 dobindkey(fundamental_map, "next-line", key_down);
49 dobindkey(fundamental_map, "beginning-of-line", key_beg);
51 dobindkey(fundamental_map, "beginning-of-line", key_home);
53 dobindkey(fundamental_map, "end-of-line", key_end);
55 dobindkey(fundamental_map, "scroll-up", key_npage);
57 dobindkey(fundamental_map, "scroll-down", key_ppage);
59 dobindkey(fundamental_map, "delete-char", key_dc);
62 if ((cp = getenv("TERM"))) {
63 if (((cp = startupfile(cp)) != NULL) && (load(cp) != TRUE))
64 ewprintf("Error reading key initialization file");
68 putpad(keypad_xmit, 1);
72 * Clean up the keyboard -- called by tttidy()
79 putpad(keypad_local, 1);