| 499 | } |
| 500 | |
| 501 | static void |
| 502 | print_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. */ |
no test coverage detected