* Handle a char of an option toggle command. */
(c)
| 437 | * Handle a char of an option toggle command. |
| 438 | */ |
| 439 | static int |
| 440 | mca_opt_char(c) |
| 441 | int c; |
| 442 | { |
| 443 | PARG parg; |
| 444 | |
| 445 | /* |
| 446 | * This may be a short option (single char), |
| 447 | * or one char of a long option name, |
| 448 | * or one char of the option parameter. |
| 449 | */ |
| 450 | if (curropt == NULL && len_cmdbuf() == 0) |
| 451 | { |
| 452 | int ret = mca_opt_first_char(c); |
| 453 | if (ret != NO_MCA) |
| 454 | return (ret); |
| 455 | } |
| 456 | if (optgetname) |
| 457 | { |
| 458 | /* We're getting a long option name. */ |
| 459 | if (!is_newline_char(c)) |
| 460 | return (mca_opt_nonfirst_char(c)); |
| 461 | if (curropt == NULL) |
| 462 | { |
| 463 | parg.p_string = get_cmdbuf(); |
| 464 | error("There is no --%s option", &parg); |
| 465 | return (MCA_DONE); |
| 466 | } |
| 467 | optgetname = FALSE; |
| 468 | cmd_reset(); |
| 469 | } else |
| 470 | { |
| 471 | if (is_erase_char(c)) |
| 472 | return (NO_MCA); |
| 473 | if (curropt != NULL) |
| 474 | /* We're getting the option parameter. */ |
| 475 | return (NO_MCA); |
| 476 | curropt = findopt(c); |
| 477 | if (curropt == NULL) |
| 478 | { |
| 479 | parg.p_string = propt(c); |
| 480 | error("There is no %s option", &parg); |
| 481 | return (MCA_DONE); |
| 482 | } |
| 483 | opt_lower = ASCII_IS_LOWER(c); |
| 484 | } |
| 485 | /* |
| 486 | * If the option which was entered does not take a |
| 487 | * parameter, toggle the option immediately, |
| 488 | * so user doesn't have to hit RETURN. |
| 489 | */ |
| 490 | if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || |
| 491 | !opt_has_param(curropt)) |
| 492 | { |
| 493 | toggle_option(curropt, opt_lower, "", optflag); |
| 494 | return (MCA_DONE); |
| 495 | } |
| 496 | /* |
no test coverage detected
searching dependent graphs…