| 414 | /* Display UTMP_BUF, which should have N entries. */ |
| 415 | |
| 416 | static void |
| 417 | scan_entries (idx_t n, STRUCT_UTMP const *utmp_buf, |
| 418 | const int argc_names, char *const argv_names[]) |
| 419 | { |
| 420 | if (hard_locale (LC_TIME)) |
| 421 | { |
| 422 | time_format = "%Y-%m-%d %H:%M"; |
| 423 | time_format_width = 4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2; |
| 424 | } |
| 425 | else |
| 426 | { |
| 427 | time_format = "%b %e %H:%M"; |
| 428 | time_format_width = 3 + 1 + 2 + 1 + 2 + 1 + 2; |
| 429 | } |
| 430 | |
| 431 | if (include_heading) |
| 432 | print_heading (); |
| 433 | |
| 434 | while (n--) |
| 435 | { |
| 436 | if (IS_USER_PROCESS (utmp_buf)) |
| 437 | { |
| 438 | if (argc_names) |
| 439 | { |
| 440 | for (int i = 0; i < argc_names; i++) |
| 441 | if (streq (utmp_buf->ut_user, argv_names[i])) |
| 442 | { |
| 443 | print_entry (utmp_buf); |
| 444 | break; |
| 445 | } |
| 446 | } |
| 447 | else |
| 448 | print_entry (utmp_buf); |
| 449 | } |
| 450 | utmp_buf++; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | /* Display a list of who is on the system, according to utmp file FILENAME. */ |
| 455 |
no test coverage detected