diff options
Diffstat (limited to 'src/comp.c')
-rw-r--r-- | src/comp.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -171,6 +171,7 @@ component_free (struct component *comp) component_unlink (comp); free (comp->tag); free (comp->program); + free (comp->command); if (comp->argv) { for (i = 0; i < comp->argc; i++) @@ -747,6 +748,29 @@ component_verify (struct component *comp, grecs_locus_t *locus) void component_finish (struct component *comp, grecs_locus_t *locus) { + if (comp->flags & CF_SHELL) + { + comp->argc = 3; + comp->argv = grecs_calloc (comp->argc + 1, sizeof (comp->argv[0])); + comp->argv[0] = grecs_strdup (comp->program ? comp->program : "/bin/sh"); + comp->argv[1] = grecs_strdup ("-c"); + comp->argv[2] = grecs_strdup (comp->command); + comp->argv[3] = NULL; + } + else + { + struct wordsplit ws; + if (wordsplit (comp->command, &ws, WRDSF_DEFFLAGS)) + { + grecs_error (locus, 0, "wordsplit: %s", + wordsplit_strerror (&ws)); + component_free (comp); + return; + } + wordsplit_get_words (&ws, &comp->argc, &comp->argv); + wordsplit_free (&ws); + } + if (comp->prereq) comp->prereq->cmp = list_str_cmp; if (comp->depend) |