Xinqi Bao's Git
77e79e186a0f857e14bc6c77d9492e6a6e468a2c
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 * © 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
5 * See LICENSE file for license details. */
16 emallocz(unsigned int size
) {
17 void *res
= calloc(1, size
);
20 eprint("fatal: could not malloc() %u bytes\n", size
);
25 eprint(const char *errstr
, ...) {
29 vfprintf(stderr
, errstr
, ap
);
35 spawn(const char *arg
) {
36 static char *shell
= NULL
;
38 if(!shell
&& !(shell
= getenv("SHELL")))
42 /* The double-fork construct avoids zombie processes and keeps the code
43 * clean from stupid signal handlers. */
47 close(ConnectionNumber(dpy
));
49 execl(shell
, shell
, "-c", arg
, (char *)NULL
);
50 fprintf(stderr
, "dwm: execl '%s -c %s'", shell
, arg
);