- while (fread(&ut, sizeof(struct utmp), 1, f)) {
+/* Kludge around the fact that the binary format for utmp has changed. */
+#if __GNU_LIBRARY__ < 5
+ /* Linux libc5 */
+ while (read(file, (void*)&ut, sizeof(struct utmp))) {
+ 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. */
+ while (read(file, (void*)&ut, sizeof(struct utmp))) {