wmii/cmd/wm/spawn.c
2006-02-10 21:05:17 +01:00

28 lines
458 B
C

/*
* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include <stdlib.h>
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#include "wm.h"
void
spawn(char *cmd)
{
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);
}