From: Kevin Day Date: Sun, 27 Sep 2020 02:06:22 +0000 (-0500) Subject: Bugfix: fss read programs should return 0 on invalid/empty files when --total is... X-Git-Tag: 0.5.1~53 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=54b0a604ddc171e32c7742d16a28a96a4a943c55;p=fll Bugfix: fss read programs should return 0 on invalid/empty files when --total is passed. --- diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index c067b83..8eab6b8 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -372,6 +372,10 @@ extern "C" { // Skip past empty files. if (!data->quantity.total) { + if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + } + f_file_stream_close(F_true, &file); continue; } diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index e8f4f1d..fcc333d 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -217,6 +217,11 @@ extern "C" { return F_status_set_error(status); } else if (status == F_data_not_stop || status == F_data_not_eos) { + if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + return F_none; + } + // Clear buffers, then attempt the next file. f_macro_fss_contents_t_delete_simple(data->contents); f_macro_fss_objects_t_delete_simple(data->objects); diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 8eb01bf..ba092b1 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -372,6 +372,10 @@ extern "C" { // Skip past empty files. if (!data->quantity.total) { + if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + } + f_file_stream_close(F_true, &file); continue; } diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index 10292f6..bdcb72f 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -217,6 +217,10 @@ extern "C" { return F_status_set_error(status); } else if (status == F_data_not_stop || status == F_data_not_eos) { + if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + return F_none; + } // Clear buffers, then attempt the next file. f_macro_fss_contents_t_delete_simple(data->contents); diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index ae48f28..9916293 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -356,6 +356,10 @@ extern "C" { // Skip past empty files. if (!data->quantity.total) { + if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + } + f_file_stream_close(F_true, &file); continue; } diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 13254ae..29455b6 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -217,6 +217,11 @@ extern "C" { return F_status_set_error(status); } else if (status == F_data_not_stop || status == F_data_not_eos) { + if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + return F_none; + } + // Clear buffers, then attempt the next file. f_macro_fss_nest_t_delete_simple(data->nest); f_macro_string_dynamic_t_delete_simple(data->buffer); diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 5283a59..8354d77 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -373,6 +373,10 @@ extern "C" { // Skip past empty files. if (!data->quantity.total) { + if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + } + f_file_stream_close(F_true, &file); continue; } 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 621ba89..294ec9a 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 @@ -217,6 +217,10 @@ extern "C" { return F_status_set_error(status); } else if (status == F_data_not_stop || status == F_data_not_eos) { + if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { + fprintf(f_type_output, "0%c", f_string_eol[0]); + return F_none; + } // Clear buffers, then attempt the next file. f_macro_fss_contents_t_delete_simple(data->contents);