summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-10 22:16:48 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-10 22:16:48 +0200
commit439e15d09f6fa9271d3b49ef97194f0c80ebe161 (patch)
tree0f1abd8629f3fc226bb313ce29f00b6b8424f375 /util.c
parentrenamed gridmenu.c into menu.c (diff)
downloaddwm-439e15d09f6fa9271d3b49ef97194f0c80ebe161.tar.gz
dwm-439e15d09f6fa9271d3b49ef97194f0c80ebe161.zip
added several other stuff
Diffstat (limited to '')
-rw-r--r--util.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/util.c b/util.c
index 99842e9..435069f 100644
--- a/util.c
+++ b/util.c
@@ -7,6 +7,11 @@
7#include <stdio.h> 7#include <stdio.h>
8#include <stdlib.h> 8#include <stdlib.h>
9#include <string.h> 9#include <string.h>
10#include <sys/types.h>
11#include <sys/wait.h>
12#include <unistd.h>
13
14#include "util.h"
10 15
11void 16void
12error(char *errstr, ...) { 17error(char *errstr, ...) {
@@ -75,3 +80,21 @@ swap(void **p1, void **p2)
75 *p1 = *p2; 80 *p1 = *p2;
76 *p2 = tmp; 81 *p2 = tmp;
77} 82}
83
84void
85spawn(Display *dpy, const char *shell, const char *cmd)
86{
87 if(!cmd || !shell)
88 return;
89 if(fork() == 0) {
90 if(fork() == 0) {
91 if(dpy)
92 close(ConnectionNumber(dpy));
93 execl(shell, shell, "-c", cmd, (const char *)0);
94 fprintf(stderr, "gridwm: execl %s", shell);
95 perror(" failed");
96 }
97 exit (0);
98 }
99 wait(0);
100}