aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-08-08 06:58:06 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-08-08 06:58:06 +0000
commit1934af04c445632c42de495e0ccdcb01e1b06c6e (patch)
tree58b0d87ec40dc853e52d4d3d15316ee6d48e8267 /debug.c
parent0184cfba3e4b8e96222896bec1da4fc0c873d135 (diff)
downloadlcd4linux-1934af04c445632c42de495e0ccdcb01e1b06c6e.tar.gz
[lcd4linux @ 2003-08-08 06:58:06 by reinelt]
improved forking git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@207 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/debug.c b/debug.c
index 271ad9f..a90fec7 100644
--- a/debug.c
+++ b/debug.c
@@ -1,4 +1,4 @@
-/* $Id: debug.c,v 1.3 2001/03/12 12:39:36 reinelt Exp $
+/* $Id: debug.c,v 1.4 2003/08/08 06:58:06 reinelt Exp $
*
* debug() and error() functions
*
@@ -20,6 +20,9 @@
*
*
* $Log: debug.c,v $
+ * Revision 1.4 2003/08/08 06:58:06 reinelt
+ * improved forking
+ *
* Revision 1.3 2001/03/12 12:39:36 reinelt
*
* reworked autoconf a lot: drivers may be excluded, #define's went to config.h
@@ -62,6 +65,7 @@ void message (int level, const char *format, ...)
static int log_open=0;
extern int debugging;
extern int foreground;
+ extern int background;
if (level>debugging) return;
@@ -69,15 +73,17 @@ void message (int level, const char *format, ...)
(void) vsnprintf(buffer, sizeof(buffer), format, ap);
va_end(ap);
- if (foreground) {
+ if (!background) {
#ifdef WITH_TEXT
extern int curs_err(char *);
if (!curs_err(buffer))
#endif
- fprintf (level?stdout:stderr, "%s\n", buffer);
- return;
+ fprintf (level?stdout:stderr, "%s\n", buffer);
}
-
+
+ if (foreground)
+ return;
+
if (!log_open) {
openlog ("LCD4Linux", LOG_PID, LOG_USER);
log_open=1;