Xinqi Bao's Git
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 * © 2006-2007 Jukka Salmi <jukka at salmi dot ch>
4 * © 2007 Premysl Hruby <dfenze at gmail dot com>
5 * © 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
6 * See LICENSE file for license details. */
17 emallocz(unsigned int size
) {
18 void *res
= calloc(1, size
);
21 eprint("fatal: could not malloc() %u bytes\n", size
);
26 eprint(const char *errstr
, ...) {
30 vfprintf(stderr
, errstr
, ap
);
36 spawn(const char *arg
) {
37 static char *shell
= NULL
;
39 if(!shell
&& !(shell
= getenv("SHELL")))
43 /* The double-fork construct avoids zombie processes and keeps the code
44 * clean from stupid signal handlers. */
48 close(ConnectionNumber(dpy
));
50 execl(shell
, shell
, "-c", arg
, (char *)NULL
);
51 fprintf(stderr
, "dwm: execl '%s -c %s'", shell
, arg
);