| 24 | } |
| 25 | |
| 26 | const struct opt_table *configvar_unparsed(struct configvar *cv) |
| 27 | { |
| 28 | const struct opt_table *ot; |
| 29 | |
| 30 | if (cv->src == CONFIGVAR_CMDLINE_SHORT) { |
| 31 | ot = opt_find_short(cv->configline[0]); |
| 32 | cv->optarg = NULL; |
| 33 | } else { |
| 34 | ot = opt_find_long(cv->configline, cast_const2(const char **, &cv->optarg)); |
| 35 | } |
| 36 | if (!ot) |
| 37 | return NULL; |
| 38 | |
| 39 | /* We get called multiple times, but we're expected to always |
| 40 | * finish the cv vars, even if they're added at the last minute |
| 41 | * on the cmdline, so we check this is only done once, and we |
| 42 | * do it even if we're not going to use it now. */ |
| 43 | if (!cv->optvar) { |
| 44 | /* optvar is up to the = (i.e. one char before optarg) */ |
| 45 | if (!cv->optarg) |
| 46 | cv->optvar = cv->configline; |
| 47 | else |
| 48 | cv->optvar = tal_strndup(cv, cv->configline, |
| 49 | cv->optarg - cv->configline - 1); |
| 50 | } |
| 51 | return ot; |
| 52 | } |
| 53 | |
| 54 | static void trim_whitespace(char *s) |
| 55 | { |
no test coverage detected