diff --git a/coreutils/who.c b/coreutils/who.c index 8384d95..4c2606d 100644 --- a/coreutils/who.c +++ b/coreutils/who.c @@ -19,7 +19,9 @@ /* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */ #include "libbb.h" -#include +#if ENABLE_FEATURE_UTMP +# include +#endif static void idle_string(char *str6, time_t t) { diff --git a/libbb/messages.c b/libbb/messages.c index 66e466f..90dd955 100644 --- a/libbb/messages.c +++ b/libbb/messages.c @@ -48,15 +48,17 @@ const int const_int_1 = 1; * and it will end up in bss */ const int const_int_0 = 0; -#include +#if ENABLE_FEATURE_UTMP +# include /* This is usually something like "/var/adm/wtmp" or "/var/log/wtmp" */ const char bb_path_wtmp_file[] ALIGN1 = -#if defined _PATH_WTMP +# if defined _PATH_WTMP _PATH_WTMP; -#elif defined WTMP_FILE +# elif defined WTMP_FILE WTMP_FILE; -#else -#error unknown path to wtmp file +# else +# error unknown path to wtmp file +# endif #endif /* We use it for "global" data via *(struct global*)&bb_common_bufsiz1. diff --git a/libbb/utmp.c b/libbb/utmp.c index 2bf9c11..a055de7 100644 --- a/libbb/utmp.c +++ b/libbb/utmp.c @@ -6,8 +6,9 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ -#include "libbb.h" -#include +#if ENABLE_FEATURE_UTMP +# include "libbb.h" +# include static void touch(const char *filename) { @@ -53,11 +54,11 @@ void FAST_FUNC write_new_utmp(pid_t pid, int new_type, const char *tty_name, con pututline(&utent); endutent(); -#if ENABLE_FEATURE_WTMP +# if ENABLE_FEATURE_WTMP /* "man utmp" says wtmp file should *not* be created automagically */ /*touch(bb_path_wtmp_file);*/ updwtmp(bb_path_wtmp_file, &utent); -#endif +# endif } /* @@ -125,9 +126,10 @@ void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const pututline(&utent); endutent(); -#if ENABLE_FEATURE_WTMP +# if ENABLE_FEATURE_WTMP /* "man utmp" says wtmp file should *not* be created automagically */ /*touch(bb_path_wtmp_file);*/ updwtmp(bb_path_wtmp_file, &utent); -#endif +# endif } +#endif /* ENABLE_FEATURE_UTMP */ diff --git a/miscutils/last.c b/miscutils/last.c index fec5b70..354af42 100644 --- a/miscutils/last.c +++ b/miscutils/last.c @@ -8,7 +8,9 @@ */ #include "libbb.h" -#include +#if ENABLE_FEATURE_UTMP +# include +#endif /* NB: ut_name and ut_user are the same field, use only one name (ut_user) * to reduce confusion */ diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c index 363e450..b31736a 100644 --- a/miscutils/runlevel.c +++ b/miscutils/runlevel.c @@ -12,7 +12,9 @@ * initially busyboxified by Bernhard Reutner-Fischer */ #include "libbb.h" -#include +#if ENABLE_FEATURE_UTMP +# include +#endif int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int runlevel_main(int argc UNUSED_PARAM, char **argv) diff --git a/miscutils/wall.c b/miscutils/wall.c index eecfc16..738726e 100644 --- a/miscutils/wall.c +++ b/miscutils/wall.c @@ -7,7 +7,9 @@ */ #include "libbb.h" -#include +#if ENABLE_FEATURE_UTMP +# include +#endif int wall_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int wall_main(int argc UNUSED_PARAM, char **argv)