option fixes and missing prototypes

I added -Wmissing-prototypes to my CFLAGS and got a bunch of warnings.
This fixes the core ones (there are more for X11 that I haven't looked
at yet).  While fixing these, I discovered a few option processing
issues:  the non-Amiga 'altmeta' should be settable while the game is
in progress (not sure about the Amiga variation so left that as-is),
'altmeta' and 'menucolor' are booleans so shouldn't have had optfn_XXX
functions; 'MACgraphics' and 'subkeyvalue' were conditionally defined
differently in options.c than in optlist.h.
This commit is contained in:
PatR
2020-04-22 13:39:38 -07:00
parent f9f423b385
commit 0ae84411a0
6 changed files with 22 additions and 96 deletions

View File

@@ -672,40 +672,6 @@ char *op UNUSED;
return optn_ok;
}
int
optfn_altmeta(optidx, req, negated, opts, op)
int optidx UNUSED;
int req;
boolean negated UNUSED;
char *opts;
char *op UNUSED;
{
if (req == do_init) {
return optn_ok;
}
if (req == do_set) {
/* Amiga altmeta causes Alt+key to be converted into Meta+key by
low level nethack code; on by default, can be toggled off if
Alt+key is needed for some ASCII chars on non-ASCII keyboard */
/* non-Amiga altmeta causes nethack's top level command loop to treat
two character sequence "ESC c" as M-c, for terminals or emulators
which send "ESC c" when Alt+c is pressed; off by default, enabling
this can potentially make trouble if user types ESC when nethack
is honoring this conversion request (primarily after starting a
count prefix prior to a command and then deciding to cancel it) */
return optn_ok;
}
if (req == get_val) {
if (!opts)
return optn_err;
opts[0] = '\0';
return optn_err;
}
return optn_ok;
}
int
optfn_boulder(optidx, req, negated, opts, op)
int optidx UNUSED;
@@ -1467,23 +1433,15 @@ char *op UNUSED;
return optn_ok;
}
#if defined(BACKWARD_COMPAT) && defined(MAC_GRAPHICS_ENV)
int
optfn_MACgraphics(optidx, req, negated, opts, op)
#if defined(MAC_GRAPHICS_ENV) && defined(BACKWARD_COMPAT)
int optidx;
int req;
boolean negated;
char *opts;
char *op;
#else
int optidx UNUSED;
int req;
boolean negated UNUSED;
char *opts UNUSED;
char *op UNUSED;
#endif
{
#if defined(MAC_GRAPHICS_ENV) && defined(BACKWARD_COMPAT)
boolean badflag = FALSE;
if (req == do_init) {
@@ -1518,20 +1476,9 @@ char *op UNUSED;
opts[0] = '\0';
return optn_ok;
}
#else
if (req == do_set) {
config_error_add("'%s' %s; use 'symset:%s' instead",
allopt[optidx].name,
#ifdef MAC_GRAPHICS_ENV /* implies BACKWARD_COMPAT is not defined */
"no longer supported",
#else
"is not supported",
#endif
allopt[optidx].name);
}
#endif
return optn_ok;
}
#endif /* BACKWARD_COMPAT && MAC_GRAPHICS_ENV */
int
optfn_map_mode(optidx, req, negated, opts, op)
@@ -1951,36 +1898,6 @@ char *op UNUSED;
return optn_ok;
}
int
optfn_menucolor(optidx, req, negated, opts, op)
int optidx;
int req;
boolean negated UNUSED;
char *opts;
char *op;
{
if (req == do_init) {
return optn_ok;
}
if (req == do_set) {
/* menucolor:"regex_string"=color */
if ((op = string_for_env_opt(allopt[optidx].name, opts, FALSE))
!= empty_optstr) {
if (!add_menu_coloring(op))
return optn_err;
} else
return optn_err;
return optn_ok;
}
if (req == get_val) {
if (!opts)
return optn_err;
opts[0] = '\0';
return optn_ok;
}
return optn_ok;
}
int
optfn_menuinvertmode(optidx, req, negated, opts, op)
int optidx;
@@ -3468,6 +3385,7 @@ char *op;
return optn_ok;
}
#ifdef WIN32
int
optfn_subkeyvalue(optidx, req, negated, opts, op)
int optidx UNUSED;
@@ -3480,12 +3398,10 @@ char *op UNUSED;
return optn_ok;
}
if (req == do_set) {
#if defined(WIN32)
if (op == empty_optstr)
return optn_err;
#ifdef TTY_GRAPHICS
map_subkeyvalue(op);
#endif
#endif
return optn_ok;
}
@@ -3497,6 +3413,7 @@ char *op UNUSED;
}
return optn_ok;
}
#endif /* WIN32 */
int
optfn_suppress_alert(optidx, req, negated, opts, op)