diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-02-27 16:10:20 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-02-27 16:10:20 +0000 |
commit | c78789fa4ec8214c53515e6421628fe79c419d8d (patch) | |
tree | 75a4bdc38a5eca7760b4e2a56c0ac2de0c67a9fd /usr.bin/mg/extend.c | |
parent | 3b2a002cdf9548bd68ee80d3b9532fd7f5b3167d (diff) |
Move dobindkey() into extend.c where it belongs.
Diffstat (limited to 'usr.bin/mg/extend.c')
-rw-r--r-- | usr.bin/mg/extend.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c index 54f832fb7f1..f9f0ba95061 100644 --- a/usr.bin/mg/extend.c +++ b/usr.bin/mg/extend.c @@ -372,6 +372,45 @@ int kcount; (VOID) doscan(curmap, c = *keys); return remap(curmap, c, funct, pref_map); } + +#ifdef FKEYS +/* + * Wrapper for bindkey() that converts escapes. + */ +int +dobindkey(map, func, str) + KEYMAP *map; + char *func; + char *str; +{ + int i; + + for (i = 0; *str && i < MAXKEY; i++) { + /* XXX - convert numbers w/ strol()? */ + if (*str != '\\') + key.k_chars[i] = *str; + else { + switch(*++str) { + case 't': case 'T': + key.k_chars[i] = '\t'; + break; + case 'n': case 'N': + key.k_chars[i] = '\n'; + break; + case 'r': case 'R': + key.k_chars[i] = '\r'; + break; + case 'e': case 'E': + key.k_chars[i] = CCHR('['); + break; + } + } + str++; + } + key.k_count = i; + return(bindkey(&map, func, key.k_chars, key.k_count)); +} +#endif #endif /* |