Last change
on this file since 3745 was 3320, checked in by Bruno Cornec, 10 years ago |
- Re-add (thanks git BTW) the 2.2.9 branch which had been destroyed in
the move to 3.0
|
-
Property svn:eol-style
set to
native
|
File size:
919 bytes
|
Rev | Line | |
---|
[3320] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * Prints out the previous and the current runlevel.
|
---|
| 4 | *
|
---|
| 5 | * Version: @(#)runlevel 1.20 16-Apr-1997 MvS
|
---|
| 6 | *
|
---|
| 7 | * This file is part of the sysvinit suite,
|
---|
| 8 | * Copyright 1991-1997 Miquel van Smoorenburg.
|
---|
| 9 | *
|
---|
| 10 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
| 11 | *
|
---|
| 12 | * initially busyboxified by Bernhard Reutner-Fischer
|
---|
| 13 | */
|
---|
| 14 | #include "libbb.h"
|
---|
| 15 | #include <utmp.h>
|
---|
| 16 |
|
---|
| 17 | int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
| 18 | int runlevel_main(int argc UNUSED_PARAM, char **argv)
|
---|
| 19 | {
|
---|
| 20 | struct utmp *ut;
|
---|
| 21 | char prev;
|
---|
| 22 |
|
---|
| 23 | if (argv[1]) utmpname(argv[1]);
|
---|
| 24 |
|
---|
| 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 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | puts("unknown");
|
---|
| 38 |
|
---|
| 39 | if (ENABLE_FEATURE_CLEAN_UP)
|
---|
| 40 | endutent();
|
---|
| 41 | return 1;
|
---|
| 42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.