diff options
author | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2007-06-04 09:37:25 +0000 |
---|---|---|
committer | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2007-06-04 09:37:25 +0000 |
commit | 6494b68742b5f20e3d431716a115319d666752ea (patch) | |
tree | 51830d6ca263201b9cf1da23b5471fa77b864a14 /util.c | |
parent | d77fe5bd516a7085fd24ecd939e6b0816e2a9489 (diff) | |
download | dzen-6494b68742b5f20e3d431716a115319d666752ea.tar.gz dzen-6494b68742b5f20e3d431716a115319d666752ea.zip |
intendation fixes
git-svn-id: http://dzen.googlecode.com/svn/trunk@63 f2baff5b-bf2c-0410-a398-912abdc3d8b2
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 68 |
1 files changed, 34 insertions, 34 deletions
@@ -1,7 +1,7 @@ /* (C)opyright MMVI-MMVII Anselm R. Garbe <garbeam at gmail dot com> - * (C)opyright MMVII Robert Manea <rob dot manea at gmail dot com> - * See LICENSE file for license details. - */ +* (C)opyright MMVII Robert Manea <rob dot manea at gmail dot com> +* See LICENSE file for license details. +*/ #include "dzen.h" #include <stdarg.h> @@ -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); } |