| 2222 | } |
| 2223 | |
| 2224 | staticfn int |
| 2225 | optfn_menu_objsyms( |
| 2226 | int optidx, int req, |
| 2227 | boolean negated, |
| 2228 | char *opts, char *op) |
| 2229 | { |
| 2230 | if (req == do_init) { |
| 2231 | /* set iflags.menu_objsyms to 4, "conditional"; also sets |
| 2232 | iflags.menu_head_objsym to False and |
| 2233 | iflags.use_menu_glyphs True */ |
| 2234 | set_menuobjsyms_flags(4); |
| 2235 | return optn_ok; |
| 2236 | } |
| 2237 | if (req == do_set) { |
| 2238 | unsigned k, l; |
| 2239 | int i, osyms; |
| 2240 | |
| 2241 | if (negated) { |
| 2242 | /* allow '!menu_objsyms' (and '!use_menu_glyphs') as |
| 2243 | 'menu_objsyms:none' (0) */ |
| 2244 | osyms = 0; |
| 2245 | } else if (op == empty_optstr) { |
| 2246 | /* treat boolean 'menu_objsyms' as 'menu_objsyms:headers' (1) |
| 2247 | accept obsolete boolean 'use_menu_glyphs' as a synonym |
| 2248 | for 'menu_objsyms:entries' (2) */ |
| 2249 | osyms = !strncmp(opts, "use_menu_glyphs", 15) ? 2 : 1; |
| 2250 | } else if (digit(*op)) { |
| 2251 | i = atoi(op); |
| 2252 | if (i >= SIZE(objsymvals)) { |
| 2253 | config_error_add("Illegal %s parameter '%s'", |
| 2254 | allopt[optidx].name, op); |
| 2255 | return optn_err; |
| 2256 | } |
| 2257 | osyms = i; |
| 2258 | } else { |
| 2259 | /* stilted "one-or-other" is used to compress the menu width */ |
| 2260 | static const char alt5[] = "one-or-the-other"; |
| 2261 | unsigned l5 = (unsigned) (sizeof alt5 - sizeof ""); |
| 2262 | |
| 2263 | osyms = 0; |
| 2264 | k = (unsigned) strlen(op); |
| 2265 | for (i = 0; i < SIZE(objsymvals); ++i) { |
| 2266 | l = (unsigned) strlen(objsymvals[i].nam); |
| 2267 | if (k >= 4) |
| 2268 | l = k; |
| 2269 | if (!strncmpi(objsymvals[i].nam, op, l) |
| 2270 | || (i == 5 && !strncmpi(alt5, op, l5))) { |
| 2271 | osyms = i; |
| 2272 | break; |
| 2273 | } |
| 2274 | } |
| 2275 | } |
| 2276 | set_menuobjsyms_flags(osyms); |
| 2277 | return optn_ok; |
| 2278 | } |
| 2279 | if (req == get_val || req == get_cnf_val) { |
| 2280 | Sprintf(opts, "%s", objsymvals[iflags.menuobjsyms].nam); |
| 2281 | return optn_ok; |
nothing calls this directly
no test coverage detected