From: Kevin Day Date: Mon, 17 Jun 2024 04:11:41 +0000 (-0500) Subject: Update: Add F_file_empty_not to status codes. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=5ce405d088359ab4e7de36f5ec866178895a4c01;p=fll Update: Add F_file_empty_not to status codes. --- diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index e8bf18f..e808384 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -691,6 +691,7 @@ extern "C" { F_file_descriptor_max, F_file_descriptor_not, F_file_empty, + F_file_empty_not, F_file_flush, F_file_found, F_file_found_not, diff --git a/level_0/f_status_string/c/status_string.c b/level_0/f_status_string/c/status_string.c index 0cd0b7f..2097bc6 100644 --- a/level_0/f_status_string/c/status_string.c +++ b/level_0/f_status_string/c/status_string.c @@ -566,6 +566,7 @@ extern "C" { const f_string_static_t f_status_file_descriptor_max_s = macro_f_string_static_t_initialize_1(F_status_file_descriptor_max_s, 0, F_status_file_descriptor_max_s_length); const f_string_static_t f_status_file_descriptor_not_s = macro_f_string_static_t_initialize_1(F_status_file_descriptor_not_s, 0, F_status_file_descriptor_not_s_length); const f_string_static_t f_status_file_empty_s = macro_f_string_static_t_initialize_1(F_status_file_empty_s, 0, F_status_file_empty_s_length); + const f_string_static_t f_status_file_empty_not_s = macro_f_string_static_t_initialize_1(F_status_file_empty_not_s, 0, F_status_file_empty_not_s_length); const f_string_static_t f_status_file_flush_s = macro_f_string_static_t_initialize_1(F_status_file_flush_s, 0, F_status_file_flush_s_length); const f_string_static_t f_status_file_found_s = macro_f_string_static_t_initialize_1(F_status_file_found_s, 0, F_status_file_found_s_length); const f_string_static_t f_status_file_found_not_s = macro_f_string_static_t_initialize_1(F_status_file_found_not_s, 0, F_status_file_found_not_s_length); @@ -3366,6 +3367,11 @@ extern "C" { break; + case F_file_empty_not: + *name = f_status_file_empty_not_s; + + break; + case F_file_flush: *name = f_status_file_flush_s; diff --git a/level_0/f_status_string/c/status_string.h b/level_0/f_status_string/c/status_string.h index c822563..b102c6e 100644 --- a/level_0/f_status_string/c/status_string.h +++ b/level_0/f_status_string/c/status_string.h @@ -1663,6 +1663,7 @@ extern "C" { #define F_status_file_descriptor_max_s "F_file_descriptor_max" #define F_status_file_descriptor_not_s "F_file_descriptor_not" #define F_status_file_empty_s "F_file_empty" + #define F_status_file_empty_not_s "F_file_empty_not" #define F_status_file_flush_s "F_file_flush" #define F_status_file_found_s "F_file_found" #define F_status_file_found_not_s "F_file_found_not" @@ -1707,6 +1708,7 @@ extern "C" { #define F_status_file_descriptor_max_s_length 21 #define F_status_file_descriptor_not_s_length 21 #define F_status_file_empty_s_length 12 + #define F_status_file_empty_not_s_length 16 #define F_status_file_flush_s_length 12 #define F_status_file_found_s_length 12 #define F_status_file_found_not_s_length 16 @@ -1751,6 +1753,7 @@ extern "C" { extern const f_string_static_t f_status_file_descriptor_max_s; extern const f_string_static_t f_status_file_descriptor_not_s; extern const f_string_static_t f_status_file_empty_s; + extern const f_string_static_t f_status_file_empty_not_s; extern const f_string_static_t f_status_file_flush_s; extern const f_string_static_t f_status_file_found_s; extern const f_string_static_t f_status_file_found_not_s; diff --git a/level_0/f_status_string/tests/unit/c/test-status_string-to.c b/level_0/f_status_string/tests/unit/c/test-status_string-to.c index 1ce19ee..3bbba08 100644 --- a/level_0/f_status_string/tests/unit/c/test-status_string-to.c +++ b/level_0/f_status_string/tests/unit/c/test-status_string-to.c @@ -563,6 +563,7 @@ void test__f_status_string_to__works(void **state) { F_file_descriptor_max, F_file_descriptor_not, F_file_empty, + F_file_empty_not, F_file_flush, F_file_found, F_file_found_not, @@ -1201,6 +1202,7 @@ void test__f_status_string_to__works(void **state) { f_status_file_descriptor_max_s, f_status_file_descriptor_not_s, f_status_file_empty_s, + f_status_file_empty_not_s, f_status_file_flush_s, f_status_file_found_s, f_status_file_found_not_s, @@ -1305,7 +1307,7 @@ void test__f_status_string_to__works(void **state) { f_status_status_code_last_s, }; - for (uint16_t i = 0; i < 635; ++i) { + for (uint16_t i = 0; i < 636; ++i) { f_string_static_t result = f_string_static_t_initialize; diff --git a/level_1/fl_status_string/c/status_string.c b/level_1/fl_status_string/c/status_string.c index dfba760..c8f984a 100644 --- a/level_1/fl_status_string/c/status_string.c +++ b/level_1/fl_status_string/c/status_string.c @@ -3230,6 +3230,12 @@ extern "C" { return F_okay; } + if (f_compare_dynamic(name, f_status_file_empty_not_s) == F_equal_to) { + *code = F_file_empty_not; + + return F_okay; + } + if (f_compare_dynamic(name, f_status_file_flush_s) == F_equal_to) { *code = F_file_flush; diff --git a/level_1/fl_status_string/tests/unit/c/test-status_string-from.c b/level_1/fl_status_string/tests/unit/c/test-status_string-from.c index c3986ad..20d3cbc 100644 --- a/level_1/fl_status_string/tests/unit/c/test-status_string-from.c +++ b/level_1/fl_status_string/tests/unit/c/test-status_string-from.c @@ -579,6 +579,7 @@ void test__fl_status_string_from__works(void **state) { F_file_descriptor_max, F_file_descriptor_not, F_file_empty, + F_file_empty_not, F_file_flush, F_file_found, F_file_found_not, @@ -1217,6 +1218,7 @@ void test__fl_status_string_from__works(void **state) { f_status_file_descriptor_max_s, f_status_file_descriptor_not_s, f_status_file_empty_s, + f_status_file_empty_not_s, f_status_file_flush_s, f_status_file_found_s, f_status_file_found_not_s, diff --git a/level_2/fll_error/c/error.c b/level_2/fll_error/c/error.c index c7e4c8f..6443363 100644 --- a/level_2/fll_error/c/error.c +++ b/level_2/fll_error/c/error.c @@ -95,20 +95,6 @@ extern "C" { return F_false; } - if (status == F_directory_empty_not) { - if (print->verbosity != f_console_verbosity_quiet_e) { - flockfile(print->to.stream); - - fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); - fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable); - fl_print_format("%[', not empty.%]%r", print->to, print->context, print->context, f_string_eol_s); - - funlockfile(print->to.stream); - } - - return F_false; - } - if (status == F_error) { if (print->verbosity != f_console_verbosity_quiet_e) { flockfile(print->to.stream); @@ -207,7 +193,7 @@ extern "C" { return F_false; } - if (status == F_file_empty) { + if (status == F_directory_empty || status == F_file_empty) { if (print->verbosity != f_console_verbosity_quiet_e) { flockfile(print->to.stream); @@ -221,6 +207,20 @@ extern "C" { return F_false; } + if (status == F_directory_empty_not || status == F_file_empty_not) { + if (print->verbosity != f_console_verbosity_quiet_e) { + flockfile(print->to.stream); + + fl_print_format("%[%QUnable to %Q %Q '%]", print->to, print->context, print->prefix, operation, type_name, print->context); + fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable); + fl_print_format("%[', %Q is not empty.%]%r", print->to, print->context, type_name, print->context, f_string_eol_s); + + funlockfile(print->to.stream); + } + + return F_false; + } + if (status == F_file_flush) { if (print->verbosity != f_console_verbosity_quiet_e) { flockfile(print->to.stream);