From 00e51dd4415467fc2b74006f94b40cbb798d99f5 Mon Sep 17 00:00:00 2001 From: gotmor Date: Mon, 4 Jun 2007 09:47:22 +0000 Subject: don't be a smartass and use tabs for intendation like every one else does git-svn-id: http://dzen.googlecode.com/svn/trunk@64 f2baff5b-bf2c-0410-a398-912abdc3d8b2 --- util.c | 62 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index c2f44e2..2039bc2 100644 --- a/util.c +++ b/util.c @@ -13,50 +13,50 @@ void * emalloc(unsigned int size) { - void *res = malloc(size); + void *res = malloc(size); - if(!res) - eprint("fatal: could not malloc() %u bytes\n", size); - return res; + if(!res) + eprint("fatal: could not malloc() %u bytes\n", size); + return res; } void eprint(const char *errstr, ...) { - va_list ap; + va_list ap; - va_start(ap, errstr); - vfprintf(stderr, errstr, ap); - va_end(ap); - exit(EXIT_FAILURE); + va_start(ap, errstr); + vfprintf(stderr, errstr, ap); + va_end(ap); + exit(EXIT_FAILURE); } char * estrdup(const char *str) { - void *res = strdup(str); + void *res = strdup(str); - if(!res) - eprint("fatal: could not malloc() %u bytes\n", strlen(str)); - return res; + if(!res) + eprint("fatal: could not malloc() %u bytes\n", strlen(str)); + return res; } 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) { - setsid(); - execl(shell, shell, "-c", arg, (char *)NULL); - fprintf(stderr, "dzen: execl '%s -c %s'", shell, arg); - perror(" failed"); - } - exit(0); - } - wait(0); + 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) { + setsid(); + execl(shell, shell, "-c", arg, (char *)NULL); + fprintf(stderr, "dzen: execl '%s -c %s'", shell, arg); + perror(" failed"); + } + exit(0); + } + wait(0); } -- cgit v1.2.3-54-g00ecf