#define ERR_NEEDS_ARG "Section `%s' needs an argument.\n"
#define ERR_NEEDS_SECTION "`%s' can only be used within a section.\n"
+#define ESCAPE_NULL(str) ((str) == NULL ? "(null)" : (str))
+
+#define DEBUG_CALLBACK(shortvar, var, arguments, value) \
+ DBG("shortvar = %s, var = %s, arguments = %s, value = %s, ...", \
+ ESCAPE_NULL(shortvar), \
+ ESCAPE_NULL(var), \
+ ESCAPE_NULL(arguments), \
+ ESCAPE_NULL(value))
+
extern int operating_mode;
typedef struct cf_callback
int ret;
int i;
- DBG ("type = %s, key = %s, value = %s", type, orig_key, orig_value);
+ DBG ("type = %s, key = %s, value = %s",
+ ESCAPE_NULL(type),
+ ESCAPE_NULL(orig_key),
+ ESCAPE_NULL(orig_value));
if ((cf_cb = cf_search (type)) == NULL)
{
}
else
{
- DBG ("Key was truncated: `%s'", keys[i]);
+ DBG ("Key was truncated: `%s'", ESCAPE_NULL(keys[i]));
}
}
}
const char *arguments, const char *value, lc_flags_t flags,
void *extra)
{
- DBG ("shortvar = %s, var = %s, arguments = %s, value = %s, ...",
- shortvar, var, arguments, value);
+ DEBUG_CALLBACK (shortvar, var, arguments, value);
if (strcasecmp (value, "Client") == 0)
operating_mode = MODE_CLIENT;
const char *arguments, const char *value, lc_flags_t flags,
void *extra)
{
- DBG ("shortvar = %s, var = %s, arguments = %s, value = %s, ...",
- shortvar, var, arguments, value);
+ DEBUG_CALLBACK (shortvar, var, arguments, value);
plugin_set_dir (value);
{
cf_mode_item_t *item;
- DBG ("shortvar = %s, var = %s, arguments = %s, value = %s, ...",
- shortvar, var, arguments, value);
+ DEBUG_CALLBACK (shortvar, var, arguments, value);
if (extra == NULL)
{
const char *arguments, const char *value, lc_flags_t flags,
void *extra)
{
- DBG ("shortvar = %s, var = %s, arguments = %s, value = %s, ...",
- shortvar, var, arguments, value);
+ DEBUG_CALLBACK (shortvar, var, arguments, value);
if (plugin_load (value))
syslog (LOG_ERR, "plugin_load (%s): failed to load plugin", value);
char *node;
char *service = NET_DEFAULT_PORT;
- DBG ("shortvar = %s, var = %s, arguments = %s, value = %s, ...",
- shortvar, var, arguments, value);
+ DEBUG_CALLBACK (shortvar, var, arguments, value);
buffer = strdup (value);
if (buffer == NULL)
const char *arguments, const char *value, lc_flags_t flags,
void *extra)
{
- DBG ("shortvar = %s, var = %s, arguments = %s, value = %s, ...",
- shortvar, var, arguments, value);
+ DEBUG_CALLBACK (shortvar, var, arguments, value);
if (flags == LC_FLAGS_SECTIONSTART)
{
const char *arguments, const char *value, lc_flags_t flags,
void *extra)
{
- DBG ("shortvar = %s, var = %s, arguments = %s, value = %s, ...",
- shortvar, var, arguments, value);
+ DEBUG_CALLBACK (shortvar, var, arguments, value);
if ((nesting_depth == 0) || (current_module == NULL))
{