MCPcopy Create free account
hub / github.com/NetHack/NetHack / optfn_menu_headings

Function optfn_menu_headings

src/options.c:2182–2222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2180/* end of shared key assignments for menu commands */
2181
2182staticfn int
2183optfn_menu_headings(
2184 int optidx,
2185 int req, boolean negated,
2186 char *opts, char *op)
2187{
2188 if (req == do_init) {
2189 return optn_ok;
2190 }
2191 if (req == do_set) {
2192 color_attr ca;
2193
2194 if (op == empty_optstr) {
2195 /* OPTIONS=menu_headings w/o value => no-color&inverse;
2196 OPTIONS=!menu_headings => no-color&none */
2197 iflags.menu_headings.attr = negated ? ATR_NONE : ATR_INVERSE;
2198 iflags.menu_headings.color = NO_COLOR;
2199 return optn_ok;
2200 } else if (negated) { /* 'op != empty_optstr' to get here */
2201 bad_negation(allopt[optidx].name, TRUE);
2202 return optn_silenterr;
2203 }
2204 if (!color_attr_parse_str(&ca, op))
2205 return optn_err;
2206 iflags.menu_headings = ca;
2207 return optn_ok;
2208 }
2209 if (req == get_val || req == get_cnf_val) {
2210 char ca_buf[BUFSZ];
2211
2212 Strcpy(ca_buf, color_attr_to_str(&iflags.menu_headings));
2213 /* change "no color" to "no-color" or "light blue" to "light-blue" */
2214 (void) strNsubst(ca_buf, " ", "-", 0);
2215 Strcpy(opts, ca_buf);
2216 return optn_ok;
2217 }
2218 if (req == do_handler) {
2219 return handler_menu_headings();
2220 }
2221 return optn_ok;
2222}
2223
2224staticfn int
2225optfn_menu_objsyms(

Callers

nothing calls this directly

Calls 5

bad_negationFunction · 0.85
color_attr_parse_strFunction · 0.85
color_attr_to_strFunction · 0.85
strNsubstFunction · 0.85
handler_menu_headingsFunction · 0.85

Tested by

no test coverage detected