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 * © 2007 Premysl Hruby <dfenze at gmail dot com>
4 * See LICENSE file for license details. */
15 emallocz(unsigned int size) {
16 void *res = calloc(1, size);
19 eprint("fatal: could not malloc() %u bytes\n", size);
24 eprint(const char *errstr, ...) {
28 vfprintf(stderr, errstr, ap);
34 spawn(const char *arg) {
35 static char *shell = NULL;
37 if(!shell && !(shell = getenv("SHELL")))
41 /* The double-fork construct avoids zombie processes and keeps the code
42 * clean from stupid signal handlers. */
46 close(ConnectionNumber(dpy));
48 execl(shell, shell, "-c", arg, (char *)NULL);
49 fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg);