changeset 1104:a450688d276e

Added DLIB_MSG() macro for dlib's messages
author corvid <corvid@lavabit.com>
date Sun, 17 May 2009 12:34:17 -0400
parents 94b9265663f6
children 8152083008f4
files dlib/dlib.c dlib/dlib.h src/dillo.cc
diffstat 3 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dlib/dlib.c	Sun May 17 12:04:13 2009 -0400
+++ b/dlib/dlib.c	Sun May 17 12:34:17 2009 -0400
@@ -27,6 +27,15 @@
 
 #include "dlib.h"
 
+static bool_t dLib_show_msg = TRUE;
+
+/* dlib msgs go to stderr to avoid problems with filter dpis */
+#define DLIB_MSG(...)                              \
+   D_STMT_START {                                  \
+      if (dLib_show_msg)                           \
+         fprintf(stderr, __VA_ARGS__);             \
+   } D_STMT_END
+
 /*
  *- Memory --------------------------------------------------------------------
  */
@@ -801,6 +810,14 @@
 }
 
 /*
+ *- Dlib messages -------------------------------------------------------------
+ */
+void dLib_show_messages(bool_t show)
+{
+   dLib_show_msg = show;
+}
+
+/*
  *- Misc utility functions ----------------------------------------------------
  */
 
--- a/dlib/dlib.h	Sun May 17 12:04:13 2009 -0400
+++ b/dlib/dlib.h	Sun May 17 12:34:17 2009 -0400
@@ -7,6 +7,7 @@
 #include <string.h>    /* for strerror */
 #include <strings.h>   /* for strcasecmp, strncasecmp (POSIX 2001) */
 
+#include "d_size.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -161,6 +162,11 @@
 int dParser_parse_rc_line(char **line, char **name, char **value);
 
 /*
+ *- Dlib messages -------------------------------------------------------------
+ */
+void dLib_show_messages(bool_t show);
+
+/*
  *- Misc utility functions ----------------------------------------------------
  */
 char *dGetcwd ();
--- a/src/dillo.cc	Sun May 17 12:04:13 2009 -0400
+++ b/src/dillo.cc	Sun May 17 12:34:17 2009 -0400
@@ -276,6 +276,7 @@
    if ((fp = Paths::getPrefsFP(PATHS_RC_KEYS))) {
       Keys::parse(fp);
    }
+   dLib_show_messages(prefs.show_msg);
 
    // initialize internal modules
    a_Dpi_init();