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

Function visctrl

src/hacklib.c:468–493  ·  view source on GitHub ↗

make a displayable string from a character */

Source from the content-addressed store, hash-verified

466#define VISCTRL_NBUF 5
467/* make a displayable string from a character */
468char *
469visctrl(char c)
470{
471 static char visctrl_bufs[VISCTRL_NBUF][5];
472 static int nbuf = 0;
473 int i = 0;
474 char *ccc = visctrl_bufs[nbuf];
475 nbuf = (nbuf + 1) % VISCTRL_NBUF;
476
477 if ((uchar) c & 0200) {
478 ccc[i++] = 'M';
479 ccc[i++] = '-';
480 }
481 c &= 0177;
482 if (c < 040) {
483 ccc[i++] = '^';
484 ccc[i++] = c | 0100; /* letter */
485 } else if (c == 0177) {
486 ccc[i++] = '^';
487 ccc[i++] = c & ~0100; /* '?' */
488 } else {
489 ccc[i++] = c; /* printable character */
490 }
491 ccc[i] = '\0';
492 return ccc;
493}
494
495/* strip all the chars in stuff_to_strip from orig */
496/* caller is responsible for ensuring that bp is a

Callers 15

tty_get_ext_cmdFunction · 0.85
ExecMethod · 0.85
NetHackQtMainWindowMethod · 0.85
qt_yn_functionMethod · 0.85
qt_getlinMethod · 0.85
mswin_get_ext_cmdFunction · 0.85
curses_ext_cmdFunction · 0.85
X11_yn_function_coreFunction · 0.85
optfn_boulderFunction · 0.85
parsebindingsFunction · 0.85
illegal_menu_cmd_keyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected