aboutsummaryrefslogtreecommitdiff
path: root/control
diff options
context:
space:
mode:
Diffstat (limited to 'control')
-rw-r--r--control/shell-help.pd26
-rw-r--r--control/shell.c40
2 files changed, 32 insertions, 34 deletions
diff --git a/control/shell-help.pd b/control/shell-help.pd
index e2c608a..4b07c0c 100644
--- a/control/shell-help.pd
+++ b/control/shell-help.pd
@@ -10,14 +10,12 @@
#X msg 12 193 xedit;
#X msg 36 213 /usr/bin/perl;
#X text 343 79 Getting the time;
-#X obj 362 213 shell;
-#X text 345 174 Getting the date;
-#X symbolatom 362 254 0 0 0 0 - - -;
-#X msg 362 192 date +%Y.%m.%d;
-#X obj 362 233 symbol;
-#X obj 409 214 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X obj 404 118 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+#X obj 362 233 shell;
+#X text 345 194 Getting the date;
+#X symbolatom 362 274 0 0 0 0 - - -;
+#X msg 362 212 date +%Y.%m.%d;
+#X obj 362 253 symbol;
+#X obj 409 234 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 65 126 print DONE;
#X obj 35 147 print STDOUT;
@@ -26,12 +24,15 @@ STDIN is received on the inlet. STDOUT is output on the left inlet
\, STDERR is output to the Pd console. When execution is complete \,
the right outlet is banged.;
#X floatatom 61 234 5 0 0 0 - - -;
-#X connect 0 0 19 0;
-#X connect 0 1 18 0;
+#X floatatom 408 142 5 0 0 0 - - -;
+#X obj 408 161 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+-1 -1;
+#X connect 0 0 18 0;
+#X connect 0 1 17 0;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 4 0 3 0;
-#X connect 4 1 17 0;
+#X connect 4 1 21 0;
#X connect 6 0 5 0;
#X connect 7 0 5 0;
#X connect 8 0 5 0;
@@ -40,4 +41,5 @@ the right outlet is banged.;
#X connect 11 1 16 0;
#X connect 14 0 11 0;
#X connect 15 0 13 0;
-#X connect 21 0 5 0;
+#X connect 20 0 5 0;
+#X connect 21 0 22 0;
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;