diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-26 14:41:40 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-26 14:41:40 +0000 |
commit | 8f46d0577c15ca274963736a0791c06747e31c0d (patch) | |
tree | b139320b4b1275de767168b811ca45d1523f0573 /miscutils | |
parent | 73d6f297805faa5ab01168d0d29a723010e96730 (diff) | |
download | busybox-w32-8f46d0577c15ca274963736a0791c06747e31c0d.tar.gz busybox-w32-8f46d0577c15ca274963736a0791c06747e31c0d.tar.bz2 busybox-w32-8f46d0577c15ca274963736a0791c06747e31c0d.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.
git-svn-id: svn://busybox.net/trunk/busybox@15193 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/last.c | 8 |
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) { |