Lines Matching refs:ep

129 static void	fixhost(struct entry *ep);
136 struct entry *ep; in main() local
249 if ((ep = calloc(1, sizeof(struct entry))) == NULL) in main()
251 (void)memcpy(ep->line, utx->ut_line, sizeof(utx->ut_line)); in main()
252 ep->line[sizeof(utx->ut_line)] = '\0'; in main()
253 *nextp = ep; in main()
254 nextp = &(ep->next); in main()
259 (void)memcpy(ep->name, utx->ut_name, sizeof(utx->ut_name)); in main()
260 ep->name[sizeof(utx->ut_name)] = '\0'; in main()
262 utx->ut_ss.ss_len, ep->host, sizeof(ep->host), NULL, 0, in main()
264 (void)memcpy(ep->host, utx->ut_host, in main()
266 ep->host[sizeof(utx->ut_host)] = '\0'; in main()
268 fixhost(ep); in main()
269 ep->type[0] = 'x'; in main()
270 ep->tv = utx->ut_tv; in main()
271 ep->pid = utx->ut_pid; in main()
272 process(ep); in main()
286 for (ep = ehead; ep != NULL; ep = ep->next) { in main()
287 if (strncmp(ep->line, ut->ut_line, in main()
291 if (ep != NULL) in main()
299 if ((ep = calloc(1, sizeof(struct entry))) == NULL) in main()
301 (void)memcpy(ep->name, ut->ut_name, sizeof(ut->ut_name)); in main()
302 (void)memcpy(ep->line, ut->ut_line, sizeof(ut->ut_line)); in main()
303 (void)memcpy(ep->host, ut->ut_host, sizeof(ut->ut_host)); in main()
304 ep->name[sizeof(ut->ut_name)] = '\0'; in main()
305 ep->line[sizeof(ut->ut_line)] = '\0'; in main()
306 ep->host[sizeof(ut->ut_host)] = '\0'; in main()
307 fixhost(ep); in main()
308 ep->tv.tv_sec = ut->ut_time; in main()
309 *nextp = ep; in main()
310 nextp = &(ep->next); in main()
311 process(ep); in main()
335 for (ep = ehead; ep != NULL; ep = ep->next) { in main()
336 if (ep->tdev != 0 && ep->tdev == kp->p_tdev && in main()
342 if (proc_compare_wrapper(ep->tp, kp)) in main()
343 ep->tp = kp; in main()
346 if (ep->pid != 0 && ep->pid == kp->p_pid) { in main()
347 ep->pp = kp; in main()
407 for (ep = ehead; ep != NULL; ep = ep->next) { in main()
408 if (ep->tp != NULL) in main()
409 kp = ep->tp; in main()
410 else if (ep->pp != NULL) in main()
411 kp = ep->pp; in main()
412 else if (ep->pid != 0) { in main()
417 ep->type, ep->name, ep->line, ep->host); in main()
421 usrnp = (kp == NULL) ? ep->name : kp->p_login; in main()
423 maxname, usrnp, ep->line, in main()
424 maxhost, maxhost, ep->host); in main()
425 then = (time_t)ep->tv.tv_sec; in main()
427 pr_idle(ep->idle); in main()
541 process(struct entry *ep) in process() argument
547 if ((max = strlen(ep->name)) > maxname) in process()
549 if ((max = strlen(ep->line)) > maxline) in process()
551 if ((max = strlen(ep->host)) > maxhost) in process()
554 ep->tdev = 0; in process()
555 ep->idle = (time_t)-1; in process()
567 if (ep->pid == 0 && strncmp(ep->line, "ftp", 3) == 0) { in process()
568 ep->pid = strtol(ep->line + 3, NULL, 10); in process()
572 if (ttystat(ep->line, &st) == -1) in process()
575 ep->tdev = st.st_rdev; in process()
580 if (ep->tdev == 0) { in process()
587 (void) sysctl(mib, 2, &ep->tdev, &size, NULL, 0); in process()
591 if (touched < ep->tv.tv_sec) { in process()
593 touched = ep->tv.tv_sec; in process()
595 if ((ep->idle = now - touched) < 0) in process()
596 ep->idle = 0; in process()
622 fixhost(struct entry *ep) in fixhost() argument
624 char host_buf[sizeof(ep->host)]; in fixhost()
632 strlcpy(host_buf, *ep->host ? ep->host : "-", sizeof(host_buf)); in fixhost()
694 (void)snprintf(ep->host, sizeof(ep->host), "%s:%s", r, x); in fixhost()
696 strlcpy(ep->host, r, sizeof(ep->host)); in fixhost()