diff options
author | David Oberhollenzer <goliath@infraroot.at> | 2020-05-08 15:25:41 +0200 |
---|---|---|
committer | David Oberhollenzer <goliath@infraroot.at> | 2020-05-08 15:26:40 +0200 |
commit | 9430785779a178c2226b86e9ac46013123dea76a (patch) | |
tree | 567988e30e9c7e4cbe407b9d8f7a161b77fcf4c5 /initd/supervisor.c | |
parent | f6ef5b8dd3f1b8d6af104304a9988ff1f8edd182 (diff) |
Cleanup: remove rest of status.c
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'initd/supervisor.c')
-rw-r--r-- | initd/supervisor.c | 26 |
1 files changed, 26 insertions, 0 deletions
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; |