aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-12-04 17:17:09 +0000
committerRoy Marples <roy@marples.name>2008-12-04 17:17:09 +0000
commit1acbfcf5ca32243304e6720f507ab57391f80200 (patch)
tree80347db90c5e107bf501ee189f8a7ae7cd7747d0
parentf8210050e52ba2f48db881bb56ddaa873ceca395 (diff)
Report invalid runlevels.
-rw-r--r--src/rc/rc-status.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index 03084192..619b68c3 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -244,8 +244,16 @@ rc_status(int argc, char **argv)
if (!levels)
levels = rc_stringlist_new();
- while (optind < argc)
- rc_stringlist_add(levels, argv[optind++]);
+ opt = (optind < argc) ? 0 : 1;
+ while (optind < argc) {
+ if (rc_runlevel_exists(argv[optind])) {
+ rc_stringlist_add(levels, argv[optind++]);
+ opt++;
+ } else
+ eerror("runlevel `%s' does not exist", argv[optind++]);
+ }
+ if (opt == 0)
+ exit(EXIT_FAILURE);
if (!TAILQ_FIRST(levels)) {
runlevel = rc_runlevel_get();
rc_stringlist_add(levels, runlevel);