aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2004-08-12 08:39:19 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2004-08-12 08:39:19 +0000
commitf866ded1b9d248e09a032c346f4588e374caedc5 (patch)
tree0639bd81bd7632bf79333afc872d2b12ee4bfa90
parent09233822bb2eda1b1bd861e81df8d0577372d9a7 (diff)
exchanged execvp with system, fixes quoting problem
svn path=/trunk/externals/ggee/; revision=1941
-rwxr-xr-xcontrol/shell.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/control/shell.c b/control/shell.c
index 6a89aea..5476e97 100755
--- a/control/shell.c
+++ b/control/shell.c
@@ -1,6 +1,5 @@
/* (C) Guenter Geiger <geiger@epy.co.at> */
-
#include <m_pd.h>
#ifdef NT
#pragma warning( disable : 4244 )
@@ -219,6 +218,11 @@ static void shell_anything(t_shell *x, t_symbol *s, int ac, t_atom *at)
if (!(x->pid = fork())) {
int status;
+ char* cmd = getbytes(1024);
+ char* tcmd = getbytes(1024);
+ strcpy(cmd,s->s_name);
+
+#if 0
for (i=1;i<=ac;i++) {
argv[i] = getbytes(255);
atom_string(at,argv[i],255);
@@ -226,13 +230,22 @@ static void shell_anything(t_shell *x, t_symbol *s, int ac, t_atom *at)
at++;
}
argv[i] = 0;
+#endif
+ for (i=1;i<=ac;i++) {
+ atom_string(at,tcmd,255);
+ strcat(cmd," ");
+ strcat(cmd,tcmd);
+ at++;
+ }
+
/* reassign stdout */
dup2(x->fdpipe[1],1);
dup2(x->fdinpipe[1],0);
- post("executing");
- execvp(s->s_name,argv);
- exit(-1);
+ post("executing %s",cmd);
+ system(cmd);
+// execvp(s->s_name,argv);
+ exit(0);
}
x->x_del = 4;
clock_delay(x->x_clock,x->x_del);