Parse action names. */
| 10021 | |
| 10022 | /** Parse action names. */ |
| 10023 | static int |
| 10024 | parse_action(struct context *ctx, const struct token *token, |
| 10025 | const char *str, unsigned int len, |
| 10026 | void *buf, unsigned int size) |
| 10027 | { |
| 10028 | struct buffer *out = buf; |
| 10029 | const struct arg *arg = pop_args(ctx); |
| 10030 | unsigned int i; |
| 10031 | |
| 10032 | (void)size; |
| 10033 | /* Argument is expected. */ |
| 10034 | if (!arg) |
| 10035 | return -1; |
| 10036 | /* Parse action name. */ |
| 10037 | for (i = 0; next_action[i]; ++i) { |
| 10038 | const struct parse_action_priv *priv; |
| 10039 | |
| 10040 | token = &token_list[next_action[i]]; |
| 10041 | if (strcmp_partial(token->name, str, len)) |
| 10042 | continue; |
| 10043 | priv = token->priv; |
| 10044 | if (!priv) |
| 10045 | goto error; |
| 10046 | if (out) |
| 10047 | memcpy((uint8_t *)ctx->object + arg->offset, |
| 10048 | &priv->type, |
| 10049 | arg->size); |
| 10050 | return len; |
| 10051 | } |
| 10052 | error: |
| 10053 | push_args(ctx, arg); |
| 10054 | return -1; |
| 10055 | } |
| 10056 | |
| 10057 | /** Parse tokens for list command. */ |
| 10058 | static int |
nothing calls this directly
no test coverage detected