MCPcopy Create free account
hub / github.com/coreutils/coreutils / scan_entries

Function scan_entries

src/pinky.c:416–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414/* Display UTMP_BUF, which should have N entries. */
415
416static void
417scan_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

Callers 1

short_pinkyFunction · 0.70

Calls 2

print_entryFunction · 0.85
print_headingFunction · 0.70

Tested by

no test coverage detected