From 02ecc64c52ce67a8296cafbc8a0ee13d991c8759 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 15 May 2022 19:25:15 -0500 Subject: [PATCH] Bugfix: The iki_read program is not handling verbosity correctly. The newline should be printed at the end of the program unless in quiet mode. This fails for two reasons: 1) The conditional checks before printing are wrong. 2) The quiet parameter is at the wrong position resulting in it being mixed up with the "no color" parameter. --- level_3/iki_read/c/common.h | 2 +- level_3/iki_read/c/iki_read.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/level_3/iki_read/c/common.h b/level_3/iki_read/c/common.h index 6a01ff5..0a9a561 100644 --- a/level_3/iki_read/c/common.h +++ b/level_3/iki_read/c/common.h @@ -178,8 +178,8 @@ extern "C" { macro_f_console_parameter_t_initialize(f_console_standard_short_help_s.string, f_console_standard_long_help_s.string, 0, 0, f_console_type_normal_e), \ macro_f_console_parameter_t_initialize(f_console_standard_short_light_s.string, f_console_standard_long_light_s.string, 0, 0, f_console_type_inverse_e), \ macro_f_console_parameter_t_initialize(f_console_standard_short_dark_s.string, f_console_standard_long_dark_s.string, 0, 0, f_console_type_inverse_e), \ - macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ macro_f_console_parameter_t_initialize(f_console_standard_short_no_color_s.string, f_console_standard_long_no_color_s.string, 0, 0, f_console_type_inverse_e), \ + macro_f_console_parameter_t_initialize(f_console_standard_short_quiet_s.string, f_console_standard_long_quiet_s.string, 0, 0, f_console_type_inverse_e), \ macro_f_console_parameter_t_initialize(f_console_standard_short_normal_s.string, f_console_standard_long_normal_s.string, 0, 0, f_console_type_inverse_e), \ macro_f_console_parameter_t_initialize(f_console_standard_short_verbose_s.string, f_console_standard_long_verbose_s.string, 0, 0, f_console_type_inverse_e), \ macro_f_console_parameter_t_initialize(f_console_standard_short_debug_s.string, f_console_standard_long_debug_s.string, 0, 0, f_console_type_inverse_e), \ diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index 1b2d754..81b84fd 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -533,14 +533,12 @@ extern "C" { } // Ensure a new line is always put at the end of the program execution, unless in quiet mode. - if (main->error.verbosity != f_console_verbosity_quiet_e) { - if (F_status_is_error(status) || !data.mode) { - if (F_status_set_fine(status) == F_interrupt) { - fflush(main->output.to.stream); - } - - fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream); + if (main->output.verbosity != f_console_verbosity_quiet_e) { + if (F_status_set_fine(status) == F_interrupt) { + fflush(main->output.to.stream); } + + fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream); } iki_read_data_delete(&data); -- 1.8.3.1