# include # include # define UTMP "/etc/utmp" main (ac, av) char **av; int ac; { FILE *u, *fopen(); struct utmp ur; if (!(u = fopen (UTMP, "r"))) { perror (UTMP); exit (1); } while (read (fileno(u), &ur, sizeof (ur)) == sizeof (ur)) { printf ("line: `%-8.8s', name: `%-8.8s', host: `%-16.16s', time: %d\n", ur.ut_line, ur.ut_name, ur.ut_host, ur.ut_time); } exit (0); }