comparison util.c @ 123:61490330e90a

cleaned up code
author arg@10ksloc.org
date Thu, 20 Jul 2006 12:18:06 +0200
parents 4bee0aa5b286
children c1185dc7a36e
comparison
equal deleted inserted replaced
122:f20cea484900 123:61490330e90a
24 24
25 void * 25 void *
26 emallocz(unsigned int size) 26 emallocz(unsigned int size)
27 { 27 {
28 void *res = calloc(1, size); 28 void *res = calloc(1, size);
29
29 if(!res) 30 if(!res)
30 bad_malloc(size); 31 bad_malloc(size);
31 return res; 32 return res;
32 } 33 }
33 34
34 void 35 void
35 eprint(const char *errstr, ...) { 36 eprint(const char *errstr, ...) {
36 va_list ap; 37 va_list ap;
38
37 va_start(ap, errstr); 39 va_start(ap, errstr);
38 vfprintf(stderr, errstr, ap); 40 vfprintf(stderr, errstr, ap);
39 va_end(ap); 41 va_end(ap);
40 exit(EXIT_FAILURE); 42 exit(EXIT_FAILURE);
41 } 43 }
42 44
43 void 45 void
44 spawn(Arg *arg) 46 spawn(Arg *arg)
45 { 47 {
46 char **argv = (char **)arg->argv; 48 char **argv = (char **)arg->argv;
49
47 if(!argv || !argv[0]) 50 if(!argv || !argv[0])
48 return; 51 return;
49 if(fork() == 0) { 52 if(fork() == 0) {
50 if(fork() == 0) { 53 if(fork() == 0) {
51 if(dpy) 54 if(dpy)