aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-22 21:56:26 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-22 21:56:26 +0000
commit69d5ba2f95287a59fb31583b014474859b22025b (patch)
tree5743f607901b6f3f6a9d2e4b0be06489b8cf109d /miscutils
parenta959a2abdd5bef3dadcf653665831a14f404240c (diff)
downloadbusybox-69d5ba2f95287a59fb31583b014474859b22025b.tar.gz
- untangle the implementation of the small and huge last applets
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/Config.in16
-rw-r--r--miscutils/Kbuild3
-rw-r--r--miscutils/last.c8
-rw-r--r--miscutils/last_fancy.c7
4 files changed, 22 insertions, 12 deletions
diff --git a/miscutils/Config.in b/miscutils/Config.in
index 427906ff8..dffde34db 100644
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
@@ -229,13 +229,23 @@ config LAST
help
'last' displays a list of the last users that logged into the system.
-config FEATURE_LAST_FANCY
- bool "Fancy output"
- default n
+choice
+ prompt "Choose last implementation"
depends on LAST
+ default FEATURE_LAST_SMALL
+
+config FEATURE_LAST_SMALL
+ bool "small"
+ help
+ This is a small version of last with just the basic set of
+ features.
+
+config FEATURE_LAST_FANCY
+ bool "huge"
help
'last' displays detailed information about the last users that
logged into the system (mimics sysvinit last). +900 bytes.
+endchoice
config LESS
bool "less"
diff --git a/miscutils/Kbuild b/miscutils/Kbuild
index ba2a0dc14..96e754e1b 100644
--- a/miscutils/Kbuild
+++ b/miscutils/Kbuild
@@ -16,7 +16,8 @@ lib-$(CONFIG_DEVFSD) += devfsd.o
lib-$(CONFIG_EJECT) += eject.o
lib-$(CONFIG_FBSPLASH) += fbsplash.o
lib-$(CONFIG_HDPARM) += hdparm.o
-lib-$(CONFIG_LAST) += last.o
+lib-$(CONFIG_FEATURE_LAST_SMALL)+= last.o
+lib-$(CONFIG_FEATURE_LAST_FANCY)+= last_fancy.o
lib-$(CONFIG_LESS) += less.o
lib-$(CONFIG_MAKEDEVS) += makedevs.o
lib-$(CONFIG_MAN) += man.o
diff --git a/miscutils/last.c b/miscutils/last.c
index 2199d7524..af92e50cf 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -26,12 +26,6 @@
#error struct utmp member char[] size(s) have changed!
#endif
-#if ENABLE_FEATURE_LAST_FANCY
-
-#include "last_fancy.c"
-
-#else
-
#if EMPTY != 0 || RUN_LVL != 1 || BOOT_TIME != 2 || NEW_TIME != 3 || \
OLD_TIME != 4
#error Values for the ut_type field of struct utmp changed
@@ -131,5 +125,3 @@ int last_main(int argc, char **argv ATTRIBUTE_UNUSED)
fflush_stdout_and_exit(EXIT_SUCCESS);
}
-
-#endif
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c
index 03df8dcdd..91315d338 100644
--- a/miscutils/last_fancy.c
+++ b/miscutils/last_fancy.c
@@ -7,6 +7,13 @@
* Licensed under the GPLv2 or later, see the file LICENSE in this tarball.
*/
+#include "libbb.h"
+#include <utmp.h>
+
+#ifndef SHUTDOWN_TIME
+# define SHUTDOWN_TIME 254
+#endif
+
#define HEADER_FORMAT "%-8.8s %-12.12s %-*.*s %-16.16s %-7.7s %s\n"
#define HEADER_LINE "USER", "TTY", \
INET_ADDRSTRLEN, INET_ADDRSTRLEN, "HOST", "LOGIN", " TIME", ""