From ce06c2588720f0dd9872bd28ec6ccf51008fcd98 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 11 Mar 2023 11:19:51 -0600 Subject: [PATCH] Bugfix: The control readonly option is not being loaded. 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 | 1 + level_3/controller/c/common/private-common.h | 3 ++ level_3/controller/c/entry/private-entry.c | 44 +++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/level_3/controller/c/common/private-common.c b/level_3/controller/c/common/private-common.c index 4dbc564..9e4cfd5 100644 --- a/level_3/controller/c/common/private-common.c +++ b/level_3/controller/c/common/private-common.c @@ -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); diff --git a/level_3/controller/c/common/private-common.h b/level_3/controller/c/common/private-common.h index a70bb9e..835807c 100644 --- a/level_3/controller/c/common/private-common.h +++ b/level_3/controller/c/common/private-common.h @@ -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; diff --git a/level_3/controller/c/entry/private-entry.c b/level_3/controller/c/entry/private-entry.c index 110c1d9..e687a2c 100644 --- a/level_3/controller/c/entry/private-entry.c +++ b/level_3/controller/c/entry/private-entry.c @@ -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); } -- 1.8.3.1