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

Function print_runlevel

src/who.c:501–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501static void
502print_runlevel (STRUCT_UTMP const *utmp_ent)
503{
504 static char *runlevline, *comment;
505 unsigned char last = utmp_ent->ut_pid / 256;
506 unsigned char curr = utmp_ent->ut_pid % 256;
507
508 if (!runlevline)
509 runlevline = xmalloc (strlen (_("run-level")) + 3);
510 sprintf (runlevline, "%s %c", _("run-level"), curr);
511
512 if (!comment)
513 comment = xmalloc (strlen (_("last=")) + 2);
514 sprintf (comment, "%s%c", _("last="), (last == 'N') ? 'S' : last);
515
516 print_line ("", ' ', runlevline, time_string (utmp_ent),
517 "", "", c_isprint (last) ? comment : "", "");
518}
519
520/* Print the username of each valid entry and the number of valid entries
521 in UTMP_BUF, which should have N elements. */

Callers 1

scan_entriesFunction · 0.85

Calls 2

print_lineFunction · 0.70
time_stringFunction · 0.70

Tested by

no test coverage detected