]> Kevux Git Server - fll/commitdiff
Bugfix: The control readonly option is not being loaded.
authorKevin Day <kevin@kevux.org>
Sat, 11 Mar 2023 17:19:51 +0000 (11:19 -0600)
committerKevin Day <kevin@kevux.org>
Sat, 11 Mar 2023 17:19:51 +0000 (11:19 -0600)
I implemented the numeration and processing logic but I somehow forgot to actually load the setting from the entry file.

Set and unset the flag as requested.
Make sure the path_control is reset before appending the string.

Add control_has in validation test mode to better display the file.

level_3/controller/c/common/private-common.c
level_3/controller/c/common/private-common.h
level_3/controller/c/entry/private-entry.c

index 4dbc5645380a8c414634c17038729c59edd08f2b..9e4cfd50d18f58d742abd040705e5c269123205a 100644 (file)
@@ -20,6 +20,7 @@ extern "C" {
   const f_string_static_t controller_consider_s = macro_f_string_static_t_initialize(CONTROLLER_consider_s, 0, CONTROLLER_consider_s_length);
   const f_string_static_t controller_control_s = macro_f_string_static_t_initialize(CONTROLLER_control_s, 0, CONTROLLER_control_s_length);
   const f_string_static_t controller_control_group_s = macro_f_string_static_t_initialize(CONTROLLER_control_group_s, 0, CONTROLLER_control_group_s_length);
+  const f_string_static_t controller_control_has_s = macro_f_string_static_t_initialize(CONTROLLER_control_has_s, 0, CONTROLLER_control_has_s_length);
   const f_string_static_t controller_control_mode_s = macro_f_string_static_t_initialize(CONTROLLER_control_mode_s, 0, CONTROLLER_control_mode_s_length);
   const f_string_static_t controller_control_user_s = macro_f_string_static_t_initialize(CONTROLLER_control_user_s, 0, CONTROLLER_control_user_s_length);
   const f_string_static_t controller_controller_s = macro_f_string_static_t_initialize(CONTROLLER_controller_s, 0, CONTROLLER_controller_s_length);
index a70bb9e1be7ca19a934b50a1d5655cd160d4b183..835807cd890d0340a1d18d6b912ce93095935859 100644 (file)
@@ -44,6 +44,7 @@ extern "C" {
   #define CONTROLLER_consider_s      "consider"
   #define CONTROLLER_control_s       "control"
   #define CONTROLLER_control_group_s "control_group"
+  #define CONTROLLER_control_has_s   "control_has"
   #define CONTROLLER_control_mode_s  "control_mode"
   #define CONTROLLER_control_user_s  "control_user"
   #define CONTROLLER_controller_s    "controller"
@@ -180,6 +181,7 @@ extern "C" {
   #define CONTROLLER_consider_s_length      8
   #define CONTROLLER_control_s_length       7
   #define CONTROLLER_control_group_s_length 13
+  #define CONTROLLER_control_has_s_length   11
   #define CONTROLLER_control_mode_s_length  12
   #define CONTROLLER_control_user_s_length  12
   #define CONTROLLER_controller_s_length    10
@@ -316,6 +318,7 @@ extern "C" {
   extern const f_string_static_t controller_consider_s;
   extern const f_string_static_t controller_control_s;
   extern const f_string_static_t controller_control_group_s;
+  extern const f_string_static_t controller_control_has_s;
   extern const f_string_static_t controller_control_mode_s;
   extern const f_string_static_t controller_control_user_s;
   extern const f_string_static_t controller_controller_s;
index 110c1d911555036a8a20bb9e5fdfc678eed8ce8f..e687a2c3db86aa1b9ebce5a1a8c432308322a246 100644 (file)
@@ -1939,12 +1939,42 @@ extern "C" {
       }
 
       if (is_entry && fl_string_dynamic_compare(controller_control_s, cache->action.name_action) == F_equal_to) {
-        if (cache->content_actions.array[i].used != 1) {
-          controller_entry_settings_read_print_setting_requires_exactly(global, is_entry, *cache, 1);
+        if (cache->content_actions.array[i].used < 1 || cache->content_actions.array[i].used > 2) {
+          controller_entry_settings_read_print_setting_requires_between(global, is_entry, *cache, 1, 2);
 
           continue;
         }
 
+        if (cache->content_actions.array[i].used == 2) {
+          if (fl_string_dynamic_partial_compare_string(controller_readonly_s.string, cache->buffer_file, controller_readonly_s.used, cache->content_actions.array[i].array[1]) == F_equal_to) {
+            global.setting->control.flag |= controller_control_flag_readonly_e;
+          }
+          else {
+            if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+              controller_lock_print(global.main->error.to, global.thread);
+
+              fl_print_format("%r%[%QThe %r item setting '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
+              fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, controller_control_s, global.main->error.notable);
+              fl_print_format("%[' does not support the option '%]", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s);
+
+              fl_print_format("%[%/Q%]", global.main->error.to.stream, global.main->error.notable, cache->buffer_file, cache->content_actions.array[i].array[1], global.main->error.notable);
+
+              fl_print_format("%['.%]%r", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s);
+
+              controller_entry_print_error_cache(is_entry, global.main->error, cache->action);
+
+              controller_unlock_print_flush(global.main->error.to, global.thread);
+            }
+
+            continue;
+          }
+        }
+        else {
+          if (global.setting->control.flag & controller_control_flag_readonly_e) {
+            global.setting->control.flag -= controller_control_flag_readonly_e;
+          }
+        }
+
         cache->action.generic.used = 0;
         global.setting->path_control.used = 0;
 
@@ -1956,13 +1986,13 @@ extern "C" {
           break;
         }
 
+        global.setting->path_control.used = 0;
+
         status = controller_path_canonical_relative(global.setting, cache->action.generic, &global.setting->path_control);
 
         if (F_status_is_error(status)) {
           controller_entry_print_error_file(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_path_canonical_relative", F_true, cache->action.generic, f_file_operation_analyze_s, fll_error_file_type_path_e, global.thread);
 
-          global.setting->path_control.used = 0;
-
           continue;
         }
       }
@@ -2442,6 +2472,12 @@ extern "C" {
       fl_print_format(" %Q", global.main->output.to.stream, global.setting->path_control);
     }
 
+    fl_print_format("%r", global.main->output.to.stream, f_string_eol_s);
+
+
+    // Control Has.
+    fl_print_format("  %[%r%]", global.main->output.to.stream, global.main->context.set.important, controller_control_has_s, global.main->context.set.important);
+
     if (global.setting->control.flag & controller_control_flag_readonly_e) {
       fl_print_format(" %r", global.main->output.to.stream, controller_readonly_s);
     }