Путь: Toys/POSIX, команды версии: Ver.4 Ver.9 who Комментарии в файле who.c :
Исходный текст в файле who.c #define FOR_who #include "toys.h" void who_main(void) { struct utmpx *entry; setutxent(); while ((entry = getutxent())) { if (FLAG(a) || entry->ut_type == USER_PROCESS) { time_t t = entry->ut_tv.tv_sec; struct tm *tm = localtime(&t); strftime(toybuf, sizeof(toybuf), "%F %H:%M", tm); printf("%s\t%s\t%s (%s)\n", entry->ut_user, entry->ut_line, toybuf, entry->ut_host); } } endutxent(); } |
![]() |