#include <h/mime.h>
#include <h/mhparse.h>
#include <h/utils.h>
-#include <sys/wait.h>
extern int debugsw;
{
pid_t child_id;
int i, vecp;
- char *vec[8];
+ char **vec;
+ char *file;
- vecp = 0;
- vec[vecp++] = r1bindex (mhlproc, '/');
- vec[vecp++] = "-form";
- vec[vecp++] = form;
- vec[vecp++] = "-nobody";
- vec[vecp++] = ct->c_file;
+ vec = argsplit(mhlproc, &file, &vecp);
+ vec[vecp++] = getcpy("-form");
+ vec[vecp++] = getcpy(form);
+ vec[vecp++] = getcpy("-nobody");
+ vec[vecp++] = getcpy(ct->c_file);
/*
* If we've specified -(no)moreproc,
* then just pass that along.
*/
if (nomore) {
- vec[vecp++] = "-nomoreproc";
+ vec[vecp++] = getcpy("-nomoreproc");
} else if (progsw) {
- vec[vecp++] = "-moreproc";
- vec[vecp++] = progsw;
+ vec[vecp++] = getcpy("-moreproc");
+ vec[vecp++] = getcpy(progsw);
}
vec[vecp] = NULL;
fflush (stdout);
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
/* NOTREACHED */
case OK:
- execvp (mhlproc, vec);
+ execvp (file, vec);
fprintf (stderr, "unable to exec ");
perror (mhlproc);
_exit (-1);
xpid = -child_id;
break;
}
+
+ arglist_free(file, vec);
}
fflush (stdout);
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
case NOTOK: