Get string value of configuration option. * Currently handles only boolean and compound options. */
| 8478 | * Currently handles only boolean and compound options. |
| 8479 | */ |
| 8480 | char * |
| 8481 | get_option_value(const char *optname, boolean cnfvalid) |
| 8482 | { |
| 8483 | static char retbuf[BUFSZ]; |
| 8484 | boolean *bool_p; |
| 8485 | int i; |
| 8486 | |
| 8487 | for (i = 0; allopt[i].name != 0; i++) |
| 8488 | if (!strcmp(optname, allopt[i].name)) { |
| 8489 | if (allopt[i].opttyp == BoolOpt |
| 8490 | && (bool_p = allopt[i].addr) != 0) { |
| 8491 | Sprintf(retbuf, "%s", *bool_p ? "true" : "false"); |
| 8492 | return retbuf; |
| 8493 | } else if (allopt[i].opttyp == CompOpt && allopt[i].optfn) { |
| 8494 | int reslt = optn_err; |
| 8495 | |
| 8496 | reslt = (*allopt[i].optfn)(allopt[i].idx, |
| 8497 | cnfvalid ? get_cnf_val : get_val, |
| 8498 | FALSE, retbuf, empty_optstr); |
| 8499 | if (reslt == optn_ok && retbuf[0]) |
| 8500 | return retbuf; |
| 8501 | return (char *) 0; |
| 8502 | } |
| 8503 | } |
| 8504 | return (char *) 0; |
| 8505 | } |
| 8506 | |
| 8507 | staticfn unsigned int |
| 8508 | longest_option_name(int startpass, int endpass) |
no outgoing calls
no test coverage detected