Xinqi Bao's Git
435069f9903703412fe2edfc3514058d01014959
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
10 #include <sys/types.h>
17 error(char *errstr
, ...) {
20 vfprintf(stderr
, errstr
, ap
);
26 bad_malloc(unsigned int size
)
28 fprintf(stderr
, "fatal: could not malloc() %d bytes\n",
34 emallocz(unsigned int size
)
36 void *res
= calloc(1, size
);
43 emalloc(unsigned int size
)
45 void *res
= malloc(size
);
52 erealloc(void *ptr
, unsigned int size
)
54 void *res
= realloc(ptr
, size
);
61 estrdup(const char *str
)
63 void *res
= strdup(str
);
65 bad_malloc(strlen(str
));
70 failed_assert(char *a
, char *file
, int line
)
72 fprintf(stderr
, "Assertion \"%s\" failed at %s:%d\n", a
, file
, line
);
77 swap(void **p1
, void **p2
)
85 spawn(Display
*dpy
, const char *shell
, const char *cmd
)
92 close(ConnectionNumber(dpy
));
93 execl(shell
, shell
, "-c", cmd
, (const char *)0);
94 fprintf(stderr
, "gridwm: execl %s", shell
);