1 #include <utmpx.h> 2 #define T(t) (t*)0; 3 #define F(t,n) {t *y = &x.n;} 4 #define C(n) switch(n){case n:;} f()5static void f() 6 { 7 T(pid_t) 8 T(struct timeval) 9 { 10 struct utmpx x; 11 F(char,ut_user[0]) 12 F(char,ut_id[0]) 13 F(char,ut_line[0]) 14 F(pid_t, ut_pid) 15 F(short, ut_type) 16 F(struct timeval,ut_tv) 17 } 18 C(EMPTY) 19 C(BOOT_TIME) 20 C(OLD_TIME) 21 C(NEW_TIME) 22 C(USER_PROCESS) 23 C(INIT_PROCESS) 24 C(LOGIN_PROCESS) 25 C(DEAD_PROCESS) 26 {void(*p)(void) = endutxent;} 27 {struct utmpx*(*p)(void) = getutxent;} 28 {struct utmpx*(*p)(const struct utmpx*) = getutxid;} 29 {struct utmpx*(*p)(const struct utmpx*) = getutxline;} 30 {struct utmpx*(*p)(const struct utmpx*) = pututxline;} 31 {void(*p)(void) = setutxent;} 32 } 33