12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #include "libbb.h"
- int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
- int runlevel_main(int argc UNUSED_PARAM, char **argv)
- {
- struct utmpx *ut;
- char prev;
- if (argv[1]) utmpxname(argv[1]);
- setutxent();
- while ((ut = getutxent()) != NULL) {
- if (ut->ut_type == RUN_LVL) {
- prev = ut->ut_pid / 256;
- if (prev == 0) prev = 'N';
- printf("%c %c\n", prev, ut->ut_pid % 256);
- if (ENABLE_FEATURE_CLEAN_UP)
- endutxent();
- return 0;
- }
- }
- puts("unknown");
- if (ENABLE_FEATURE_CLEAN_UP)
- endutxent();
- return 1;
- }
|