Xinqi Bao's Git
abd82defb07cddee6a50117452a15ee94ce19a8f
1 /* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
2 * 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 erealloc(void *ptr
, unsigned int size
) {
34 void *res
= realloc(ptr
, size
);
37 eprint("fatal: could not malloc() %u bytes\n", size
);
43 static char *shell
= NULL
;
45 if(!shell
&& !(shell
= getenv("SHELL")))
49 /* The double-fork construct avoids zombie processes and keeps the code
50 * clean from stupid signal handlers. */
54 close(ConnectionNumber(dpy
));
56 execl(shell
, shell
, "-c", arg
->cmd
, (char *)NULL
);
57 fprintf(stderr
, "dwm: execl '%s -c %s'", shell
, arg
->cmd
);