degesch: print the logo in a buffer

This commit is contained in:
Přemysl Eric Janouch 2015-07-10 00:26:50 +02:00
parent 3e17bfb54c
commit 4ddded3512
1 changed files with 16 additions and 23 deletions

View File

@ -8841,28 +8841,22 @@ init_poller_events (struct app_context *ctx)
// --- Main program ------------------------------------------------------------ // --- Main program ------------------------------------------------------------
static void static const char *g_logo[] =
display_logo (void)
{ {
const char *logo = " __ __ ",
" __ __ \n" " __/ / ____ ____ ____ ____ ____ / /_ ",
" __/ / ____ ____ ____ ____ ____ / /_ \n" " / / / , / / / / , / / __/ / __/ / __ \\ ",
" / / / , / / / / , / / __/ / __/ / __ \\ \n" " / / / / __/ / / / / __/ /_ / / /_ / / / / ",
" / / / / __/ / / / / __/ /_ / / /_ / / / / \n" "/___/ /___/ /_ / /___/ /___/ /___/ /_/ /_/ " PROGRAM_VERSION,
" /___/ /___/ /_ / /___/ /___/ /___/ /_/ /_/ \n" " /___/ ",
" /___/ \n" ""
" "; };
struct str_vector v; static void
str_vector_init (&v); show_logo (struct app_context *ctx)
char *x = xstrdup_printf ("%s%s", {
logo, PROGRAM_NAME " " PROGRAM_VERSION " starting"); for (size_t i = 0; i < N_ELEMENTS (g_logo); i++)
split_str (x, '\n', &v); log_global_indent (ctx, "#m", g_logo[i]);
free (x);
for (size_t i = 0; i < v.len; i++)
print_status ("%s", v.vector[i]);
str_vector_free (&v);
} }
int int
@ -8901,9 +8895,7 @@ main (int argc, char *argv[])
opt_handler_usage (&oh, stderr); opt_handler_usage (&oh, stderr);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
opt_handler_free (&oh); opt_handler_free (&oh);
display_logo ();
// We only need to convert to and from the terminal encoding // We only need to convert to and from the terminal encoding
setlocale (LC_CTYPE, ""); setlocale (LC_CTYPE, "");
@ -8922,9 +8914,10 @@ main (int argc, char *argv[])
config_load (&ctx.config, config_item_object ()); config_load (&ctx.config, config_item_object ());
// The following part is a bit brittle because of interdependencies // The following part is a bit brittle because of interdependencies
setup_signal_handlers ();
init_colors (&ctx); init_colors (&ctx);
init_global_buffer (&ctx); init_global_buffer (&ctx);
show_logo (&ctx);
setup_signal_handlers ();
init_poller_events (&ctx); init_poller_events (&ctx);
load_configuration (&ctx); load_configuration (&ctx);