diff options
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -426,7 +426,7 @@ return_code_section_parser (enum grecs_callback_command cmd, } static char ** -config_array_to_argv (grecs_value_t *val, grecs_locus_t *locus) +config_array_to_argv (grecs_value_t *val, grecs_locus_t *locus, size_t *pargc) { int i, j; int argc; @@ -441,6 +441,8 @@ config_array_to_argv (grecs_value_t *val, grecs_locus_t *locus) argv[j++] = xstrdup (val->v.arg.v[i].v.string); } argv[j] = NULL; + if (pargc) + *pargc = argc; return argv; } @@ -449,8 +451,7 @@ _cb_command (enum grecs_callback_command cmd, grecs_locus_t * locus, void *varptr, grecs_value_t * value, void *cb_data) { - int argc; - char **argv, ***pargv = varptr; + struct component *comp = varptr; struct wordsplit ws; switch (value->type) @@ -461,20 +462,18 @@ _cb_command (enum grecs_callback_command cmd, grecs_error (locus, 0, "wordsplit: %s", strerror (errno)); return 1; } - argc = ws.ws_wordc; - argv = ws.ws_wordv; - ws.ws_wordv = NULL; + comp->argc = ws.ws_wordc; + comp->argv = ws.ws_wordv; break; case GRECS_TYPE_ARRAY: - argv = config_array_to_argv (value, locus); + comp->argv = config_array_to_argv (value, locus, &comp->argc); break; case GRECS_TYPE_LIST: grecs_error (locus, 0, _("unexpected list")); return 1; } - *pargv = argv; return 0; } @@ -524,7 +523,7 @@ _cb_env (enum grecs_callback_command cmd, break; case GRECS_TYPE_ARRAY: - argv = config_array_to_argv (value, locus); + argv = config_array_to_argv (value, locus, NULL); break; case GRECS_TYPE_LIST: @@ -777,7 +776,7 @@ struct grecs_keyword component_keywords[] = { {"command", NULL, N_("Command line."), - grecs_type_string, NULL, offsetof (struct component, argv), + grecs_type_string, NULL, 0, _cb_command, }, {"prerequisites", |