MCPcopy Create free account
hub / github.com/NetHack/NetHack / key2txt

Function key2txt

src/cmd.c:3224–3240  ·  view source on GitHub ↗

returns the text for a one-byte encoding; * must be shorter than a tab for proper formatting */

Source from the content-addressed store, hash-verified

3222/* returns the text for a one-byte encoding;
3223 * must be shorter than a tab for proper formatting */
3224char *
3225key2txt(uchar c, char *txt) /* sufficiently long buffer */
3226{
3227 /* should probably switch to "SPC", "ESC", "RET"
3228 since nethack's documentation uses ESC for <escape> */
3229 if (c == ' ')
3230 Sprintf(txt, "<space>");
3231 else if (c == '\033')
3232 Sprintf(txt, "<esc>"); /* "<escape>" won't fit */
3233 else if (c == '\n')
3234 Sprintf(txt, "<enter>"); /* "<return>" won't fit */
3235 else if (c == '\177')
3236 Sprintf(txt, "<del>"); /* "<delete>" won't fit */
3237 else
3238 Strcpy(txt, visctrl((char) c));
3239 return txt;
3240}
3241
3242
3243void

Callers 9

tty_yn_functionFunction · 0.85
dowhatdoes_coreFunction · 0.85
get_changed_key_bindsFunction · 0.85
handler_rebind_keys_addFunction · 0.85
keylist_putcmdsFunction · 0.85
dokeylistFunction · 0.85
get_countFunction · 0.85
yn_function_menuFunction · 0.85
yn_functionFunction · 0.85

Calls 1

visctrlFunction · 0.85

Tested by

no test coverage detected