=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/Attic/mode-key.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/tmux/Attic/mode-key.c 2009/07/28 07:03:32 1.10 --- src/usr.bin/tmux/Attic/mode-key.c 2009/07/28 17:05:10 1.11 *************** *** 1,4 **** ! /* $OpenBSD: mode-key.c,v 1.10 2009/07/28 07:03:32 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: mode-key.c,v 1.11 2009/07/28 17:05:10 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 18,23 **** --- 18,25 ---- #include + #include + #include "tmux.h" /* *************** *** 54,59 **** --- 56,63 ---- { MODEKEYEDIT_STARTOFLINE, "start-of-line" }, { MODEKEYEDIT_SWITCHMODE, "switch-mode" }, { MODEKEYEDIT_SWITCHMODEAPPEND, "switch-mode-append" }, + + { 0, NULL } }; /* Choice keys command strings. */ *************** *** 64,69 **** --- 68,75 ---- { MODEKEYCHOICE_PAGEDOWN, "page-down" }, { MODEKEYCHOICE_PAGEUP, "page-up" }, { MODEKEYCHOICE_UP, "up" }, + + { 0, NULL } }; /* Copy keys command strings. */ *************** *** 83,88 **** --- 89,96 ---- { MODEKEYCOPY_STARTOFLINE, "start-of-line" }, { MODEKEYCOPY_STARTSELECTION, "begin-selection" }, { MODEKEYCOPY_UP, "cursor-up" }, + + { 0, NULL } }; /* vi editing keys. */ *************** *** 274,279 **** --- 282,309 ---- for (; cmdstr->name != NULL; cmdstr++) { if (cmdstr->cmd == cmd) return (cmdstr->name); + } + return (NULL); + } + + enum mode_key_cmd + mode_key_fromstring(struct mode_key_cmdstr *cmdstr, const char *name) + { + for (; cmdstr->name != NULL; cmdstr++) { + if (strcasecmp(cmdstr->name, name) == 0) + return (cmdstr->cmd); + } + return (MODEKEY_NONE); + } + + const struct mode_key_table * + mode_key_findtable(const char *name) + { + const struct mode_key_table *mtab; + + for (mtab = mode_key_tables; mtab->name != NULL; mtab++) { + if (strcasecmp(name, mtab->name) == 0) + return (mtab); } return (NULL); }