16 extern char *ttyname ();
19 if ((tty
= ttyname (0)) == 0)
22 if ((utmp_fd
= open (UTMP_FILE
, O_RDONLY
)) == -1)
25 if (!strncmp (tty
, "/dev/", 5))
28 while (read (utmp_fd
, &utmp_buf
, sizeof (utmp_buf
)) == sizeof (utmp_buf
))
30 if (!strncmp (tty
, utmp_buf
.ut_line
, sizeof (utmp_buf
.ut_line
))
31 && utmp_buf
.ut_type
== USER_PROCESS
)
34 memset (buf
, 0, sizeof (buf
));
35 strncpy (buf
, utmp_buf
.ut_user
, sizeof (utmp_buf
.ut_user
));
43 #endif /* !_NO_GETLOGIN */