New cmdline options to control debug and progress/status

Modeled after systemd.show_status, currently without the 'auto' setting.

- finit.debug[=bool]
- finit.show_status[=bool]
- finit.status_style[=old,classic,new,modern]

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-02-14 20:11:45 +01:00
1 parent 35e4e0d073
commit 70ca64a392
5 files changed
+74 -19

No files matched your search

+11 -9
View File
@@ -39,13 +39,7 @@
#include "util.h"
#include "utmp-api.h"
typedef enum {
PROGRESS_SILENT,
PROGRESS_CLASSIC,
PROGRESS_MODERN,
} pstyle_t;
#define PROGRESS_DEFAULT PROGRESS_MODERN
static pstyle_t progress_onoff = PROGRESS_DEFAULT;
static pstyle_t progress_style = PROGRESS_DEFAULT;
#ifndef HOSTNAME_PATH
@@ -189,14 +183,22 @@ char *strip_line(char *line)
return line;
}
void show_progress(int onoff)
void enable_progress(int onoff)
{
if (debug)
return;
if (onoff)
progress_style = PROGRESS_DEFAULT;
progress_style = progress_onoff;
else
progress_style = PROGRESS_SILENT;
}
void show_progress(pstyle_t style)
{
progress_onoff = style;
}
/*
* Return screen length of string, not counting escape chars, and
* accounting for unicode characters as only one screen byte wide