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

Function doextlist

src/cmd.c:561–734  ·  view source on GitHub ↗

here after #? - now list all full-word commands and provide some navigation capability through the long list */

Source from the content-addressed store, hash-verified

559/* here after #? - now list all full-word commands and provide
560 some navigation capability through the long list */
561int
562doextlist(void)
563{
564 const struct ext_func_tab *efp = (struct ext_func_tab *) 0;
565 char buf[BUFSZ], searchbuf[BUFSZ], descbuf[BUFSZ], promptbuf[QBUFSZ];
566 const char *cmd_desc;
567 winid menuwin;
568 anything any;
569 menu_item *selected;
570 int n, pass;
571 int menumode = 0, menushown[2], onelist = 0;
572 boolean redisplay = TRUE, search = FALSE;
573 static const char *const headings[] = { "Extended commands",
574 "Debugging Extended Commands" };
575 int clr = NO_COLOR;
576
577 searchbuf[0] = '\0';
578 menuwin = create_nhwindow(NHW_MENU);
579
580 while (redisplay) {
581 redisplay = FALSE;
582 any = cg.zeroany;
583 start_menu(menuwin, MENU_BEHAVE_STANDARD);
584 add_menu_str(menuwin, "Extended Commands List");
585 add_menu_str(menuwin, "");
586
587 Sprintf(buf, "Switch to %s commands that don't autocomplete",
588 menumode ? "including" : "excluding");
589 any.a_int = 1;
590 add_menu(menuwin, &nul_glyphinfo, &any, 'a', 0, ATR_NONE, clr, buf,
591 MENU_ITEMFLAGS_NONE);
592
593 if (!*searchbuf) {
594 any.a_int = 2;
595 /* was 's', but then using ':' handling within the interface
596 would only examine the two or three meta entries, not the
597 actual list of extended commands shown via separator lines;
598 having ':' as an explicit selector overrides the default
599 menu behavior for it; we retain 's' as a group accelerator */
600 add_menu(menuwin, &nul_glyphinfo, &any, ':', 's', ATR_NONE,
601 clr, "Search extended commands",
602 MENU_ITEMFLAGS_NONE);
603 } else {
604 Strcpy(buf, "Switch back from search");
605 if (strlen(buf) + strlen(searchbuf) + strlen(" (\"\")") < QBUFSZ)
606 Sprintf(eos(buf), " (\"%s\")", searchbuf);
607 any.a_int = 3;
608 /* specifying ':' as a group accelerator here is mostly a
609 statement of intent (we'd like to accept it as a synonym but
610 also want to hide it from general menu use) because it won't
611 work for interfaces which support ':' to search; use as a
612 general menu command takes precedence over group accelerator */
613 add_menu(menuwin, &nul_glyphinfo, &any, 's', ':', ATR_NONE,
614 clr, buf, MENU_ITEMFLAGS_NONE);
615 }
616 if (wizard) {
617 any.a_int = 4;
618 add_menu(menuwin, &nul_glyphinfo, &any, 'z', 0, ATR_NONE, clr,

Callers 4

onWMCommandFunction · 0.85
extend_helpFunction · 0.85
hmenu_doextlistFunction · 0.85
onWMCommandFunction · 0.85

Calls 11

add_menu_strFunction · 0.85
add_menuFunction · 0.85
eosFunction · 0.85
strstriFunction · 0.85
strsubstFunction · 0.85
pmatchiFunction · 0.85
add_menu_headingFunction · 0.85
doc_extcmd_flagstrFunction · 0.85
select_menuFunction · 0.85
getlinFunction · 0.85
mungspacesFunction · 0.85

Tested by

no test coverage detected