11 static int utmp_fd
= -2;
12 static char *utmp_file
= UTMP_FILE
;
14 static struct utmp utmp_data
;
21 utmp_fd
= open (utmp_file
, O_RDONLY
);
23 lseek (utmp_fd
, 0, SEEK_SET
);
34 utmpname (const char *file
)
36 utmp_file
= strdup (file
);
44 if (read (utmp_fd
, &utmp_data
, sizeof (utmp_data
)) < sizeof (utmp_data
))
50 getutid (struct utmp
*id
)
52 while (read (utmp_fd
, &utmp_data
, sizeof (utmp_data
)) == sizeof (utmp_data
))
60 if (id
->ut_type
== utmp_data
.ut_type
)
66 if (!strncmp (id
->ut_id
, utmp_data
.ut_id
, sizeof (utmp_data
.ut_id
)))
77 getutline (struct utmp
*line
)
79 while (read (utmp_fd
, &utmp_data
, sizeof (utmp_data
)) == sizeof (utmp_data
))
81 if ((utmp_data
.ut_type
== LOGIN_PROCESS
||
82 utmp_data
.ut_type
== USER_PROCESS
) &&
83 !strncmp (utmp_data
.ut_line
, line
->ut_line
,
84 sizeof (utmp_data
.ut_line
)))
91 #endif /* !_NO_GETUT */