2005-11-18 18:54:58 +03:00
|
|
|
/*
|
2006-01-20 17:20:24 +03:00
|
|
|
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
2005-11-18 18:54:58 +03:00
|
|
|
* See LICENSE file for license details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "wmii.h"
|
|
|
|
|
2005-12-21 18:18:11 +03:00
|
|
|
void
|
|
|
|
wmii_spawn(void *dpy, char *cmd)
|
2005-11-18 18:54:58 +03:00
|
|
|
{
|
2005-12-21 18:18:11 +03:00
|
|
|
/* the questionable double-fork is done to catch all zombies */
|
|
|
|
if(fork() == 0) {
|
|
|
|
if(fork() == 0) {
|
|
|
|
setsid();
|
|
|
|
close(ConnectionNumber(dpy));
|
|
|
|
execlp("rc", "rc", "-c", cmd, (char *) 0);
|
|
|
|
perror("failed");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
wait(0);
|
2005-11-18 18:54:58 +03:00
|
|
|
}
|