From 781e42d66c120183e4dea1058dc539bdc4c53651 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 26 May 2006 14:41:40 +0000 Subject: - introduce and use bb_path_wtmp_file for portability (saves 11 Bytes). - fix last.c to also look at the double-underscore UT_ defines. --- miscutils/last.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'miscutils') diff --git a/miscutils/last.c b/miscutils/last.c index ac6c86c..c10e1ea 100644 --- a/miscutils/last.c +++ b/miscutils/last.c @@ -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) { -- cgit v1.1