Xinqi Bao's Git
cae9ba3508dddd753685c24a2053cdd49ef19e85
1 /* © 2004-2007 Anselm R. Garbe <garbeam at gmail dot com>
2 * See LICENSE file for license details. */
13 emallocz(unsigned int size
) {
14 void *res
= calloc(1, size
);
17 eprint("fatal: could not malloc() %u bytes\n", size
);
22 eprint(const char *errstr
, ...) {
26 vfprintf(stderr
, errstr
, ap
);
32 spawn(const char *arg
) {
33 static char *shell
= NULL
;
35 if(!shell
&& !(shell
= getenv("SHELL")))
39 /* The double-fork construct avoids zombie processes and keeps the code
40 * clean from stupid signal handlers. */
44 close(ConnectionNumber(dpy
));
46 execl(shell
, shell
, "-c", arg
, (char *)NULL
);
47 fprintf(stderr
, "dwm: execl '%s -c %s'", shell
, arg
);