Last change
on this file since 2838 was 2725, checked in by Bruno Cornec, 13 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
File size:
919 bytes
|
Rev | Line | |
---|
[821] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
[2725] | 3 | * Prints out the previous and the current runlevel.
|
---|
[821] | 4 | *
|
---|
[2725] | 5 | * Version: @(#)runlevel 1.20 16-Apr-1997 MvS
|
---|
[821] | 6 | *
|
---|
[2725] | 7 | * This file is part of the sysvinit suite,
|
---|
| 8 | * Copyright 1991-1997 Miquel van Smoorenburg.
|
---|
[821] | 9 | *
|
---|
[2725] | 10 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 11 | *
|
---|
[2725] | 12 | * initially busyboxified by Bernhard Reutner-Fischer
|
---|
[821] | 13 | */
|
---|
[2725] | 14 | #include "libbb.h"
|
---|
[821] | 15 | #include <utmp.h>
|
---|
| 16 |
|
---|
[2725] | 17 | int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
| 18 | int runlevel_main(int argc UNUSED_PARAM, char **argv)
|
---|
[821] | 19 | {
|
---|
[1765] | 20 | struct utmp *ut;
|
---|
| 21 | char prev;
|
---|
[821] | 22 |
|
---|
[2725] | 23 | if (argv[1]) utmpname(argv[1]);
|
---|
[821] | 24 |
|
---|
[1765] | 25 | setutent();
|
---|
| 26 | while ((ut = getutent()) != NULL) {
|
---|
| 27 | if (ut->ut_type == RUN_LVL) {
|
---|
| 28 | prev = ut->ut_pid / 256;
|
---|
| 29 | if (prev == 0) prev = 'N';
|
---|
| 30 | printf("%c %c\n", prev, ut->ut_pid % 256);
|
---|
| 31 | if (ENABLE_FEATURE_CLEAN_UP)
|
---|
| 32 | endutent();
|
---|
| 33 | return 0;
|
---|
| 34 | }
|
---|
[821] | 35 | }
|
---|
| 36 |
|
---|
[1765] | 37 | puts("unknown");
|
---|
| 38 |
|
---|
| 39 | if (ENABLE_FEATURE_CLEAN_UP)
|
---|
| 40 | endutent();
|
---|
| 41 | return 1;
|
---|
[821] | 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.