OSDN Git Service

- trim any trailing whitespace
[uclinux-h8/uClibc.git] / libutil / login.c
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 {
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();
24 }
25