Пример #1
0
static void
DisplayMsgHeader (CT ct, char *form)
{
    pid_t child_id;
    int i, vecp;
    char **vec;
    char *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++] = getcpy("-nomoreproc");
    } else if (progsw) {
	vec[vecp++] = getcpy("-moreproc");
	vec[vecp++] = getcpy(progsw);
    }
    vec[vecp] = NULL;

    fflush (stdout);

    for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
	sleep (5);

    switch (child_id) {
    case NOTOK:
	adios ("fork", "unable to");
	/* NOTREACHED */

    case OK:
	execvp (file, vec);
	fprintf (stderr, "unable to exec ");
	perror (mhlproc);
	_exit (-1);
	/* NOTREACHED */

    default:
	xpid = -child_id;
	break;
    }

    arglist_free(file, vec);
}
Пример #2
0
/** @brief  Clean up
 */
void optparse_exit(void)
{
    arglist_free();
}