From 9430785779a178c2226b86e9ac46013123dea76a Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 8 May 2020 15:25:41 +0200 Subject: Cleanup: remove rest of status.c Signed-off-by: David Oberhollenzer --- initd/supervisor.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'initd/supervisor.c') diff --git a/initd/supervisor.c b/initd/supervisor.c index 8de61c9..6fdaae1 100644 --- a/initd/supervisor.c +++ b/initd/supervisor.c @@ -21,6 +21,32 @@ static bool waiting = false; /*****************************************************************************/ +enum { + STATUS_OK = 0, + STATUS_FAIL, + STATUS_WAIT, + STATUS_STARTED, +}; + +static const char *status_str[] = { + [STATUS_OK] = "\033[22;32m OK \033[0m", + [STATUS_FAIL] ="\033[22;31mFAIL\033[0m", + [STATUS_WAIT] = "\033[22;33m .. \033[0m", + [STATUS_STARTED] ="\033[22;32m UP \033[0m", +}; + +static void print_status(const char *msg, int type, bool update) +{ + if (update) + fputc('\r', stdout); + + printf("[%s] %s", status_str[type], msg); + + if (type != STATUS_WAIT) + fputc('\n', stdout); + fflush(stdout); +} + static svc_run_data_t *run_time_data_from_pid(pid_t pid) { size_t i; -- cgit v1.2.3