MCPcopy Index your code
hub / github.com/NetHack/NetHack / doc_extcmd_flagstr

Function doc_extcmd_flagstr

src/cmd.c:523–557  ·  view source on GitHub ↗

format extended command flags for display */

Source from the content-addressed store, hash-verified

521
522/* format extended command flags for display */
523staticfn char *
524doc_extcmd_flagstr(
525 winid menuwin,
526 const struct ext_func_tab *efp) /* if Null, add a footnote to the menu */
527{
528 static char Abuf[10]; /* 5 would suffice: {'[','m','A',']','\0'} */
529
530 /* note: tag shown for menu prefix is 'm' even if m-prefix action
531 has been bound to some other key */
532 if (!efp) {
533 char qbuf[QBUFSZ];
534
535 add_menu_str(menuwin, "[A] Command autocompletes");
536 Sprintf(qbuf, "[m] Command accepts '%s' prefix",
537 visctrl(cmd_from_func(do_reqmenu)));
538 add_menu_str(menuwin, qbuf);
539 return (char *) 0;
540 } else {
541 boolean mprefix = accept_menu_prefix(efp),
542 autocomplete = (efp->flags & AUTOCOMPLETE) != 0;
543 char *p = Abuf;
544
545 /* "" or "[m]" or "[A]" or "[mA]" */
546 if (mprefix || autocomplete) {
547 *p++ = '[';
548 if (mprefix)
549 *p++ = 'm';
550 if (autocomplete)
551 *p++ = 'A';
552 *p++ = ']';
553 }
554 *p = '\0';
555 return Abuf;
556 }
557}
558
559/* here after #? - now list all full-word commands and provide
560 some navigation capability through the long list */

Callers 1

doextlistFunction · 0.85

Calls 4

add_menu_strFunction · 0.85
visctrlFunction · 0.85
cmd_from_funcFunction · 0.85
accept_menu_prefixFunction · 0.85

Tested by

no test coverage detected