aboutsummaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/comp.c b/src/comp.c
index 25f2657..499dfe5 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -173,2 +173,3 @@ component_free (struct component *comp)
free (comp->program);
+ free (comp->command);
if (comp->argv)
@@ -749,2 +750,25 @@ 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)

Return to:

Send suggestions and report system problems to the System administrator.