diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-22 21:56:26 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-22 21:56:26 +0000 |
commit | 69d5ba2f95287a59fb31583b014474859b22025b (patch) | |
tree | 5743f607901b6f3f6a9d2e4b0be06489b8cf109d | |
parent | a959a2abdd5bef3dadcf653665831a14f404240c (diff) | |
download | busybox-w32-69d5ba2f95287a59fb31583b014474859b22025b.tar.gz busybox-w32-69d5ba2f95287a59fb31583b014474859b22025b.tar.bz2 busybox-w32-69d5ba2f95287a59fb31583b014474859b22025b.zip |
- untangle the implementation of the small and huge last applets
-rw-r--r-- | miscutils/Config.in | 16 | ||||
-rw-r--r-- | miscutils/Kbuild | 3 | ||||
-rw-r--r-- | miscutils/last.c | 8 | ||||
-rw-r--r-- | miscutils/last_fancy.c | 7 |
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 | |||
229 | help | 229 | help |
230 | 'last' displays a list of the last users that logged into the system. | 230 | 'last' displays a list of the last users that logged into the system. |
231 | 231 | ||
232 | config FEATURE_LAST_FANCY | 232 | choice |
233 | bool "Fancy output" | 233 | prompt "Choose last implementation" |
234 | default n | ||
235 | depends on LAST | 234 | depends on LAST |
235 | default FEATURE_LAST_SMALL | ||
236 | |||
237 | config FEATURE_LAST_SMALL | ||
238 | bool "small" | ||
239 | help | ||
240 | This is a small version of last with just the basic set of | ||
241 | features. | ||
242 | |||
243 | config FEATURE_LAST_FANCY | ||
244 | bool "huge" | ||
236 | help | 245 | help |
237 | 'last' displays detailed information about the last users that | 246 | 'last' displays detailed information about the last users that |
238 | logged into the system (mimics sysvinit last). +900 bytes. | 247 | logged into the system (mimics sysvinit last). +900 bytes. |
248 | endchoice | ||
239 | 249 | ||
240 | config LESS | 250 | config LESS |
241 | bool "less" | 251 | 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 | |||
16 | lib-$(CONFIG_EJECT) += eject.o | 16 | lib-$(CONFIG_EJECT) += eject.o |
17 | lib-$(CONFIG_FBSPLASH) += fbsplash.o | 17 | lib-$(CONFIG_FBSPLASH) += fbsplash.o |
18 | lib-$(CONFIG_HDPARM) += hdparm.o | 18 | lib-$(CONFIG_HDPARM) += hdparm.o |
19 | lib-$(CONFIG_LAST) += last.o | 19 | lib-$(CONFIG_FEATURE_LAST_SMALL)+= last.o |
20 | lib-$(CONFIG_FEATURE_LAST_FANCY)+= last_fancy.o | ||
20 | lib-$(CONFIG_LESS) += less.o | 21 | lib-$(CONFIG_LESS) += less.o |
21 | lib-$(CONFIG_MAKEDEVS) += makedevs.o | 22 | lib-$(CONFIG_MAKEDEVS) += makedevs.o |
22 | lib-$(CONFIG_MAN) += man.o | 23 | 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 @@ | |||
26 | #error struct utmp member char[] size(s) have changed! | 26 | #error struct utmp member char[] size(s) have changed! |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #if ENABLE_FEATURE_LAST_FANCY | ||
30 | |||
31 | #include "last_fancy.c" | ||
32 | |||
33 | #else | ||
34 | |||
35 | #if EMPTY != 0 || RUN_LVL != 1 || BOOT_TIME != 2 || NEW_TIME != 3 || \ | 29 | #if EMPTY != 0 || RUN_LVL != 1 || BOOT_TIME != 2 || NEW_TIME != 3 || \ |
36 | OLD_TIME != 4 | 30 | OLD_TIME != 4 |
37 | #error Values for the ut_type field of struct utmp changed | 31 | #error Values for the ut_type field of struct utmp changed |
@@ -131,5 +125,3 @@ int last_main(int argc, char **argv ATTRIBUTE_UNUSED) | |||
131 | 125 | ||
132 | fflush_stdout_and_exit(EXIT_SUCCESS); | 126 | fflush_stdout_and_exit(EXIT_SUCCESS); |
133 | } | 127 | } |
134 | |||
135 | #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 @@ | |||
7 | * Licensed under the GPLv2 or later, see the file LICENSE in this tarball. | 7 | * Licensed under the GPLv2 or later, see the file LICENSE in this tarball. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "libbb.h" | ||
11 | #include <utmp.h> | ||
12 | |||
13 | #ifndef SHUTDOWN_TIME | ||
14 | # define SHUTDOWN_TIME 254 | ||
15 | #endif | ||
16 | |||
10 | #define HEADER_FORMAT "%-8.8s %-12.12s %-*.*s %-16.16s %-7.7s %s\n" | 17 | #define HEADER_FORMAT "%-8.8s %-12.12s %-*.*s %-16.16s %-7.7s %s\n" |
11 | #define HEADER_LINE "USER", "TTY", \ | 18 | #define HEADER_LINE "USER", "TTY", \ |
12 | INET_ADDRSTRLEN, INET_ADDRSTRLEN, "HOST", "LOGIN", " TIME", "" | 19 | INET_ADDRSTRLEN, INET_ADDRSTRLEN, "HOST", "LOGIN", " TIME", "" |