From 43d665c593b1845a1fb2f7d54e4ca4c9ee60250e Mon Sep 17 00:00:00 2001 From: corvid Date: Sun, 17 May 2009 12:34:17 -0400 Subject: Added DLIB_MSG() macro for dlib's messages --- dlib/dlib.c | 17 +++++++++++++++++ dlib/dlib.h | 6 ++++++ 2 files changed, 23 insertions(+) (limited to 'dlib') 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 -------------------------------------------------------------------- */ @@ -800,6 +809,14 @@ int dParser_parse_rc_line(char **line, char **name, char **value) return ret; } +/* + *- 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 /* for strerror */ #include /* for strcasecmp, strncasecmp (POSIX 2001) */ +#include "d_size.h" #ifdef __cplusplus extern "C" { @@ -160,6 +161,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 ---------------------------------------------------- */ -- cgit v1.2.3