From 0235a84ef286db5c97239615ae525ce973641941 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Sat, 15 Sep 2007 22:25:27 +0200 Subject: micromizing dwm step 1 --- util.c | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 util.c (limited to 'util.c') diff --git a/util.c b/util.c deleted file mode 100644 index d39d73c..0000000 --- a/util.c +++ /dev/null @@ -1,52 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#include "dwm.h" -#include -#include -#include -#include -#include - -/* extern */ - -void * -emallocz(unsigned int size) { - void *res = calloc(1, size); - - if(!res) - eprint("fatal: could not malloc() %u bytes\n", size); - return res; -} - -void -eprint(const char *errstr, ...) { - va_list ap; - - va_start(ap, errstr); - vfprintf(stderr, errstr, ap); - va_end(ap); - exit(EXIT_FAILURE); -} - -void -spawn(const char *arg) { - static char *shell = NULL; - - if(!shell && !(shell = getenv("SHELL"))) - shell = "/bin/sh"; - if(!arg) - return; - /* The double-fork construct avoids zombie processes and keeps the code - * clean from stupid signal handlers. */ - if(fork() == 0) { - if(fork() == 0) { - if(dpy) - close(ConnectionNumber(dpy)); - setsid(); - execl(shell, shell, "-c", arg, (char *)NULL); - fprintf(stderr, "dwm: execl '%s -c %s'", shell, arg); - perror(" failed"); - } - exit(0); - } - wait(0); -} -- cgit v1.2.3-54-g00ecf