diff options
author | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2007-06-04 09:47:22 +0000 |
---|---|---|
committer | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2007-06-04 09:47:22 +0000 |
commit | 00e51dd4415467fc2b74006f94b40cbb798d99f5 (patch) | |
tree | 1f5535b34f5df28165824d11201a05ca0b1ce3db /util.c | |
parent | 6494b68742b5f20e3d431716a115319d666752ea (diff) | |
download | dzen-00e51dd4415467fc2b74006f94b40cbb798d99f5.tar.gz dzen-00e51dd4415467fc2b74006f94b40cbb798d99f5.zip |
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
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 62 |
1 files changed, 31 insertions, 31 deletions
@@ -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); } |