aewl
view util.c @ 115:329fd7dae530
removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling remembering two kinds of geometries is unnecessary, removed the randomized (x,y) setting on dofloat startup, was kind too random und unpredictable
author | arg@10ksloc.org |
---|---|
date | Thu, 20 Jul 2006 07:26:23 +0200 |
parents | 052fe7498930 |
children | 61490330e90a |
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
5 #include "dwm.h"
7 #include <stdarg.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <sys/wait.h>
11 #include <unistd.h>
13 /* static */
15 static void
16 bad_malloc(unsigned int size)
17 {
18 fprintf(stderr, "fatal: could not malloc() %d bytes\n",
19 (int) size);
20 exit(EXIT_FAILURE);
21 }
23 /* extern */
25 void *
26 emallocz(unsigned int size)
27 {
28 void *res = calloc(1, size);
29 if(!res)
30 bad_malloc(size);
31 return res;
32 }
34 void
35 eprint(const char *errstr, ...) {
36 va_list ap;
37 va_start(ap, errstr);
38 vfprintf(stderr, errstr, ap);
39 va_end(ap);
40 exit(EXIT_FAILURE);
41 }
43 void
44 spawn(Arg *arg)
45 {
46 char **argv = (char **)arg->argv;
47 if(!argv || !argv[0])
48 return;
49 if(fork() == 0) {
50 if(fork() == 0) {
51 if(dpy)
52 close(ConnectionNumber(dpy));
53 setsid();
54 execvp(argv[0], argv);
55 fprintf(stderr, "dwm: execvp %s", argv[0]);
56 perror(" failed");
57 }
58 exit(EXIT_FAILURE);
59 }
60 wait(0);
61 }