#include #include #include int main() { struct utmpx *p; char *t = 0; while((p = getutxent())) { if (p->ut_type == USER_PROCESS) { printf("%-11s", p->ut_user); printf("%-13s", p->ut_line); // show time t = ctime(&(p->ut_tv.tv_sec)); t[16]=0; printf("%-16s", 4+t); printf("(%s)\n", p->ut_host); } } return 0; }