From d3482d820c9c32766d1d2e51d7d00a52bf4658ce Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 16 Nov 2019 15:06:05 -0600 Subject: [PATCH] Update: only print newline when --empty is used and --select is 0 In all other cases with --empty and --select, such as --select 1, if that selection is empty do not print any newlines. Remove some impossible conditions. --- .../c/private-fss_extended_read.c | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index 08cd760..1536802 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -449,8 +449,6 @@ extern "C" { if (select < data->contents.array[i].used) { f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); - } else if (include_empty) { - fprintf(f_standard_output, "%c", f_string_eol); } } else { @@ -466,7 +464,14 @@ extern "C" { } } else if (include_empty) { - fprintf(f_standard_output, "%c", f_string_eol); + if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (select == 0) { + fprintf(f_standard_output, "%c", f_string_eol); + } + } + else { + fprintf(f_standard_output, "%c", f_string_eol); + } } } @@ -480,8 +485,6 @@ extern "C" { if (select < data->contents.array[i].used) { f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); - } else if (include_empty) { - fprintf(f_standard_output, "%c", f_string_eol); } } else { @@ -497,7 +500,14 @@ extern "C" { } } else if (include_empty) { - fprintf(f_standard_output, "%c", f_string_eol); + if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { + if (select == 0) { + fprintf(f_standard_output, "%c", f_string_eol); + } + } + else { + fprintf(f_standard_output, "%c", f_string_eol); + } } break; @@ -557,8 +567,6 @@ extern "C" { if (select < data->contents.array[i].used) { f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); - } else if (include_empty) { - fprintf(f_standard_output, "%c", f_string_eol); } } else { @@ -591,7 +599,7 @@ extern "C" { } if (data->contents.array[i].used == 0) { - if (include_empty) { + if (include_empty && select == 0) { fprintf(f_standard_output, "%c", f_string_eol); } @@ -602,8 +610,6 @@ extern "C" { if (select < data->contents.array[i].used) { f_print_string_dynamic_partial(f_standard_output, data->buffer, data->contents.array[i].array[select]); fprintf(f_standard_output, "%c", f_string_eol); - } else if (include_empty) { - fprintf(f_standard_output, "%c", f_string_eol); } } else { -- 1.8.3.1