diff options
author | Michel Stam <m.stam@fugro.nl> | 2014-11-04 12:19:04 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-11-04 12:19:04 +0100 |
commit | d3fabf89d7d38a436672ac2deea7904351b1b12a (patch) | |
tree | baae6201eb8c0b2b74a1732762c3034efcb4a00e /libbb | |
parent | fdd957bdc9981cc2c1efb4452f55bb44a88cbfe0 (diff) | |
download | busybox-w32-d3fabf89d7d38a436672ac2deea7904351b1b12a.tar.gz busybox-w32-d3fabf89d7d38a436672ac2deea7904351b1b12a.tar.bz2 busybox-w32-d3fabf89d7d38a436672ac2deea7904351b1b12a.zip |
zcip: Add environment variable for overriding log functionality
function old new delta
bb_logenv_override - 70 +70
packed_usage 29969 30033 +64
zcip_main 1426 1431 +5
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 139/0) Total: 139 bytes
Signed-off-by: Michel Stam <m.stam@fugro.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild.src | 3 | ||||
-rw-r--r-- | libbb/logenv.c | 24 |
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 | |||
187 | lib-$(CONFIG_PKILL) += xregcomp.o | 187 | lib-$(CONFIG_PKILL) += xregcomp.o |
188 | lib-$(CONFIG_DEVFSD) += xregcomp.o | 188 | lib-$(CONFIG_DEVFSD) += xregcomp.o |
189 | lib-$(CONFIG_FEATURE_FIND_REGEX) += xregcomp.o | 189 | lib-$(CONFIG_FEATURE_FIND_REGEX) += xregcomp.o |
190 | |||
191 | # Add the experimental logging functionality, only used by zcip | ||
192 | 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 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Utility routines. | ||
4 | * | ||
5 | * Copyright (C) 2014 by Fugro Intersite B.V. <m.stam@fugro.nl> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | ||
8 | */ | ||
9 | #include "libbb.h" | ||
10 | |||
11 | void FAST_FUNC bb_logenv_override(void) | ||
12 | { | ||
13 | const char* mode = getenv("LOGGING"); | ||
14 | |||
15 | if (!mode) | ||
16 | return; | ||
17 | |||
18 | if (strcmp(mode, "none") == 0) | ||
19 | logmode = LOGMODE_NONE; | ||
20 | #if ENABLE_FEATURE_SYSLOG | ||
21 | else if (strcmp(mode, "syslog") == 0) | ||
22 | logmode = LOGMODE_SYSLOG; | ||
23 | #endif | ||
24 | } | ||