control of command-line usage entry in '?' menu

Instead of using a compile-time macro to suppress inclusion of the
menu entry to show UNIX command-line usage in the help menu, use a
sysconf setting instead.

Default is HIDEUSAGE=0, to include the entry for command-line usage.
Set HIDEUSAGE=1 to exclude that.  Does not affect 'nethack --usage'
if player actually has access to the command-line.
This commit is contained in:
PatR
2022-11-18 17:54:17 -08:00
parent 9a7f8418ee
commit 3278d7e0c1
9 changed files with 32 additions and 17 deletions

View File

@@ -2577,6 +2577,9 @@ parse_config_line(char *origbuf)
}
sysopt.seduce = n;
sysopt_seduce_set(sysopt.seduce);
} else if (in_sysconf && match_varname(buf, "HIDEUSAGE", 9)) {
n = !!atoi(bufp);
sysopt.hideusage = n;
} else if (in_sysconf && match_varname(buf, "MAXPLAYERS", 10)) {
n = atoi(bufp);
/* XXX to get more than 25, need to rewrite all lock code */

View File

@@ -32,9 +32,7 @@ static void dispfile_optionfile(void);
static void dispfile_optmenu(void);
static void dispfile_license(void);
static void dispfile_debughelp(void);
#ifndef HIDE_USAGE
static void dispfile_usagehelp(void);
#endif
static void hmenu_doextversion(void);
static void hmenu_dohistory(void);
static void hmenu_dowhatis(void);
@@ -2358,13 +2356,11 @@ dispfile_debughelp(void)
display_file(DEBUGHELP, TRUE);
}
#ifndef HIDE_USAGE
static void
dispfile_usagehelp(void)
{
display_file(USAGEHELP, TRUE);
}
#endif
static void
hmenu_doextversion(void)
@@ -2423,9 +2419,7 @@ static const struct {
{ dokeylist, "Full list of keyboard commands." },
{ hmenu_doextlist, "List of extended commands." },
{ domenucontrols, "List menu control keys." },
#ifndef HIDE_USAGE
{ dispfile_usagehelp, "Description of NetHack's command line." },
#endif
{ dispfile_license, "The NetHack license." },
{ docontact, "Support information." },
#ifdef PORT_HELP
@@ -2455,6 +2449,9 @@ dohelp(void)
for (i = 0; help_menu_items[i].text; i++) {
if (!wizard && help_menu_items[i].f == dispfile_debughelp)
continue;
if (sysopt.hideusage && help_menu_items[i].f == dispfile_usagehelp)
continue;
if (help_menu_items[i].text[0] == '%') {
Sprintf(helpbuf, help_menu_items[i].text, PORT_ID);
} else if (help_menu_items[i].f == dispfile_optmenu) {

View File

@@ -81,6 +81,10 @@ sys_early_init(void)
#ifdef WIN32
sysopt.portable_device_paths = 0;
#endif
/* help menu */
sysopt.hideusage = 0;
return;
}