summaryrefslogtreecommitdiffstats
path: root/src/logging.c
diff options
context:
space:
mode:
authorHarald Welte2010-03-26 17:04:40 +0100
committerHarald Welte2010-03-26 17:04:40 +0100
commita3b844cf45dc4d6a6a3686e8ce6e2447643b878e (patch)
treefca3e832b3ace59581cf64aac9504d9fdae1d7c1 /src/logging.c
parentonly include strings.h if it is actually preent (diff)
downloadlibosmocore-a3b844cf45dc4d6a6a3686e8ce6e2447643b878e.tar.gz
libosmocore-a3b844cf45dc4d6a6a3686e8ce6e2447643b878e.tar.xz
libosmocore-a3b844cf45dc4d6a6a3686e8ce6e2447643b878e.zip
logging: only compile stderr target if we actualy have stderr
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/logging.c b/src/logging.c
index ea03d30..7c50877 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -307,11 +307,14 @@ void log_set_category_filter(struct log_target *target, int category,
target->categories[category].loglevel = level;
}
+/* since C89/C99 says stderr is a macro, we can safely do this! */
+#ifdef stderr
static void _stderr_output(struct log_target *target, const char *log)
{
fprintf(target->tgt_stdout.out, "%s", log);
fflush(target->tgt_stdout.out);
}
+#endif
struct log_target *log_target_create(void)
{
@@ -342,6 +345,8 @@ struct log_target *log_target_create(void)
struct log_target *log_target_create_stderr(void)
{
+/* since C89/C99 says stderr is a macro, we can safely do this! */
+#ifdef stderr
struct log_target *target;
target = log_target_create();
@@ -351,6 +356,9 @@ struct log_target *log_target_create_stderr(void)
target->tgt_stdout.out = stderr;
target->output = _stderr_output;
return target;
+#else
+ return NULL;
+#endif /* stderr */
}
void log_init(const struct log_info *cat)