]> 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 e8bf18f562e1927d4ce4ddb4a24c97f7a84873f0..e808384bc9f66197c9b6155bd8eb52a677b261ce 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 0cd0b7f4fe05c70e303da36e220b4e39e1245e01..2097bc6d756e6b9e192859b03404e6779e3c611d 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 c8225632888deccd79d674d15e421a03a03b5e07..b102c6ecb9737eab5fa3678494cd24e2fb13fe05 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 1ce19ee6603a3402f2563bce37d09efd5cbb808d..3bbba0808ee635555dadabc57cd62437de995faf 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 dfba760d053c4975078b6a7646532198199bb709..c8f984afc169a92cc8c886bd32007746f22a5ee9 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 c3986adad5974d214b4746b64f2cad7f4e6155f6..20d3cbc7f7afe3297798f3be48d083c693ffb865 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 c7e4c8ffd182e3b69e2141ef79bfcc55d45ba4bf..6443363dbe018449547b19dbc5087e549a063419 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);