ARGSUSED */
| 220 | |
| 221 | /* ARGSUSED */ |
| 222 | void |
| 223 | race_key(Widget w, XEvent *event, String *params, Cardinal *num_params) |
| 224 | { |
| 225 | char ch, *mark; |
| 226 | char racechars[QBUFSZ]; |
| 227 | int i; |
| 228 | |
| 229 | nhUse(w); |
| 230 | nhUse(params); |
| 231 | nhUse(num_params); |
| 232 | |
| 233 | (void) memset(racechars, '\0', sizeof racechars); /* for strchr() */ |
| 234 | for (i = 0; races[i].noun; ++i) { |
| 235 | ch = lowc(*races[i].noun); |
| 236 | /* this supports at most two races with the same first letter */ |
| 237 | if (strchr(racechars, ch)) |
| 238 | ch = highc(ch); |
| 239 | racechars[i] = ch; |
| 240 | } |
| 241 | ch = key_event_to_char((XKeyEvent *) event); |
| 242 | if (ch == '\0') { /* don't accept nul char/modifier event */ |
| 243 | /* don't beep */ |
| 244 | return; |
| 245 | } |
| 246 | mark = strchr(racechars, ch); |
| 247 | if (!mark) |
| 248 | mark = strchr(racechars, lowc(ch)); |
| 249 | if (!mark) |
| 250 | mark = strchr(racechars, highc(ch)); |
| 251 | if (!mark) { |
| 252 | if (strchr(ps_randchars, ch)) |
| 253 | ps_selected = PS_RANDOM; |
| 254 | else if (strchr(ps_quitchars, ch)) |
| 255 | ps_selected = PS_QUIT; |
| 256 | else { |
| 257 | X11_nhbell(); /* no such race */ |
| 258 | return; |
| 259 | } |
| 260 | } else |
| 261 | ps_selected = (int) (mark - racechars); |
| 262 | exit_x_event = TRUE; |
| 263 | } |
| 264 | |
| 265 | /* ARGSUSED */ |
| 266 | void |
nothing calls this directly
no test coverage detected