aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Kbuild.src3
-rw-r--r--libbb/logenv.c24
2 files changed, 27 insertions, 0 deletions
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 0a9e803d7..f204816c5 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -187,3 +187,6 @@ lib-$(CONFIG_PGREP) += xregcomp.o
lib-$(CONFIG_PKILL) += xregcomp.o
lib-$(CONFIG_DEVFSD) += xregcomp.o
lib-$(CONFIG_FEATURE_FIND_REGEX) += xregcomp.o
+
+# Add the experimental logging functionality, only used by zcip
+lib-$(CONFIG_ZCIP) += logenv.o
diff --git a/libbb/logenv.c b/libbb/logenv.c
new file mode 100644
index 000000000..66c60bd4e
--- /dev/null
+++ b/libbb/logenv.c
@@ -0,0 +1,24 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) 2014 by Fugro Intersite B.V. <m.stam@fugro.nl>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+ */
+#include "libbb.h"
+
+void FAST_FUNC bb_logenv_override(void)
+{
+ const char* mode = getenv("LOGGING");
+
+ if (!mode)
+ return;
+
+ if (strcmp(mode, "none") == 0)
+ logmode = LOGMODE_NONE;
+#if ENABLE_FEATURE_SYSLOG
+ else if (strcmp(mode, "syslog") == 0)
+ logmode = LOGMODE_SYSLOG;
+#endif
+}