* Parse a boolean value. * * Last argument (ctx->args) is retrieved to determine storage size and * location. */
| 11215 | * location. |
| 11216 | */ |
| 11217 | static int |
| 11218 | parse_boolean(struct context *ctx, const struct token *token, |
| 11219 | const char *str, unsigned int len, |
| 11220 | void *buf, unsigned int size) |
| 11221 | { |
| 11222 | const struct arg *arg = pop_args(ctx); |
| 11223 | unsigned int i; |
| 11224 | int ret; |
| 11225 | |
| 11226 | /* Argument is expected. */ |
| 11227 | if (!arg) |
| 11228 | return -1; |
| 11229 | for (i = 0; boolean_name[i]; ++i) |
| 11230 | if (!strcmp_partial(boolean_name[i], str, len)) |
| 11231 | break; |
| 11232 | /* Process token as integer. */ |
| 11233 | if (boolean_name[i]) |
| 11234 | str = i & 1 ? "1" : "0"; |
| 11235 | push_args(ctx, arg); |
| 11236 | ret = parse_int(ctx, token, str, strlen(str), buf, size); |
| 11237 | return ret > 0 ? (int)len : ret; |
| 11238 | } |
| 11239 | |
| 11240 | /** Parse port and update context. */ |
| 11241 | static int |
nothing calls this directly
no test coverage detected