Relocate runlevel_string() to initctl.c

Only used by this tool, no need to keep it in helpers.c

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-02-10 10:11:52 +01:00
1 parent 9974d65756
commit 958cab8cc7
3 files changed
+37 -38

No files matched your search

-36
View File
@@ -63,42 +63,6 @@ void runlevel_set(int pre, int now)
utmp_set_runlevel(pre, now);
}
/**
* runlevel_string - Convert a bit encoded runlevel to .conf syntax
* @levels: Bit encoded runlevels
*
* Returns:
* Pointer to string on the form [2345]
*/
char *runlevel_string(int levels)
{
int i, pos = 1;
static char lvl[20];
memset(lvl, 0, sizeof(lvl));
lvl[0] = '[';
for (i = 0; i < 10; i++) {
if (ISSET(levels, i)) {
if (runlevel == i)
pos = strlcat(lvl, "\e[1m", sizeof(lvl));
if (i == 0)
lvl[pos++] = 'S';
else
lvl[pos++] = '0' + i;
if (runlevel == i)
pos = strlcat(lvl, "\e[0m", sizeof(lvl));
}
}
lvl[pos++] = ']';
lvl[pos] = 0;
return lvl;
}
static int print_timestamp(void)
{
#if defined(CONFIG_PRINTK_TIME)