1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19: #include <string.h>
20: #include <utmp.h>
21: #include <utmpx.h>
22:
23:
24: void
25: getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
26: {
27: memset (utmpx, 0, sizeof (struct utmpx));
28:
29: #if _HAVE_UT_TYPE - 0
30: utmpx->ut_type = utmp->ut_type;
31: #endif
32: #if _HAVE_UT_PID - 0
33: utmpx->ut_pid = utmp->ut_pid;
34: #endif
35: memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
36: memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
37: #if _HAVE_UT_ID - 0
38: memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
39: #endif
40: #if _HAVE_UT_HOST - 0
41: memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
42: #endif
43: #if _HAVE_UT_TV - 0
44: utmpx->ut_tv = utmp->ut_tv;
45: #else
46: utmpx->ut_time = utmp->ut_time;
47: #endif
48: }