rc-status -r now shows the current runlevel name.
This commit is contained in:
parent
04b1a62c4b
commit
09ff8eeecd
@ -44,6 +44,8 @@ The options are as follows:
|
|||||||
Show all runlevels and their services.
|
Show all runlevels and their services.
|
||||||
.It Fl l , -list
|
.It Fl l , -list
|
||||||
List all defined runlevels.
|
List all defined runlevels.
|
||||||
|
.It fl r , -runlevel
|
||||||
|
Print the current runlevel name.
|
||||||
.It Fl s , -servicelist
|
.It Fl s , -servicelist
|
||||||
Show all services.
|
Show all services.
|
||||||
.It Fl u , -unused
|
.It Fl u , -unused
|
||||||
|
@ -94,10 +94,11 @@ static void print_service (char *service)
|
|||||||
|
|
||||||
#include "_usage.h"
|
#include "_usage.h"
|
||||||
#define extraopts "[runlevel1] [runlevel2] ..."
|
#define extraopts "[runlevel1] [runlevel2] ..."
|
||||||
#define getoptstring "alsu" getoptstring_COMMON
|
#define getoptstring "alrsu" getoptstring_COMMON
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
{"all", 0, NULL, 'a'},
|
{"all", 0, NULL, 'a'},
|
||||||
{"list", 0, NULL, 'l'},
|
{"list", 0, NULL, 'l'},
|
||||||
|
{"runlevel", 0, NULL, 'r'},
|
||||||
{"servicelist", 0, NULL, 's'},
|
{"servicelist", 0, NULL, 's'},
|
||||||
{"unused", 0, NULL, 'u'},
|
{"unused", 0, NULL, 'u'},
|
||||||
longopts_COMMON
|
longopts_COMMON
|
||||||
@ -105,6 +106,7 @@ static const struct option longopts[] = {
|
|||||||
static const char * const longopts_help[] = {
|
static const char * const longopts_help[] = {
|
||||||
"Show services from all run levels",
|
"Show services from all run levels",
|
||||||
"Show list of run levels",
|
"Show list of run levels",
|
||||||
|
"Show the name of the current runlevel",
|
||||||
"Show service list",
|
"Show service list",
|
||||||
"Show services not assigned to any runlevel",
|
"Show services not assigned to any runlevel",
|
||||||
longopts_help_COMMON
|
longopts_help_COMMON
|
||||||
@ -137,6 +139,12 @@ int rc_status (int argc, char **argv)
|
|||||||
rc_strlist_free (levels);
|
rc_strlist_free (levels);
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
case 'r':
|
||||||
|
level = rc_runlevel_get ();
|
||||||
|
printf ("%s\n", level);
|
||||||
|
free (level);
|
||||||
|
exit (EXIT_SUCCESS);
|
||||||
|
/* NOTREACHED */
|
||||||
case 's':
|
case 's':
|
||||||
services = rc_services_in_runlevel (NULL);
|
services = rc_services_in_runlevel (NULL);
|
||||||
STRLIST_FOREACH (services, service, i)
|
STRLIST_FOREACH (services, service, i)
|
||||||
|
Loading…
Reference in New Issue
Block a user