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

Function setopt_cmd

src/pager.c:2907–2957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2905 with the implementation of a simple options subset, now need 'mO' to get
2906 the full options command; format it as 'm O' */
2907staticfn char *
2908setopt_cmd(char *outbuf)
2909{
2910 char cmdbuf[QBUFSZ];
2911 const char *cmdnm;
2912 char key;
2913
2914 Strcpy(outbuf, "\'");
2915 /* #optionsfull */
2916 key = cmd_from_func(doset);
2917 if (key) {
2918 Strcat(outbuf, visctrl(key));
2919 } else {
2920 /* extended command name, with leading "#" */
2921 cmdnm = cmdname_from_func(doset, cmdbuf, TRUE);
2922 if (!cmdnm) /* paranoia */
2923 cmdnm = "optionsfull";
2924 Sprintf(eos(outbuf), "%s%.31s", (*cmdnm != '#') ? "#" : "", cmdnm);
2925
2926 /* since there's no key bound to #optionsfull, include 'm O' */
2927 Strcat(outbuf, "\' or \'");
2928 /* m prefix plus #options */
2929 key = cmd_from_func(do_reqmenu);
2930 if (key) {
2931 /* key for 'm' prefix */
2932 Strcat(outbuf, visctrl(key));
2933 } else {
2934 /* extended command name for 'm' prefix */
2935 cmdnm = cmdname_from_func(do_reqmenu, cmdbuf, TRUE);
2936 if (!cmdnm)
2937 cmdnm = "reqmenu";
2938 Sprintf(eos(outbuf), "%s%.31s", (*cmdnm != '#') ? "#" : "", cmdnm);
2939 }
2940 /* this is slightly iffy because the user shouldn't type <space> to
2941 get the command we're describing, but it improves readability */
2942 Strcat(outbuf, " ");
2943 /* now #options, normally 'O' */
2944 key = cmd_from_func(doset_simple);
2945 if (key) {
2946 Strcat(outbuf, visctrl(key));
2947 } else {
2948 /* extended command name */
2949 cmdnm = cmdname_from_func(doset_simple, cmdbuf, TRUE);
2950 if (!cmdnm) /* paranoia */
2951 cmdnm = "options";
2952 Sprintf(eos(outbuf), "%s%.31s", (*cmdnm != '#') ? "#" : "", cmdnm);
2953 }
2954 }
2955 Strcat(outbuf, "\'");
2956 return outbuf;
2957}
2958
2959/* the 'V' command; also a choice for '?' */
2960int

Callers 1

dohelpFunction · 0.85

Calls 4

cmd_from_funcFunction · 0.85
visctrlFunction · 0.85
cmdname_from_funcFunction · 0.85
eosFunction · 0.85

Tested by

no test coverage detected