aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 14:41:40 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 14:41:40 +0000
commit781e42d66c120183e4dea1058dc539bdc4c53651 (patch)
treeb139320b4b1275de767168b811ca45d1523f0573 /miscutils
parentb180e5a76678f697b2a368e2ef607d299d06a3ae (diff)
downloadbusybox-w32-781e42d66c120183e4dea1058dc539bdc4c53651.tar.gz
busybox-w32-781e42d66c120183e4dea1058dc539bdc4c53651.tar.bz2
busybox-w32-781e42d66c120183e4dea1058dc539bdc4c53651.zip
- introduce and use bb_path_wtmp_file for portability (saves 11 Bytes).
- fix last.c to also look at the double-underscore UT_ defines.
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/last.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/miscutils/last.c b/miscutils/last.c
index ac6c86c63..c10e1ea4f 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -26,7 +26,11 @@
26 * Do what we can while still keeping this reasonably small. 26 * Do what we can while still keeping this reasonably small.
27 * Note: We are assuming the ut_id[] size is fixed at 4. */ 27 * Note: We are assuming the ut_id[] size is fixed at 4. */
28 28
29#if (UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256) 29#if defined UT_LINESIZE \
30 && ((UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256))
31#error struct utmp member char[] size(s) have changed!
32#elif defined __UT_LINESIZE \
33 && ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 64) || (__UT_HOSTSIZE != 256))
30#error struct utmp member char[] size(s) have changed! 34#error struct utmp member char[] size(s) have changed!
31#endif 35#endif
32 36
@@ -39,7 +43,7 @@ int last_main(int argc, char **argv)
39 if (argc > 1) { 43 if (argc > 1) {
40 bb_show_usage(); 44 bb_show_usage();
41 } 45 }
42 file = bb_xopen(_PATH_WTMP, O_RDONLY); 46 file = bb_xopen(bb_path_wtmp_file, O_RDONLY);
43 47
44 printf("%-10s %-14s %-18s %-12.12s %s\n", "USER", "TTY", "HOST", "LOGIN", "TIME"); 48 printf("%-10s %-14s %-18s %-12.12s %s\n", "USER", "TTY", "HOST", "LOGIN", "TIME");
45 while ((n = safe_read(file, (void*)&ut, sizeof(struct utmp))) != 0) { 49 while ((n = safe_read(file, (void*)&ut, sizeof(struct utmp))) != 0) {