]> Kevux Git Server - fll/commitdiff
Update: Add F_file_empty_not to status codes.
authorKevin Day <Kevin@kevux.org>
Mon, 17 Jun 2024 04:11:41 +0000 (23:11 -0500)
committerKevin Day <Kevin@kevux.org>
Mon, 17 Jun 2024 04:11:41 +0000 (23:11 -0500)
level_0/f_status/c/status.h
level_0/f_status_string/c/status_string.c
level_0/f_status_string/c/status_string.h
level_0/f_status_string/tests/unit/c/test-status_string-to.c
level_1/fl_status_string/c/status_string.c
level_1/fl_status_string/tests/unit/c/test-status_string-from.c
level_2/fll_error/c/error.c

index e8bf18f..e808384 100644 (file)
@@ -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,
index 0cd0b7f..2097bc6 100644 (file)
@@ -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;
 
index c822563..b102c6e 100644 (file)
@@ -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;
index 1ce19ee..3bbba08 100644 (file)
@@ -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;
 
index dfba760..c8f984a 100644 (file)
@@ -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;
 
index c3986ad..20d3cbc 100644 (file)
@@ -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,
index c7e4c8f..6443363 100644 (file)
@@ -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);