diff options
author | corvid <corvid@lavabit.com> | 2009-05-17 12:34:17 -0400 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2009-05-17 12:34:17 -0400 |
commit | 43d665c593b1845a1fb2f7d54e4ca4c9ee60250e (patch) | |
tree | ece1febcfae59b731d73723bb2d7f035f91d1c65 | |
parent | 5ff1a29d501f97a01c983ef62f4e6b76b7814785 (diff) |
Added DLIB_MSG() macro for dlib's messages
-rw-r--r-- | dlib/dlib.c | 17 | ||||
-rw-r--r-- | dlib/dlib.h | 6 | ||||
-rw-r--r-- | src/dillo.cc | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/dlib/dlib.c b/dlib/dlib.c index 9d8cc062..310e9976 100644 --- a/dlib/dlib.c +++ b/dlib/dlib.c @@ -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 @@ int dParser_parse_rc_line(char **line, char **name, char **value) } /* + *- Dlib messages ------------------------------------------------------------- + */ +void dLib_show_messages(bool_t show) +{ + dLib_show_msg = show; +} + +/* *- Misc utility functions ---------------------------------------------------- */ diff --git a/dlib/dlib.h b/dlib/dlib.h index 246f9adb..b2e87415 100644 --- a/dlib/dlib.h +++ b/dlib/dlib.h @@ -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 @@ void *dList_find_sorted (Dlist *lp, const void *data, dCompareFunc func); 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 (); diff --git a/src/dillo.cc b/src/dillo.cc index 9ed4578b..e80ab50b 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -276,6 +276,7 @@ int main(int argc, char **argv) if ((fp = Paths::getPrefsFP(PATHS_RC_KEYS))) { Keys::parse(fp); } + dLib_show_messages(prefs.show_msg); // initialize internal modules a_Dpi_init(); |