version 1.31, 2022/12/04 23:50:48 |
version 1.32, 2023/02/01 00:03:38 |
|
|
err(1, "%s", acctfile); |
err(1, "%s", acctfile); |
|
|
for (;;) { |
for (;;) { |
|
char commpid[sizeof(ab.ac_comm) + 13]; |
|
|
if (fread(&ab, sizeof(struct acct), 1, fp) != 1) |
if (fread(&ab, sizeof(struct acct), 1, fp) != 1) |
err(1, "%s", acctfile); |
err(1, "%s", acctfile); |
|
|
|
|
p < &ab.ac_comm[sizeof ab.ac_comm] && *p; ++p) |
p < &ab.ac_comm[sizeof ab.ac_comm] && *p; ++p) |
if (!isprint((unsigned char)*p)) |
if (!isprint((unsigned char)*p)) |
*p = '?'; |
*p = '?'; |
|
snprintf(commpid, sizeof(commpid), "%s[%d]", |
|
ab.ac_comm, ab.ac_pid); |
if (!*argv || requested(argv, &ab)) { |
if (!*argv || requested(argv, &ab)) { |
t = expand(ab.ac_utime) + expand(ab.ac_stime); |
t = expand(ab.ac_utime) + expand(ab.ac_stime); |
(void)printf("%-*.*s %-7s %-*.*s %-*.*s %6.2f secs %.16s", |
(void)printf("%-*.*s %-7s %-*.*s %-*.*s %6.2f secs %.16s", |
(int)sizeof ab.ac_comm, |
(int)sizeof commpid, |
(int)sizeof ab.ac_comm, |
(int)sizeof commpid, |
ab.ac_comm, flagbits(ab.ac_flag), UT_NAMESIZE, |
commpid, flagbits(ab.ac_flag), UT_NAMESIZE, |
UT_NAMESIZE, user_from_uid(ab.ac_uid, 0), |
UT_NAMESIZE, user_from_uid(ab.ac_uid, 0), |
UT_LINESIZE, UT_LINESIZE, getdev(ab.ac_tty), |
UT_LINESIZE, UT_LINESIZE, getdev(ab.ac_tty), |
t / (double)AHZ, ctime(&ab.ac_btime)); |
t / (double)AHZ, ctime(&ab.ac_btime)); |