diff options
| author | Eric Andersen <andersen@codepoet.org> | 2000-09-22 00:22:10 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2000-09-22 00:22:10 +0000 |
| commit | 75610e18b3fb9366e73dec22c15c437b00afc812 (patch) | |
| tree | 7a34beacf04b11a0392b89b4b69f5a3fa50b0855 /miscutils | |
| parent | 2c1faecba7140bb5b51ecb544b2420b5fbcc78b5 (diff) | |
| download | busybox-w32-75610e18b3fb9366e73dec22c15c437b00afc812.tar.gz busybox-w32-75610e18b3fb9366e73dec22c15c437b00afc812.tar.bz2 busybox-w32-75610e18b3fb9366e73dec22c15c437b00afc812.zip | |
Better cross libc compatibility (so Dave Cinege can stop complaining
that I broke it).
-Erik
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/dutmp.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index 5a6eb076b..ec10941d0 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * versions of 'who', 'last', etc. IP Addr is output in hex, | 8 | * versions of 'who', 'last', etc. IP Addr is output in hex, |
| 9 | * little endian on x86. | 9 | * little endian on x86. |
| 10 | * | 10 | * |
| 11 | * Modified to support all sort of libcs by | 11 | * Modified to support all sorts of libcs by |
| 12 | * Erik Andersen <andersen@lineo.com> | 12 | * Erik Andersen <andersen@lineo.com> |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| @@ -39,6 +39,11 @@ extern int dutmp_main(int argc, char **argv) | |||
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /* Kludge around the fact that the binary format for utmp has changed, and the | ||
| 43 | * fact the stupid libc doesn't have a reliable #define to announce that libc5 | ||
| 44 | * is being used. sigh. | ||
| 45 | */ | ||
| 46 | #if ! defined __GLIBC__ | ||
| 42 | while (read(file, (void*)&ut, sizeof(struct utmp))) { | 47 | while (read(file, (void*)&ut, sizeof(struct utmp))) { |
| 43 | printf("%d|%d|%s|%s|%s|%s|%s|%lx\n", | 48 | printf("%d|%d|%s|%s|%s|%s|%s|%lx\n", |
| 44 | ut.ut_type, ut.ut_pid, ut.ut_line, | 49 | ut.ut_type, ut.ut_pid, ut.ut_line, |
| @@ -46,6 +51,16 @@ extern int dutmp_main(int argc, char **argv) | |||
| 46 | ctime(&(ut.ut_time)), | 51 | ctime(&(ut.ut_time)), |
| 47 | (long)ut.ut_addr); | 52 | (long)ut.ut_addr); |
| 48 | } | 53 | } |
| 49 | 54 | #else | |
| 55 | while (read(file, (void*)&ut, sizeof(struct utmp))) { | ||
| 56 | printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n", | ||
| 57 | ut.ut_type, ut.ut_pid, ut.ut_line, | ||
| 58 | ut.ut_id, ut.ut_user, ut.ut_host, | ||
| 59 | ut.ut_exit.e_termination, ut.ut_exit.e_exit, | ||
| 60 | ut.ut_session, | ||
| 61 | ut.ut_tv.tv_sec, ut.ut_tv.tv_usec, | ||
| 62 | ut.ut_addr); | ||
| 63 | } | ||
| 64 | #endif | ||
| 50 | return(TRUE); | 65 | return(TRUE); |
| 51 | } | 66 | } |
