1 /* © 2006-2007 Anselm R. Garbe <garbeam at gmail dot com>
2 * © 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
3 * See LICENSE file for license details. */
14 emallocz(unsigned int size) {
15 void *res = calloc(1, size);
18 eprint("fatal: could not malloc() %u bytes\n", size);
23 eprint(const char *errstr, ...) {
27 vfprintf(stderr, errstr, ap);
33 spawn(const char *arg) {
34 static char *shell = NULL;
36 if(!shell && !(shell = getenv("SHELL")))
40 /* The double-fork construct avoids zombie processes and keeps the code
41 * clean from stupid signal handlers. */
45 close(ConnectionNumber(dpy));
47 execl(shell, shell, "-c", arg, (char *)NULL);
48 fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg);