diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2015-11-03 14:24:52 +0300 |
---|---|---|
committer | Evgeny Vereshchagin <evvers@ya.ru> | 2015-11-03 14:24:52 +0300 |
commit | e2c9a13136cdf71b97a4e26b285ca2c3ba96db66 (patch) | |
tree | 7e708448e4eba152c610d279e0bd2e7f539271d2 | |
parent | c573dcfeb1abd390cd4c4288056df97752ef18f0 (diff) |
core: use runlevel_to_target for /proc/cmdline parsing
-rw-r--r-- | src/core/main.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/core/main.c b/src/core/main.c index 593b974566..299ff7cee6 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -301,20 +301,6 @@ static int parse_crash_chvt(const char *value) { static int parse_proc_cmdline_item(const char *key, const char *value) { - static const char * const rlmap[] = { - "emergency", SPECIAL_EMERGENCY_TARGET, - "-b", SPECIAL_EMERGENCY_TARGET, - "rescue", SPECIAL_RESCUE_TARGET, - "single", SPECIAL_RESCUE_TARGET, - "-s", SPECIAL_RESCUE_TARGET, - "s", SPECIAL_RESCUE_TARGET, - "S", SPECIAL_RESCUE_TARGET, - "1", SPECIAL_RESCUE_TARGET, - "2", SPECIAL_MULTI_USER_TARGET, - "3", SPECIAL_MULTI_USER_TARGET, - "4", SPECIAL_MULTI_USER_TARGET, - "5", SPECIAL_GRAPHICAL_TARGET, - }; int r; assert(key); @@ -415,12 +401,12 @@ static int parse_proc_cmdline_item(const char *key, const char *value) { log_set_target(LOG_TARGET_CONSOLE); } else if (!in_initrd() && !value) { - unsigned i; + const char *target; /* SysV compatibility */ - for (i = 0; i < ELEMENTSOF(rlmap); i += 2) - if (streq(key, rlmap[i])) - return free_and_strdup(&arg_default_unit, rlmap[i+1]); + target = runlevel_to_target(key); + if (target) + return free_and_strdup(&arg_default_unit, target); } return 0; |