Convert banner() and printv() to use new screen_init() values

This patch changes the traditional look of the Finit boot sequence.
Now we stick to the screen width probed by screen_init(), or max
132 chars.

Also, some minor cleanup of the currently unused print_timestamp()
method used by printv() when showing [ OK ] or [FAIL] of services
at boot.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-07-04 20:59:49 +02:00
1 parent be6f0de0df
commit 99818f9ce0
2 files changed
+30 -26

No files matched your search

+4 -3
View File
@@ -64,13 +64,14 @@ uev_ctx_t *ctx = NULL; /* Main loop context */
static void banner(void)
{
char buf[42] = INIT_HEADING;
const char separator[] = "========================================================================";
char *buf = INIT_HEADING;
char separator[SCREEN_WIDTH];
if (log_is_silent())
return;
fprintf(stderr, "\e[2K\e[1m%s %.*s\e[0m\n", buf, 66 - (int)strlen(buf), separator);
memset(separator, '=', sizeof(separator));
fprintf(stderr, "\e[2K\e[1m%s %.*s\e[0m\n", buf, SCREEN_WIDTH - (int)strlen(buf) - 2, separator);
}
/* Requires /proc to be mounted */