aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-06-04 09:37:25 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-06-04 09:37:25 +0000
commit6494b68742b5f20e3d431716a115319d666752ea (patch)
tree51830d6ca263201b9cf1da23b5471fa77b864a14 /util.c
parentd77fe5bd516a7085fd24ecd939e6b0816e2a9489 (diff)
downloaddzen-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.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/util.c b/util.c
index d584a4a..c2f44e2 100644
--- a/util.c
+++ b/util.c
@@ -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);
}