]>
git.wh0rd.org - sysvinit.git/blob - src/runlevel.c
2 * runlevel Prints out the previous and the current runlevel.
4 * Version: @(#)runlevel 1.20 16-Apr-1997 MvS
6 * This file is part of the sysvinit suite,
7 * Copyright (C) 1991-1997 Miquel van Smoorenburg.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
36 if (argc
> 1) utmpname(argv
[1]);
39 while ((ut
= getutent()) != NULL
) {
40 if (ut
->ut_type
== RUN_LVL
) {
41 prev
= ut
->ut_pid
/ 256;
42 if (prev
== 0) prev
= 'N';
43 printf("%c %c\n", prev
, ut
->ut_pid
% 256);