1 /* who.c - display who is on the system
3 * Copyright 2012 ProFUSION Embedded Systems
5 * by Luis Felipe Strano Moraes <lfelipe@profusion.mobi>
7 * See http://opengroup.org/onlinepubs/9699919799/utilities/who.html
9 * Posix says to support many options (-abdHlmpqrstTu) but this
10 * isn't aimed at minicomputers with modem pools.
12 USE_WHO(NEWTOY(who, "a", TOYFLAG_USR|TOYFLAG_BIN))
17 depends on TOYBOX_UTMPX
21 Print logged user information on system
33 while ((entry = getutxent())) {
34 if ((toys.optflags & FLAG_a) || entry->ut_type == USER_PROCESS) {
39 time = entry->ut_tv.tv_sec;
41 time_size = strlen(times) - 2;
42 printf("%s\t%s\t%*.*s\t(%s)\n", entry->ut_user, entry->ut_line,
43 time_size, time_size, ctime(&time), entry->ut_host);