| 3135 | } |
| 3136 | |
| 3137 | staticfn int |
| 3138 | optfn_petattr( |
| 3139 | int optidx, int req, boolean negated, |
| 3140 | char *opts, char *op) |
| 3141 | { |
| 3142 | int retval = optn_ok; |
| 3143 | |
| 3144 | if (req == do_init) { |
| 3145 | return optn_ok; |
| 3146 | } |
| 3147 | if (req == do_set) { |
| 3148 | /* WINCAP2 petattr:string */ |
| 3149 | |
| 3150 | op = string_for_opt(opts, negated); |
| 3151 | if (op != empty_optstr && negated) { |
| 3152 | bad_negation(allopt[optidx].name, TRUE); |
| 3153 | retval = optn_err; |
| 3154 | } else if (op != empty_optstr) { |
| 3155 | #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS) |
| 3156 | int itmp = match_str2attr(op, FALSE); |
| 3157 | |
| 3158 | if (itmp == -1) { |
| 3159 | config_error_add("Unknown %s parameter '%s'", |
| 3160 | allopt[optidx].name, opts); |
| 3161 | retval = optn_err; |
| 3162 | } else |
| 3163 | iflags.wc2_petattr = itmp; |
| 3164 | #else |
| 3165 | iflags.wc2_petattr = ATR_INVERSE; |
| 3166 | #endif |
| 3167 | } else if (negated) { |
| 3168 | iflags.wc2_petattr = ATR_NONE; |
| 3169 | } |
| 3170 | if (retval != optn_err) { |
| 3171 | iflags.hilite_pet = (iflags.wc2_petattr != ATR_NONE); |
| 3172 | if (!go.opt_initial) |
| 3173 | go.opt_need_redraw = TRUE; |
| 3174 | } |
| 3175 | return retval; |
| 3176 | } |
| 3177 | if (req == get_val || req == get_cnf_val) { |
| 3178 | #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS) |
| 3179 | if (WINDOWPORT(tty) || WINDOWPORT(curses)) { |
| 3180 | Strcpy(opts, attr2attrname(iflags.wc2_petattr)); |
| 3181 | } else |
| 3182 | #endif |
| 3183 | if (iflags.wc2_petattr != 0) |
| 3184 | Sprintf(opts, "0x%08x", iflags.wc2_petattr); |
| 3185 | else if (req == get_cnf_val) |
| 3186 | opts[0] = '\0'; |
| 3187 | else |
| 3188 | Strcpy(opts, defopt); |
| 3189 | } |
| 3190 | if (req == do_handler) { |
| 3191 | return handler_petattr(); |
| 3192 | } |
| 3193 | return optn_ok; |
| 3194 | } |
nothing calls this directly
no test coverage detected