It seems that I forgot to check the other programs and update them to work with the new delimit handling behavior in the appropriate FSS processing functions.
}
else if (F_status_is_error_not(*status)) {
f_string_range_t range = f_macro_string_range_t_initialize(buffer.used);
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
- *status = fll_fss_extended_read(&buffer, &range, &objects, &contents, 0, 0);
+ *status = fll_fss_extended_read(&buffer, &range, &objects, &contents, 0, 0, &delimits);
if (F_status_is_error(*status)) {
fake_print_error_fss(data, F_status_set_fine(*status), "fll_fss_extended_read", data.file_data_build_settings.string, range, F_true);
}
else {
- fake_build_load_setting_process(data, setting_file.used ? path_file : data.file_data_build_settings.string, buffer, objects, contents, setting, status);
+ *status = fl_fss_apply_delimit(delimits, &buffer);
+
+ if (F_status_is_error(*status)) {
+ fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true);
+ }
+ else {
+ fake_build_load_setting_process(data, setting_file.used ? path_file : data.file_data_build_settings.string, buffer, objects, contents, setting, status);
+ }
}
+
+ f_macro_fss_delimits_t_delete_simple(delimits);
}
f_macro_string_dynamic_t_delete_simple(buffer);
{
f_string_range_t range = f_macro_string_range_t_initialize(data_make->buffer.used);
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
- *status = fll_fss_basic_list_read(&data_make->buffer, &range, &list_objects, &list_contents);
+ *status = fll_fss_basic_list_read(&data_make->buffer, &range, &list_objects, &list_contents, &delimits);
if (F_status_is_error(*status)) {
fake_print_error_fss(data, *status, "fll_fss_basic_list_read", data.file_data_build_fakefile.string, range, F_true);
+ f_macro_fss_delimits_t_delete_simple(delimits);
+ f_macro_fss_objects_t_delete_simple(list_objects);
+ f_macro_fss_contents_t_delete_simple(list_contents);
+ return;
+ }
+
+ *status = fl_fss_apply_delimit(delimits, &data_make->buffer);
+
+ if (F_status_is_error(*status)) {
+ fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true);
+
+ f_macro_fss_delimits_t_delete_simple(delimits);
f_macro_fss_objects_t_delete_simple(list_objects);
f_macro_fss_contents_t_delete_simple(list_contents);
return;
{
f_string_range_t content_range = f_string_range_t_initialize;
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
for (f_array_length_t i = 0; i < list_objects.used; i++) {
}
if (fl_string_dynamic_partial_compare(name_settings, data_make->buffer, name_settings_range, list_objects.array[i]) == F_equal_to) {
+
if (!missing_settings) {
fake_print_warning_settings_object_multiple(data, data.file_data_build_fakefile.string, "list", name_settings.string);
continue;
}
+ delimits.used = 0;
content_range = list_contents.array[i].array[0];
- *status = fll_fss_extended_read(&data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0);
+ *status = fll_fss_extended_read(&data_make->buffer, &content_range, &settings.objects, &settings.contents, 0, 0, &delimits);
if (F_status_is_error(*status)) {
fake_print_error_fss(data, F_status_set_fine(*status), "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true);
+ break;
+ }
+
+ *status = fl_fss_apply_delimit(delimits, &data_make->buffer);
+ if (F_status_is_error(*status)) {
+ fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true);
break;
}
data_make->fakefile.array[data_make->fakefile.used].name = list_objects.array[i];
+ delimits.used = 0;
content_range = list_contents.array[i].array[0];
- *status = fll_fss_extended_read(&data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess);
+ *status = fll_fss_extended_read(&data_make->buffer, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess, &delimits);
if (F_status_is_error(*status)) {
fake_print_error_fss(data, F_status_set_fine(*status), "fll_fss_extended_read", data.file_data_build_fakefile.string, content_range, F_true);
+ break;
+ }
+
+ *status = fl_fss_apply_delimit(delimits, &data_make->buffer);
+ if (F_status_is_error(*status)) {
+ fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true);
break;
}
data_make->fakefile.used++;
} // for
+
+ f_macro_fss_delimits_t_delete_simple(delimits);
}
f_macro_fss_objects_t_delete_simple(list_objects);
status = F_status_set_error(status);
}
else {
- {
- f_string_range_t input = f_string_range_t_initialize;
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
- input.stop = local_buffer.used - 1;
+ {
+ f_string_range_t input = f_macro_string_range_t_initialize(local_buffer.used);
- status = fll_fss_basic_read(&local_buffer, &input, &basic_objects, &basic_contents, 0);
+ status = fll_fss_basic_read(&local_buffer, &input, &basic_objects, &basic_contents, 0, &delimits);
}
if (F_status_set_error(status)) {
status = F_status_set_error(status);
}
- else {
+
+ if (F_status_is_error_not(status)) {
+ status = fl_fss_apply_delimit(delimits, &local_buffer);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data.error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
+ }
+ }
+
+ if (F_status_is_error_not(status)) {
f_string_length_t buffer_counter = 0;
f_string_length_t ip_length = 0;
f_string_dynamic_t ip_list_action = f_string_dynamic_t_initialize;
arguments.used--;
}
}
+
+ f_macro_fss_delimits_t_delete_simple(delimits);
}
}
f_return_status firewall_buffer_rules(const f_string_t filename, const bool optional, firewall_local_data_t *local, firewall_data_t *data) {
f_file_t file = f_file_t_initialize;
- f_status_t status = F_none;
- status = f_file_open(filename, 0, &file);
+ f_status_t status = f_file_open(filename, 0, &file);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
return status;
}
- else {
- f_string_range_t input = f_string_range_t_initialize;
- input.stop = local->buffer.used - 1;
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
+
+ {
+ f_string_range_t input = f_macro_string_range_t_initialize(local->buffer.used);
- status = fll_fss_basic_list_read(&local->buffer, &input, &local->chain_objects, &local->chain_contents);
+ status = fll_fss_basic_list_read(&local->buffer, &input, &local->chain_objects, &local->chain_contents, &delimits);
}
if (F_status_is_error(status)) {
else {
fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, status, filename, f_string_eol[0]);
}
+ }
+ else {
+ status = fl_fss_apply_delimit(delimits, &local->buffer);
- return status;
+ if (F_status_is_error(status)) {
+ fll_error_print(data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
+ }
}
+ f_macro_fss_delimits_t_delete_simple(delimits);
+
return status;
}
f_return_status firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_data_t *data) {
- f_status_t status = F_none;
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
+
+ f_status_t status = fll_fss_extended_read(&local->buffer, range, &local->rule_objects, &local->rule_contents, 0, 0, &delimits);
+
+ if (F_status_is_error_not(status)) {
+ status = fl_fss_apply_delimit(delimits, &local->buffer);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(data->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
+ }
+ }
- status = fll_fss_extended_read(&local->buffer, range, &local->rule_objects, &local->rule_contents, 0, 0);
+ f_macro_fss_delimits_t_delete_simple(delimits);
if (F_status_is_error_not(status)) {
status = firewall_perform_commands(*local, *data);
f_status_t status = F_none;
{
- f_string_range_t input = f_string_range_t_initialize;
-
- input.start = 0;
- input.stop = data->buffer.used - 1;
+ f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used);
delimits->used = 0;
f_status_t status = F_none;
{
- f_string_range_t input = f_string_range_t_initialize;
-
- input.start = 0;
- input.stop = data->buffer.used - 1;
+ f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used);
delimits->used = 0;
f_status_t status = F_none;
{
- f_string_range_t input = f_string_range_t_initialize;
-
- input.start = 0;
- input.stop = data->buffer.used - 1;
+ f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used);
delimits->used = 0;
f_status_t status = F_none;
{
- f_string_range_t input = f_string_range_t_initialize;
-
- input.start = 0;
- input.stop = data->buffer.used - 1;
+ f_string_range_t input = f_macro_string_range_t_initialize(data->buffer.used);
delimits->used = 0;
}
return F_status_set_error(status);
- } else {
- f_string_range_t input = f_string_range_t_initialize;
+ }
+
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
- input.stop = buffer->used - 1;
+ {
+ f_string_range_t input = f_macro_string_range_t_initialize(buffer->used);
- status = fll_fss_basic_list_read(buffer, &input, objects, contents);
+ status = fll_fss_basic_list_read(buffer, &input, objects, contents, &delimits);
}
if (F_status_is_error(status)) {
fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, status, filename, f_string_eol[0]);
}
+ f_macro_fss_delimits_t_delete_simple(delimits);
+
return F_status_set_error(status);
}
+ else {
+ *status = fl_fss_apply_delimit(delimits, &buffer);
+
+ if (F_status_is_error(*status)) {
+ fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true);
+ }
+ }
+
+ f_macro_fss_delimits_t_delete_simple(delimits);
return status;
}
#ifndef _di_init_rules_process_main_
f_return_status init_rules_process_main(const init_data_t data, const f_string_t filename, f_string_dynamic_t *buffer, f_fss_objects_t *objects, f_fss_contents_t *contents) {
f_status_t status = F_none;
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
// @todo: resume replacing code below.
- status = fll_fss_extended_read(&buffer, input, &local->rule_objects, &local->rule_contents, 0, 0);
+ status = fll_fss_extended_read(&buffer, input, &local->rule_objects, &local->rule_contents, 0, 0, &delimits);
+
+ if (F_status_is_error_not(*status)) {
+ status = fl_fss_apply_delimit(delimits, &buffer);
+ }
+
+ f_macro_fss_delimits_t_delete_simple(delimits);
if (F_status_is_error_not(status)) {
//status = init_perform_commands(*local, *data); // @fixme
if (F_status_is_error(status)) {
- status = F_status_set_fine(status);
-
- if (status == F_memory_allocation || status == F_memory_reallocation) {
+ if (F_status_set_fine(status) == F_memory_allocation || F_status_set_fine(status) == F_memory_reallocation) {
fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.", fll_error_print_error);
- } else if (status == F_failure) {
+ } else if (F_status_set_fine(status) == F_failure) {
// the error message has already been displayed.
} else {
fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling firewall_perform_commands().", fll_error_print_error, status);
}
-
- f_macro_fss_objects_t_delete_simple(local->rule_objects);
- f_macro_fss_contents_t_delete_simple(local->rule_contents);
- return F_status_set_error(status);
}
}
f_fss_objects_t objects = f_fss_objects_t_initialize;
f_fss_contents_t contents = f_fss_contents_t_initialize;
f_string_length_t position = 0;
+ f_fss_delimits_t delimits = f_fss_delimits_t_initialize;
// load the main file into memory.
status = init_rule_buffer(&data, init_rule_core_file, &buffer, &objects, &contents);
f_macro_string_dynamic_t_delete(buffer);
f_macro_fss_objects_t_delete(objects);
f_macro_fss_contents_t_delete(contents);
+ f_macro_fss_delimits_t_delete_simple(delimits);
return status;
}
while (position < objects.used) {
location.start = objects.array[position].start;
location.stop = objects.array[position].stop;
+ delimits.used = 0;
- status = fll_fss_extended_read(&buffer, &location, &objects, &contents, 0, 0);
+ status = fll_fss_extended_read(&buffer, &location, &objects, &contents, 0, 0, &delimits);
+
+ if (F_status_is_error_not(*status)) {
+ status = fl_fss_apply_delimit(delimits, &buffer);
+ }
position++;
} // while
// @fixme: resume here, below is just notes and copy&pasted code as examples/reminders.
/*
- status = fll_fss_extended_read(&buffer, &location, &objects, &contents, 0, 0);
+ delimits.used = 0;
+
+ status = fll_fss_extended_read(&buffer, &location, &objects, &contents, 0, 0, &delimits);
+
+ if (F_status_is_error_not(status)) {
+ status = fl_fss_apply_delimit(delimits, &buffer);
+ }
if (F_status_is_error(status_process)) {
if (status == F_memory_allocation || status == F_memory_reallocation) {
// @todo: init_delete_data((*data));
// @todo: init_delete_stack_memory(&stack_memory);
+ f_macro_fss_delimits_t_delete_simple(delimits);
+
return status_process;
}
*/
/*
f_status_t status = F_none;
+ delimits.used = 0;
- status = fll_fss_extended_read(buffer, location, objects, contents, 0, 0);
+ status = fll_fss_extended_read(buffer, location, objects, contents, 0, 0, &delimits);
+
+ if (F_status_is_error_not(status)) {
+ status = fl_fss_apply_delimit(delimits, &buffer);
+ }
+
+ if (F_status_is_error(*status)) {
+ fll_error_print(data.error, F_status_set_fine(*status), "fl_fss_apply_delimit", F_true);
+ }
if (F_status_is_error_not(status)) {
// @todo: process objects and contents.
f_macro_fss_objects_t_delete_simple((*rule_objects));
f_macro_fss_contents_t_delete_simple((*rule_contents));
+ f_macro_fss_delimits_t_delete_simple(delimits);
return F_status_set_error(status);
}
}
f_macro_fss_contents_t_delete_simple((*rule_contents));
*/
/*
+ f_macro_fss_delimits_t_delete_simple(delimits);
f_macro_string_dynamic_t_delete(buffer);
f_macro_fss_objects_t_delete(objects);
f_macro_fss_contents_t_delete(contents);