summaryrefslogtreecommitdiff
path: root/do/aexec
diff options
context:
space:
mode:
Diffstat (limited to 'do/aexec')
-rw-r--r--do/aexec34
1 files changed, 34 insertions, 0 deletions
diff --git a/do/aexec b/do/aexec
new file mode 100644
index 0000000000..d8f0dcfc6f
--- /dev/null
+++ b/do/aexec
@@ -0,0 +1,34 @@
+bool
+do_aexec(really,arglast)
+STR *really;
+int *arglast;
+{
+ register STR **st = stack->ary_array;
+ register int sp = arglast[1];
+ register int items = arglast[2] - sp;
+ register char **a;
+ char *tmps;
+
+ if (items) {
+ New(401,Argv, items+1, char*);
+ a = Argv;
+ for (st += ++sp; items > 0; items--,st++) {
+ if (*st)
+ *a++ = str_get(*st);
+ else
+ *a++ = "";
+ }
+ *a = Nullch;
+#ifdef TAINT
+ if (*Argv[0] != '/') /* will execvp use PATH? */
+ taintenv(); /* testing IFS here is overkill, probably */
+#endif
+ if (really && *(tmps = str_get(really)))
+ execvp(tmps,Argv);
+ else
+ execvp(Argv[0],Argv);
+ }
+ do_execfree();
+ return FALSE;
+}
+