Lines Matching refs:ut
59 struct utmp *ut = (struct utmp *)l->arg; in find_and_dlink() local
61 if (!strncmp(ut->ut_line, devname, UT_LINESIZE)) { in find_and_dlink()
89 struct utmp ut; in last_main() local
104 loc -= sizeof(ut); in last_main()
109 xreadall(fd, &ut, sizeof(ut)); in last_main()
110 *tm = ut.ut_tv.tv_sec; in last_main()
111 if (*ut.ut_line == '~') { in last_main()
112 if (!strcmp(ut.ut_user, "runlevel")) ut.ut_type = RUN_LVL; in last_main()
113 else if (!strcmp(ut.ut_user, "reboot")) ut.ut_type = BOOT_TIME; in last_main()
114 else if (!strcmp(ut.ut_user, "shutdown")) ut.ut_type = SHUTDOWN_TIME; in last_main()
115 } else if (!*ut.ut_user) ut.ut_type = DEAD_PROCESS; in last_main()
116 else if (*ut.ut_user && *ut.ut_line && ut.ut_type != DEAD_PROCESS in last_main()
117 && strcmp(ut.ut_user, "LOGIN")) ut.ut_type = USER_PROCESS; in last_main()
121 if (!strcmp(ut.ut_user, "date")) { in last_main()
122 if (ut.ut_line[0] == '|') ut.ut_type = OLD_TIME; in last_main()
123 if (ut.ut_line[0] == '{') ut.ut_type = NEW_TIME; in last_main()
126 if ((ut.ut_type == SHUTDOWN_TIME) || ((ut.ut_type == RUN_LVL) && in last_main()
127 (((ut.ut_pid & 255) == '0') || ((ut.ut_pid & 255) == '6')))) in last_main()
129 tm[1] = tm[2] = (time_t)ut.ut_tv.tv_sec; in last_main()
132 } else if (ut.ut_type == BOOT_TIME) { in last_main()
134 strcpy(ut.ut_line, "system boot"); in last_main()
136 printf("%-8.8s %-12.12s %-*.*s %-16.16s %-7.7s %s\n", ut.ut_user, in last_main()
137 ut.ut_line, pwidth, pwidth, ut.ut_host, in last_main()
140 tm[2] = (time_t)ut.ut_tv.tv_sec; in last_main()
141 } else if (ut.ut_type == USER_PROCESS && *ut.ut_line) { in last_main()
142 struct arg_list *l = find_and_dlink(&TT.list, ut.ut_line); in last_main()
147 printf("%-8.8s %-12.12s %-*.*s %-16.16s %-7.7s %s\n", ut.ut_user, in last_main()
148 ut.ut_line, pwidth, pwidth, ut.ut_host, in last_main()
155 if ((ut.ut_pid > 0) && (kill(ut.ut_pid, 0)!=0) && (errno == ESRCH)) in last_main()
177 printf("%-8.8s %-12.12s %-*.*s %-16.16s %-7.7s %s\n", ut.ut_user, in last_main()
178 ut.ut_line, pwidth, pwidth, ut.ut_host, in last_main()
181 llist_add_node(&TT.list, memcpy(xmalloc(sizeof(ut)), &ut, sizeof(ut))); in last_main()
182 } else if (ut.ut_type == DEAD_PROCESS && *ut.ut_line) in last_main()
183 llist_add_node(&TT.list, memcpy(xmalloc(sizeof(ut)), &ut, sizeof(ut))); in last_main()
185 loc -= sizeof(ut); in last_main()