version 1.29, 2020/08/27 15:20:31 |
version 1.30, 2021/07/12 15:09:20 |
|
|
if (show_quick) { |
if (show_quick) { |
only_current_term = show_term = show_idle = show_labels = 0; |
only_current_term = show_term = show_idle = show_labels = 0; |
} |
} |
|
|
if (show_term) |
if (show_term) |
hostwidth -= 2; |
hostwidth -= 2; |
if (show_idle) |
if (show_idle) |
|
|
output_labels(); |
output_labels(); |
|
|
if (unveil(_PATH_UTMP, "r") == -1) |
if (unveil(_PATH_UTMP, "r") == -1) |
err(1, "unveil"); |
err(1, "unveil %s", _PATH_UTMP); |
if (show_term || show_idle) { |
if (show_term || show_idle) { |
if (unveil(_PATH_DEV, "r") == -1) |
if (unveil(_PATH_DEV, "r") == -1) |
err(1, "unveil"); |
err(1, "unveil %s", _PATH_DEV); |
} |
} |
switch (argc) { |
switch (argc) { |
case 0: /* who */ |
case 0: /* who */ |
|
|
who_am_i(ufp); |
who_am_i(ufp); |
} else if (show_quick) { |
} else if (show_quick) { |
int count = 0; |
int count = 0; |
|
|
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { |
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) { |
if (*usr.ut_name && *usr.ut_line) { |
if (*usr.ut_name && *usr.ut_line) { |
(void)printf("%-*.*s ", NAME_WIDTH, |
(void)printf("%-*.*s ", NAME_WIDTH, |
|
|
break; |
break; |
case 1: /* who utmp_file */ |
case 1: /* who utmp_file */ |
if (unveil(*argv, "r") == -1) |
if (unveil(*argv, "r") == -1) |
err(1, "unveil"); |
err(1, "unveil %s", *argv); |
if (pledge("stdio rpath getpw", NULL) == -1) |
if (pledge("stdio rpath getpw", NULL) == -1) |
err(1, "pledge"); |
err(1, "pledge"); |
ufp = file(*argv); |
ufp = file(*argv); |