- while (fread (ut, 1, sizeof(struct utmp), f)) {
- //printf("%d:%d:%s:%s:%s:%s:%d:%d:%ld:%ld:%ld:%x\n",
- printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n",
- ut->ut_type, ut->ut_pid, ut->ut_line,
- ut->ut_id, ut->ut_user, ut->ut_host,
- ut->ut_exit.e_termination, ut->ut_exit.e_exit,
- ut->ut_session,
- ut->ut_tv.tv_sec, ut->ut_tv.tv_usec,
- ut->ut_addr);
+ /* Kludge around the fact that the binary format for utmp has changed. */
+#if __GNU_LIBRARY__ < 5
+ /* Linux libc5 */
+
+ bb_printf("%d|%d|%s|%s|%s|%s|%s|%lx\n",
+ ut.ut_type, ut.ut_pid, ut.ut_line,
+ ut.ut_id, ut.ut_user, ut.ut_host,
+ ctime(&(ut.ut_time)),
+ (long)ut.ut_addr);
+#else
+ /* Glibc, uClibc, etc. */
+
+ bb_printf("%d|%d|%.32s|%.4s|%.32s|%.256s|%d|%d|%ld|%ld|%ld|%x\n",
+ ut.ut_type, ut.ut_pid, ut.ut_line,
+ ut.ut_id, ut.ut_user, ut.ut_host,
+ ut.ut_exit.e_termination, ut.ut_exit.e_exit,
+ ut.ut_session,
+ ut.ut_tv.tv_sec, ut.ut_tv.tv_usec,
+ ut.ut_addr);
+#endif