mirror of
https://github.com/0intro/wmii
synced 2025-01-20 17:19:21 +03:00
32 lines
556 B
C
32 lines
556 B
C
|
/*
|
||
|
* (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com>
|
||
|
* 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"
|
||
|
|
||
|
#include <cext.h>
|
||
|
|
||
|
void
|
||
|
spawn(void *dpy, char *cmd)
|
||
|
{
|
||
|
/* 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);
|
||
|
}
|