fix bug1
have string_for_opt() return the value string or empty_optstr to provide some level of crash protection if some future added option processing misbehaves. Callers of string_for_opt() and string_for_env_opt() should always check for a match to empty_optstr.
This commit is contained in:
21045
src/nhdat364
Normal file
21045
src/nhdat364
Normal file
File diff suppressed because one or more lines are too long
194
src/options.c
194
src/options.c
@@ -42,6 +42,8 @@ enum window_option_types {
|
|||||||
|
|
||||||
#define PILE_LIMIT_DFLT 5
|
#define PILE_LIMIT_DFLT 5
|
||||||
|
|
||||||
|
static char empty_optstr[] = {0};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: If you add (or delete) an option, please update the short
|
* NOTE: If you add (or delete) an option, please update the short
|
||||||
* options help (option_help()), the long options help (dat/opthelp),
|
* options help (option_help()), the long options help (dat/opthelp),
|
||||||
@@ -1067,7 +1069,7 @@ boolean val_optional;
|
|||||||
if (!colon || !*++colon) {
|
if (!colon || !*++colon) {
|
||||||
if (!val_optional)
|
if (!val_optional)
|
||||||
config_error_add("Missing parameter for '%s'", opts);
|
config_error_add("Missing parameter for '%s'", opts);
|
||||||
return (char *) 0;
|
return empty_optstr;
|
||||||
}
|
}
|
||||||
return colon;
|
return colon;
|
||||||
}
|
}
|
||||||
@@ -1080,7 +1082,7 @@ boolean val_optional;
|
|||||||
{
|
{
|
||||||
if (!initial) {
|
if (!initial) {
|
||||||
rejectoption(optname);
|
rejectoption(optname);
|
||||||
return (char *) 0;
|
return empty_optstr;
|
||||||
}
|
}
|
||||||
return string_for_opt(opts, val_optional);
|
return string_for_opt(opts, val_optional);
|
||||||
}
|
}
|
||||||
@@ -1159,7 +1161,7 @@ const char *optype;
|
|||||||
uchar translate[WARNCOUNT];
|
uchar translate[WARNCOUNT];
|
||||||
int length, i;
|
int length, i;
|
||||||
|
|
||||||
if (!(opts = string_for_env_opt(optype, opts, FALSE)))
|
if ((opts = string_for_env_opt(optype, opts, FALSE)) == empty_optstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
escapes(opts, opts);
|
escapes(opts, opts);
|
||||||
|
|
||||||
@@ -1953,7 +1955,8 @@ char **opp;
|
|||||||
|
|
||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
boolean val_negated = FALSE;
|
boolean val_negated = FALSE;
|
||||||
|
|
||||||
while ((*op == '!') || !strncmpi(op, "no", 2)) {
|
while ((*op == '!') || !strncmpi(op, "no", 2)) {
|
||||||
@@ -2150,7 +2153,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (match_optname(opts, fullname, 3, TRUE)) {
|
if (match_optname(opts, fullname, 3, TRUE)) {
|
||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
if ((op = string_for_env_opt(fullname, opts, negated)) != 0) {
|
if ((op = string_for_env_opt(fullname, opts, negated))
|
||||||
|
!= empty_optstr) {
|
||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2192,7 +2196,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
nmcpy(catname, op, PL_PSIZ);
|
nmcpy(catname, op, PL_PSIZ);
|
||||||
} else
|
} else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2207,7 +2212,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
nmcpy(dogname, op, PL_PSIZ);
|
nmcpy(dogname, op, PL_PSIZ);
|
||||||
} else
|
} else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2222,7 +2228,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
nmcpy(horsename, op, PL_PSIZ);
|
nmcpy(horsename, op, PL_PSIZ);
|
||||||
} else
|
} else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2237,7 +2244,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, (compat || !initial));
|
op = string_for_opt(opts, (compat || !initial));
|
||||||
if (!op) {
|
if (op == empty_optstr) {
|
||||||
if (compat || negated || initial) {
|
if (compat || negated || initial) {
|
||||||
/* for backwards compatibility, "mouse_support" without a
|
/* for backwards compatibility, "mouse_support" without a
|
||||||
value is a synonym for mouse_support:1 */
|
value is a synonym for mouse_support:1 */
|
||||||
@@ -2266,7 +2273,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, (compat || !initial));
|
op = string_for_opt(opts, (compat || !initial));
|
||||||
if (!op) {
|
if (op == empty_optstr) {
|
||||||
if (compat || negated || initial) {
|
if (compat || negated || initial) {
|
||||||
/* for backwards compatibility, "number_pad" without a
|
/* for backwards compatibility, "number_pad" without a
|
||||||
value is a synonym for number_pad:1 */
|
value is a synonym for number_pad:1 */
|
||||||
@@ -2309,7 +2316,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
|
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
symset[ROGUESET].name = dupstr(op);
|
symset[ROGUESET].name = dupstr(op);
|
||||||
if (!read_sym_file(ROGUESET)) {
|
if (!read_sym_file(ROGUESET)) {
|
||||||
clear_symsetentry(ROGUESET, TRUE);
|
clear_symsetentry(ROGUESET, TRUE);
|
||||||
@@ -2334,7 +2341,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
|
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
symset[PRIMARY].name = dupstr(op);
|
symset[PRIMARY].name = dupstr(op);
|
||||||
if (!read_sym_file(PRIMARY)) {
|
if (!read_sym_file(PRIMARY)) {
|
||||||
clear_symsetentry(PRIMARY, TRUE);
|
clear_symsetentry(PRIMARY, TRUE);
|
||||||
@@ -2357,7 +2364,7 @@ boolean tinitial, tfrom_file;
|
|||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
if (negated) {
|
if (negated) {
|
||||||
flags.runmode = RUN_TPORT;
|
flags.runmode = RUN_TPORT;
|
||||||
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
|
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
if (!strncmpi(op, "teleport", strlen(op)))
|
if (!strncmpi(op, "teleport", strlen(op)))
|
||||||
flags.runmode = RUN_TPORT;
|
flags.runmode = RUN_TPORT;
|
||||||
else if (!strncmpi(op, "run", strlen(op)))
|
else if (!strncmpi(op, "run", strlen(op)))
|
||||||
@@ -2381,7 +2388,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
if (!add_menu_coloring(op))
|
if (!add_menu_coloring(op))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else
|
} else
|
||||||
@@ -2394,7 +2402,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_env_opt(fullname, opts, negated);
|
op = string_for_env_opt(fullname, opts, negated);
|
||||||
if ((negated && !op) || (!negated && op)) {
|
if ((negated && op == empty_optstr)
|
||||||
|
|| (!negated && op != empty_optstr)) {
|
||||||
iflags.msg_history = negated ? 0 : atoi(op);
|
iflags.msg_history = negated ? 0 : atoi(op);
|
||||||
} else if (negated) {
|
} else if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
@@ -2412,7 +2421,7 @@ boolean tinitial, tfrom_file;
|
|||||||
|
|
||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
if (!(op = string_for_opt(opts, TRUE))) {
|
if ((op = string_for_opt(opts, TRUE)) == empty_optstr) {
|
||||||
tmp = negated ? 's' : 'f';
|
tmp = negated ? 's' : 'f';
|
||||||
} else {
|
} else {
|
||||||
if (negated) {
|
if (negated) {
|
||||||
@@ -2481,7 +2490,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
if (opttype > 0 && !negated
|
if (opttype > 0 && !negated
|
||||||
&& (op = string_for_opt(opts, FALSE)) != 0) {
|
&& (op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
switch (opttype) {
|
switch (opttype) {
|
||||||
case MAP_OPTION:
|
case MAP_OPTION:
|
||||||
iflags.wc_fontsiz_map = atoi(op);
|
iflags.wc_fontsiz_map = atoi(op);
|
||||||
@@ -2505,7 +2514,7 @@ boolean tinitial, tfrom_file;
|
|||||||
config_error_add("Unknown %s parameter '%s'", fullname, opts);
|
config_error_add("Unknown %s parameter '%s'", fullname, opts);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (opttype > 0 && (op = string_for_opt(opts, FALSE)) != 0) {
|
if (opttype > 0 && (op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
wc_set_font_name(opttype, op);
|
wc_set_font_name(opttype, op);
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
set_font_name(opttype, op);
|
set_font_name(opttype, op);
|
||||||
@@ -2550,12 +2559,12 @@ boolean tinitial, tfrom_file;
|
|||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
op = string_for_opt(opts, TRUE);
|
op = string_for_opt(opts, TRUE);
|
||||||
if (!alternative_palette(op)) {
|
if (op == empty_optstr || !alternative_palette(op)) {
|
||||||
config_error_add("Error in palette parameter '%s'", op);
|
config_error_add("Error in palette parameter '%s'", op);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((op = string_for_opt(opts, FALSE)) != (char *) 0) {
|
if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
char *pt = op;
|
char *pt = op;
|
||||||
int cnt, tmp, reverse;
|
int cnt, tmp, reverse;
|
||||||
long rgb;
|
long rgb;
|
||||||
@@ -2611,14 +2620,14 @@ boolean tinitial, tfrom_file;
|
|||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated || !initial);
|
op = string_for_opt(opts, negated || !initial);
|
||||||
if (negated) {
|
if (negated) {
|
||||||
if (op) {
|
if (op != empty_optstr) {
|
||||||
bad_negation("fruit", TRUE);
|
bad_negation("fruit", TRUE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
op = &empty_str;
|
op = empty_optstr;
|
||||||
goto goodfruit;
|
goto goodfruit;
|
||||||
}
|
}
|
||||||
if (!op)
|
if (op == empty_optstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* stripped leading and trailing spaces, condensed internal ones in 3.6.2 */
|
/* stripped leading and trailing spaces, condensed internal ones in 3.6.2 */
|
||||||
mungspaces(op);
|
mungspaces(op);
|
||||||
@@ -2669,7 +2678,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
iflags.getpos_coords = GPCOORDS_NONE;
|
iflags.getpos_coords = GPCOORDS_NONE;
|
||||||
return retval;
|
return retval;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
static char gpcoords[] = { GPCOORDS_NONE, GPCOORDS_COMPASS,
|
static char gpcoords[] = { GPCOORDS_NONE, GPCOORDS_COMPASS,
|
||||||
GPCOORDS_COMFULL, GPCOORDS_MAP,
|
GPCOORDS_COMFULL, GPCOORDS_MAP,
|
||||||
GPCOORDS_SCREEN, '\0' };
|
GPCOORDS_SCREEN, '\0' };
|
||||||
@@ -2693,7 +2703,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
iflags.getloc_filter = GFILTER_NONE;
|
iflags.getloc_filter = GFILTER_NONE;
|
||||||
return retval;
|
return retval;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
char c = lowc(*op);
|
char c = lowc(*op);
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -2739,9 +2750,10 @@ boolean tinitial, tfrom_file;
|
|||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* if (!(opts = string_for_env_opt(fullname, opts, FALSE)))
|
/* if ((opts = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
== empty_optstr)
|
||||||
*/
|
*/
|
||||||
if (!(opts = string_for_opt(opts, FALSE)))
|
if ((opts = string_for_opt(opts, FALSE)) == empty_optstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
escapes(opts, opts);
|
escapes(opts, opts);
|
||||||
/* note: dummy monclass #0 has symbol value '\0'; we allow that--
|
/* note: dummy monclass #0 has symbol value '\0'; we allow that--
|
||||||
@@ -2790,7 +2802,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
nmcpy(plname, op, PL_NSIZ);
|
nmcpy(plname, op, PL_NSIZ);
|
||||||
} else
|
} else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -2805,7 +2818,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_opt(opts, negated)) != 0) {
|
} else if ((op = string_for_opt(opts, negated)) != empty_optstr) {
|
||||||
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
#if defined(WIN32) && defined(TTY_GRAPHICS)
|
||||||
set_altkeyhandler(op);
|
set_altkeyhandler(op);
|
||||||
#endif
|
#endif
|
||||||
@@ -2819,7 +2832,7 @@ boolean tinitial, tfrom_file;
|
|||||||
fullname = "align_status";
|
fullname = "align_status";
|
||||||
if (match_optname(opts, fullname, sizeof "align_status" - 1, TRUE)) {
|
if (match_optname(opts, fullname, sizeof "align_status" - 1, TRUE)) {
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if (op && !negated) {
|
if ((op != empty_optstr) && !negated) {
|
||||||
if (!strncmpi(op, "left", sizeof "left" - 1))
|
if (!strncmpi(op, "left", sizeof "left" - 1))
|
||||||
iflags.wc_align_status = ALIGN_LEFT;
|
iflags.wc_align_status = ALIGN_LEFT;
|
||||||
else if (!strncmpi(op, "top", sizeof "top" - 1))
|
else if (!strncmpi(op, "top", sizeof "top" - 1))
|
||||||
@@ -2846,7 +2859,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if (op && !negated) {
|
if ((op != empty_optstr) && !negated) {
|
||||||
if (!strncmpi(op, "left", sizeof "left" - 1))
|
if (!strncmpi(op, "left", sizeof "left" - 1))
|
||||||
iflags.wc_align_message = ALIGN_LEFT;
|
iflags.wc_align_message = ALIGN_LEFT;
|
||||||
else if (!strncmpi(op, "top", sizeof "top" - 1))
|
else if (!strncmpi(op, "top", sizeof "top" - 1))
|
||||||
@@ -2874,7 +2887,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (!(op = string_for_opt(opts, FALSE)))
|
} else if ((op = string_for_opt(opts, FALSE)) == empty_optstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!change_inv_order(op))
|
if (!change_inv_order(op))
|
||||||
@@ -2893,7 +2906,7 @@ boolean tinitial, tfrom_file;
|
|||||||
flags.paranoia_bits = 0; /* clear all */
|
flags.paranoia_bits = 0; /* clear all */
|
||||||
if (negated) {
|
if (negated) {
|
||||||
flags.paranoia_bits = 0; /* [now redundant...] */
|
flags.paranoia_bits = 0; /* [now redundant...] */
|
||||||
} else if ((op = string_for_opt(opts, TRUE)) != 0) {
|
} else if ((op = string_for_opt(opts, TRUE)) != empty_optstr) {
|
||||||
char *pp, buf[BUFSZ];
|
char *pp, buf[BUFSZ];
|
||||||
|
|
||||||
strncpy(buf, op, sizeof buf - 1);
|
strncpy(buf, op, sizeof buf - 1);
|
||||||
@@ -2959,7 +2972,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
switch (lowc(*op)) {
|
switch (lowc(*op)) {
|
||||||
case 'u': /* Unencumbered */
|
case 'u': /* Unencumbered */
|
||||||
flags.pickup_burden = UNENCUMBERED;
|
flags.pickup_burden = UNENCUMBERED;
|
||||||
@@ -3002,7 +3016,7 @@ boolean tinitial, tfrom_file;
|
|||||||
oc_to_str(flags.pickup_types, tbuf);
|
oc_to_str(flags.pickup_types, tbuf);
|
||||||
flags.pickup_types[0] = '\0'; /* all */
|
flags.pickup_types[0] = '\0'; /* all */
|
||||||
op = string_for_opt(opts, (compat || !initial));
|
op = string_for_opt(opts, (compat || !initial));
|
||||||
if (!op) {
|
if (op == empty_optstr) {
|
||||||
if (compat || negated || initial) {
|
if (compat || negated || initial) {
|
||||||
/* for backwards compatibility, "pickup" without a
|
/* for backwards compatibility, "pickup" without a
|
||||||
value is a synonym for autopickup of all types
|
value is a synonym for autopickup of all types
|
||||||
@@ -3074,12 +3088,12 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if ((negated && !op) || (!negated && op))
|
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr))
|
||||||
flags.pile_limit = negated ? 0 : atoi(op);
|
flags.pile_limit = negated ? 0 : atoi(op);
|
||||||
else if (negated) {
|
else if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else /* !op */
|
} else /* op == empty_optstr */
|
||||||
flags.pile_limit = PILE_LIMIT_DFLT;
|
flags.pile_limit = PILE_LIMIT_DFLT;
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if (flags.pile_limit < 0)
|
if (flags.pile_limit < 0)
|
||||||
@@ -3097,7 +3111,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate || negated)
|
if (duplicate || negated)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
op = string_for_opt(opts, FALSE);
|
op = string_for_opt(opts, FALSE);
|
||||||
if (!op)
|
if (op == empty_optstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) {
|
if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) {
|
||||||
wizard = discover = FALSE;
|
wizard = discover = FALSE;
|
||||||
@@ -3120,7 +3134,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if (op && !negated) {
|
if (op != empty_optstr && !negated) {
|
||||||
if (!strncmpi(op, "dialog", sizeof "dialog" - 1)) {
|
if (!strncmpi(op, "dialog", sizeof "dialog" - 1)) {
|
||||||
iflags.wc_player_selection = VIA_DIALOG;
|
iflags.wc_player_selection = VIA_DIALOG;
|
||||||
} else if (!strncmpi(op, "prompt", sizeof "prompt" - 1)) {
|
} else if (!strncmpi(op, "prompt", sizeof "prompt" - 1)) {
|
||||||
@@ -3167,14 +3181,14 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, TRUE);
|
op = string_for_opt(opts, TRUE);
|
||||||
if (op && negated) {
|
if (op != empty_optstr && negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* "disclose" without a value means "all with prompting"
|
/* "disclose" without a value means "all with prompting"
|
||||||
and negated means "none without prompting" */
|
and negated means "none without prompting" */
|
||||||
if (!op || !strcmpi(op, "all") || !strcmpi(op, "none")) {
|
if (op == empty_optstr || !strcmpi(op, "all") || !strcmpi(op, "none")) {
|
||||||
if (op && !strcmpi(op, "none"))
|
if (op != empty_optstr && !strcmpi(op, "none"))
|
||||||
negated = TRUE;
|
negated = TRUE;
|
||||||
for (num = 0; num < NUM_DISCLOSURE_OPTIONS; num++)
|
for (num = 0; num < NUM_DISCLOSURE_OPTIONS; num++)
|
||||||
flags.end_disclose[num] = negated
|
flags.end_disclose[num] = negated
|
||||||
@@ -3239,7 +3253,7 @@ boolean tinitial, tfrom_file;
|
|||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!(op = string_for_opt(opts, FALSE)))
|
if ((op = string_for_opt(opts, FALSE)) == empty_optstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
while (*op) {
|
while (*op) {
|
||||||
@@ -3288,7 +3302,7 @@ boolean tinitial, tfrom_file;
|
|||||||
fullname = "sortloot";
|
fullname = "sortloot";
|
||||||
if (match_optname(opts, fullname, 4, TRUE)) {
|
if (match_optname(opts, fullname, 4, TRUE)) {
|
||||||
op = string_for_env_opt(fullname, opts, FALSE);
|
op = string_for_env_opt(fullname, opts, FALSE);
|
||||||
if (op) {
|
if (op != empty_optstr) {
|
||||||
char c = lowc(*op);
|
char c = lowc(*op);
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -3314,7 +3328,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (op)
|
} else if (op != empty_optstr)
|
||||||
(void) feature_alert_opts(op, fullname);
|
(void) feature_alert_opts(op, fullname);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -3329,7 +3343,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
|
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
== empty_optstr) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!assign_videocolors(opts)) {
|
if (!assign_videocolors(opts)) {
|
||||||
@@ -3346,7 +3361,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
|
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
== empty_optstr) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!assign_videoshades(opts)) {
|
if (!assign_videoshades(opts)) {
|
||||||
@@ -3367,7 +3383,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
|
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
== empty_optstr) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!assign_video(opts)) {
|
if (!assign_video(opts)) {
|
||||||
@@ -3385,7 +3402,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
|
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
== empty_optstr) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!assign_soundcard(opts)) {
|
if (!assign_soundcard(opts)) {
|
||||||
@@ -3407,7 +3425,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if (op && !negated) {
|
if (op != empty_optstr && !negated) {
|
||||||
if (!strcmpi(op, "tiles"))
|
if (!strcmpi(op, "tiles"))
|
||||||
iflags.wc_map_mode = MAP_MODE_TILES;
|
iflags.wc_map_mode = MAP_MODE_TILES;
|
||||||
else if (!strncmpi(op, "ascii4x6", sizeof "ascii4x6" - 1))
|
else if (!strncmpi(op, "ascii4x6", sizeof "ascii4x6" - 1))
|
||||||
@@ -3455,7 +3473,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if ((negated && !op) || (!negated && op)) {
|
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
|
||||||
iflags.wc_scroll_amount = negated ? 1 : atoi(op);
|
iflags.wc_scroll_amount = negated ? 1 : atoi(op);
|
||||||
} else if (negated) {
|
} else if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
@@ -3471,7 +3489,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if ((negated && !op) || (!negated && op)) {
|
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
|
||||||
iflags.wc_scroll_margin = negated ? 5 : atoi(op);
|
iflags.wc_scroll_margin = negated ? 5 : atoi(op);
|
||||||
} else if (negated) {
|
} else if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
@@ -3489,7 +3507,7 @@ boolean tinitial, tfrom_file;
|
|||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
} else {
|
} else {
|
||||||
op = string_for_opt(opts, 0);
|
op = string_for_opt(opts, 0);
|
||||||
if (!op)
|
if (op == empty_optstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#ifdef TTY_GRAPHICS
|
#ifdef TTY_GRAPHICS
|
||||||
map_subkeyvalue(op);
|
map_subkeyvalue(op);
|
||||||
@@ -3506,7 +3524,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if ((negated && !op) || (!negated && op)) {
|
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
|
||||||
iflags.wc_tile_width = negated ? 0 : atoi(op);
|
iflags.wc_tile_width = negated ? 0 : atoi(op);
|
||||||
} else if (negated) {
|
} else if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
@@ -3520,7 +3538,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (match_optname(opts, fullname, sizeof "tile_file" - 1, TRUE)) {
|
if (match_optname(opts, fullname, sizeof "tile_file" - 1, TRUE)) {
|
||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
if ((op = string_for_opt(opts, FALSE)) != 0) {
|
if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
if (iflags.wc_tile_file)
|
if (iflags.wc_tile_file)
|
||||||
free(iflags.wc_tile_file);
|
free(iflags.wc_tile_file);
|
||||||
iflags.wc_tile_file = dupstr(op);
|
iflags.wc_tile_file = dupstr(op);
|
||||||
@@ -3535,7 +3553,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if ((negated && !op) || (!negated && op)) {
|
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
|
||||||
iflags.wc_tile_height = negated ? 0 : atoi(op);
|
iflags.wc_tile_height = negated ? 0 : atoi(op);
|
||||||
} else if (negated) {
|
} else if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
@@ -3551,7 +3569,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if ((negated && !op) || (!negated && op)) {
|
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
|
||||||
iflags.wc_vary_msgcount = negated ? 0 : atoi(op);
|
iflags.wc_vary_msgcount = negated ? 0 : atoi(op);
|
||||||
} else if (negated) {
|
} else if (negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
@@ -3582,7 +3600,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
if (!iflags.windowtype_deferred) {
|
if (!iflags.windowtype_deferred) {
|
||||||
char buf[WINTYPELEN];
|
char buf[WINTYPELEN];
|
||||||
|
|
||||||
@@ -3602,7 +3621,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
!= empty_optstr) {
|
||||||
char buf[WINTYPELEN];
|
char buf[WINTYPELEN];
|
||||||
|
|
||||||
nmcpy(buf, op, WINTYPELEN);
|
nmcpy(buf, op, WINTYPELEN);
|
||||||
@@ -3621,7 +3641,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (match_optname(opts, fullname, 7, TRUE)) {
|
if (match_optname(opts, fullname, 7, TRUE)) {
|
||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
if ((op = string_for_opt(opts, FALSE)) != 0) {
|
if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
if (!wc_set_window_colors(op)) {
|
if (!wc_set_window_colors(op)) {
|
||||||
config_error_add("Could not set %s '%s'", fullname, op);
|
config_error_add("Could not set %s '%s'", fullname, op);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -3644,22 +3664,23 @@ boolean tinitial, tfrom_file;
|
|||||||
|| (fullname = "term_rows", match_optname(opts, fullname, 8, TRUE))) {
|
|| (fullname = "term_rows", match_optname(opts, fullname, 8, TRUE))) {
|
||||||
long ltmp;
|
long ltmp;
|
||||||
|
|
||||||
op = string_for_opt(opts, negated);
|
if ((op = string_for_opt(opts, negated)) != empty_optstr) {
|
||||||
ltmp = atol(op);
|
ltmp = atol(op);
|
||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
|
|
||||||
/* this just checks atol() sanity, not logical window size sanity */
|
/* this just checks atol() sanity, not logical window size sanity */
|
||||||
} else if (ltmp <= 0L || ltmp >= (long) LARGEST_INT) {
|
} else if (ltmp <= 0L || ltmp >= (long) LARGEST_INT) {
|
||||||
config_error_add("Invalid %s: %ld", fullname, ltmp);
|
config_error_add("Invalid %s: %ld", fullname, ltmp);
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!strcmp(fullname, "term_rows"))
|
if (!strcmp(fullname, "term_rows"))
|
||||||
iflags.wc2_term_rows = (int) ltmp;
|
iflags.wc2_term_rows = (int) ltmp;
|
||||||
else /* !strcmp(fullname, "term_cols") */
|
else /* !strcmp(fullname, "term_cols") */
|
||||||
iflags.wc2_term_cols = (int) ltmp;
|
iflags.wc2_term_cols = (int) ltmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -3669,10 +3690,10 @@ boolean tinitial, tfrom_file;
|
|||||||
fullname = "petattr";
|
fullname = "petattr";
|
||||||
if (match_optname(opts, fullname, sizeof "petattr" - 1, TRUE)) {
|
if (match_optname(opts, fullname, sizeof "petattr" - 1, TRUE)) {
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if (op && negated) {
|
if (op != empty_optstr && negated) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
} else if (op) {
|
} else if (op != empty_optstr) {
|
||||||
#ifdef CURSES_GRAPHICS
|
#ifdef CURSES_GRAPHICS
|
||||||
int itmp = curses_read_attrs(op);
|
int itmp = curses_read_attrs(op);
|
||||||
|
|
||||||
@@ -3703,7 +3724,7 @@ boolean tinitial, tfrom_file;
|
|||||||
fullname = "windowborders";
|
fullname = "windowborders";
|
||||||
if (match_optname(opts, fullname, 10, TRUE)) {
|
if (match_optname(opts, fullname, 10, TRUE)) {
|
||||||
op = string_for_opt(opts, negated);
|
op = string_for_opt(opts, negated);
|
||||||
if (negated && op) {
|
if (negated && op != empty_optstr) {
|
||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
} else {
|
} else {
|
||||||
@@ -3711,7 +3732,7 @@ boolean tinitial, tfrom_file;
|
|||||||
|
|
||||||
if (negated)
|
if (negated)
|
||||||
itmp = 0; /* Off */
|
itmp = 0; /* Off */
|
||||||
else if (!op)
|
else if (op == empty_optstr)
|
||||||
itmp = 1; /* On */
|
itmp = 1; /* On */
|
||||||
else /* Value supplied; expect 0 (off), 1 (on), or 2 (auto) */
|
else /* Value supplied; expect 0 (off), 1 (on), or 2 (auto) */
|
||||||
itmp = atoi(op);
|
itmp = atoi(op);
|
||||||
@@ -3739,7 +3760,7 @@ boolean tinitial, tfrom_file;
|
|||||||
bad_negation(fullname, TRUE);
|
bad_negation(fullname, TRUE);
|
||||||
itmp = 2;
|
itmp = 2;
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
} else if (op) {
|
} else if (op != empty_optstr) {
|
||||||
itmp = atoi(op);
|
itmp = atoi(op);
|
||||||
}
|
}
|
||||||
if (itmp < 2 || itmp > 3) {
|
if (itmp < 2 || itmp > 3) {
|
||||||
@@ -3761,7 +3782,7 @@ boolean tinitial, tfrom_file;
|
|||||||
|
|
||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
if (!(op = string_for_opt(opts, !val_required))) {
|
if ((op = string_for_opt(opts, !val_required)) == empty_optstr) {
|
||||||
if (val_required)
|
if (val_required)
|
||||||
return FALSE; /* string_for_opt gave feedback */
|
return FALSE; /* string_for_opt gave feedback */
|
||||||
tmp = negated ? 'n' : 'f';
|
tmp = negated ? 'n' : 'f';
|
||||||
@@ -3802,7 +3823,8 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
|
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
|
||||||
|
== empty_optstr) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
tmpattr = match_str2attr(opts, TRUE);
|
tmpattr = match_str2attr(opts, TRUE);
|
||||||
@@ -3822,7 +3844,7 @@ boolean tinitial, tfrom_file;
|
|||||||
if (negated) {
|
if (negated) {
|
||||||
bad_negation(fullname, FALSE);
|
bad_negation(fullname, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
|
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
|
||||||
char c, op_buf[BUFSZ];
|
char c, op_buf[BUFSZ];
|
||||||
|
|
||||||
escapes(op, op_buf);
|
escapes(op, op_buf);
|
||||||
@@ -3844,10 +3866,10 @@ boolean tinitial, tfrom_file;
|
|||||||
if (duplicate)
|
if (duplicate)
|
||||||
complain_about_duplicate(opts, 1);
|
complain_about_duplicate(opts, 1);
|
||||||
op = string_for_opt(opts, TRUE);
|
op = string_for_opt(opts, TRUE);
|
||||||
if (op && negated) {
|
if (op != empty_optstr && negated) {
|
||||||
clear_status_hilites();
|
clear_status_hilites();
|
||||||
return retval;
|
return retval;
|
||||||
} else if (!op) {
|
} else if (op == empty_optstr) {
|
||||||
config_error_add("Value is mandatory for hilite_status");
|
config_error_add("Value is mandatory for hilite_status");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -3868,7 +3890,7 @@ boolean tinitial, tfrom_file;
|
|||||||
iflags.hilite_delta = 0L;
|
iflags.hilite_delta = 0L;
|
||||||
} else {
|
} else {
|
||||||
op = string_for_opt(opts, TRUE);
|
op = string_for_opt(opts, TRUE);
|
||||||
iflags.hilite_delta = (!op || !*op) ? 3L : atol(op);
|
iflags.hilite_delta = (op == empty_optstr || !*op) ? 3L : atol(op);
|
||||||
if (iflags.hilite_delta < 0L)
|
if (iflags.hilite_delta < 0L)
|
||||||
iflags.hilite_delta = 1L;
|
iflags.hilite_delta = 1L;
|
||||||
}
|
}
|
||||||
@@ -4013,7 +4035,7 @@ boolean tinitial, tfrom_file;
|
|||||||
}
|
}
|
||||||
|
|
||||||
op = string_for_opt(opts, TRUE);
|
op = string_for_opt(opts, TRUE);
|
||||||
if (op) {
|
if (op != empty_optstr) {
|
||||||
if (negated) {
|
if (negated) {
|
||||||
config_error_add(
|
config_error_add(
|
||||||
"Negated boolean '%s' should not have a parameter",
|
"Negated boolean '%s' should not have a parameter",
|
||||||
|
|||||||
Reference in New Issue
Block a user