aboutsummaryrefslogtreecommitdiff
path: root/control/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'control/shell.c')
-rw-r--r--control/shell.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/control/shell.c b/control/shell.c
index 79d89ca..f71ddce 100644
--- a/control/shell.c
+++ b/control/shell.c
@@ -198,7 +198,7 @@ static void shell_send(t_shell *x, t_symbol *s,int ac, t_atom *at)
static void shell_anything(t_shell *x, t_symbol *s, int ac, t_atom *at)
{
int i;
- char* argv[20];
+ char* argv[255];
t_symbol* sym;
if (!strcmp(s->s_name,"send")) {
@@ -230,39 +230,35 @@ static void shell_anything(t_shell *x, t_symbol *s, int ac, t_atom *at)
sys_addpollfn(x->fdpipe[0],shell_read,x);
if (!(x->pid = fork())) {
- int status;
- char* cmd = getbytes(1024);
- char* tcmd = getbytes(1024);
- strcpy(cmd,s->s_name);
-
-#if 0
+ /* reassign stdout */
+ dup2(x->fdpipe[1],1);
+ dup2(x->fdinpipe[1],0);
+
+ /* drop privileges */
+ drop_priority();
+ seteuid(getuid()); /* lose setuid priveliges */
+
+#ifdef __APPLE__
for (i=1;i<=ac;i++) {
argv[i] = getbytes(255);
atom_string(at,argv[i],255);
-/* post("argument %s",argv[i]); */
at++;
}
argv[i] = 0;
-#endif
- for (i=1;i<=ac;i++) {
+ execvp(s->s_name,argv);
+#else
+ char* cmd = getbytes(1024);
+ char* tcmd = getbytes(1024);
+ strcpy(cmd,s->s_name);
+ 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);
-
- /* drop privileges */
- drop_priority();
- seteuid(getuid()); /* lose setuid priveliges */
-
- post("executing %s",cmd);
+ verbose(4,"executing %s",cmd);
system(cmd);
-// execvp(s->s_name,argv);
+#endif /* __APPLE__ */
exit(0);
}
x->x_del = 4;