]>
Commit | Line | Data |
---|---|---|
a3e03be0 EA |
1 | #include <errno.h> |
2 | #include <limits.h> | |
3 | #include <string.h> | |
4 | #include <unistd.h> | |
5 | #include <stdlib.h> | |
6 | #include <utmp.h> | |
7 | ||
8 | /* Write the given entry into utmp and wtmp. */ | |
9 | void login (const struct utmp *entry) | |
10 | { | |
efe2271a EA |
11 | struct utmp copy = *entry; |
12 | ||
13 | utmpname(_PATH_UTMP); | |
14 | setutent(); | |
15 | #if _HAVE_UT_TYPE - 0 | |
16 | copy.ut_type = USER_PROCESS; | |
17 | #endif | |
18 | #if _HAVE_UT_PID - 0 | |
19 | copy.ut_pid = getpid(); | |
20 | #endif | |
21 | strncpy (copy.ut_line, entry->ut_line, UT_LINESIZE); | |
22 | pututline(entry); | |
23 | endutent(); | |
a3e03be0 | 24 | } |
a3e03be0 | 25 |