- introduce and use bb_path_wtmp_file for portability (saves 11 Bytes).

- fix last.c to also look at the double-underscore UT_ defines.
This commit is contained in:
Bernhard Reutner-Fischer
2006-05-26 14:41:40 +00:00
parent b180e5a766
commit 781e42d66c
5 changed files with 33 additions and 13 deletions

View File

@ -26,7 +26,11 @@
* Do what we can while still keeping this reasonably small.
* Note: We are assuming the ut_id[] size is fixed at 4. */
#if (UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256)
#if defined UT_LINESIZE \
&& ((UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256))
#error struct utmp member char[] size(s) have changed!
#elif defined __UT_LINESIZE \
&& ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 64) || (__UT_HOSTSIZE != 256))
#error struct utmp member char[] size(s) have changed!
#endif
@ -39,7 +43,7 @@ int last_main(int argc, char **argv)
if (argc > 1) {
bb_show_usage();
}
file = bb_xopen(_PATH_WTMP, O_RDONLY);
file = bb_xopen(bb_path_wtmp_file, O_RDONLY);
printf("%-10s %-14s %-18s %-12.12s %s\n", "USER", "TTY", "HOST", "LOGIN", "TIME");
while ((n = safe_read(file, (void*)&ut, sizeof(struct utmp))) != 0) {