if (!main) return;
- main->setting.flag -= main->setting.flag & kt_remove_main_flag_option_used_d;
+ main->setting.flag &= ~kt_remove_main_flag_option_used_d;
main->setting.state.step_small = kt_remove_allocation_console_d;
for (uint8_t p = 0; p < 3; ++p) {
- // kt_remove_parameter_accessed_e, kt_remove_parameter_changed_e, kt_remove_parameter_updated_e, needs additional parameters, ==, <, <=, >, >=, <>.
- if (parameters[p]->result & f_console_result_found_e) {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, longs[p], 2);
-
- return;
- }
+ if (!(parameters[p]->result & f_console_result_found_e)) continue;
if (parameters[p]->result & f_console_result_value_e) {
total_locations = parameters[p]->locations.used;
}
main->setting.flag |= kt_remove_main_flag_option_used_d;
- } // for
- }
+ }
+ else {
+ main->setting.state.status = F_status_set_error(F_parameter);
+
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, longs[p], 2);
+
+ return;
+ }
+ } // for
}
- // kt_remove_parameter_group_e, needs additional parameters (group).
if (main->program.parameters.array[kt_remove_parameter_empty_e].result & f_console_result_found_e) {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_empty_s, 1);
+ if (main->program.parameters.array[kt_remove_parameter_empty_e].result & f_console_result_value_e) {
+ total_arguments = main->program.parameters.array[kt_remove_parameter_empty_e].values.used;
- return;
- }
+ if (main->program.parameters.array[kt_remove_parameter_empty_e].locations.used != total_arguments) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- if (main->program.parameters.array[kt_remove_parameter_empty_e].result & f_console_result_value_e) {
- total_arguments = main->program.parameters.array[kt_remove_parameter_empty_e].values.used;
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_empty_s, 1);
- if (main->program.parameters.array[kt_remove_parameter_empty_e].locations.used != total_arguments) {
- main->setting.state.status = F_status_set_error(F_parameter);
+ return;
+ }
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_empty_s, 1);
+ index = main->program.parameters.array[kt_remove_parameter_empty_e].values.array[total_arguments - 1];
- return;
- }
+ if (f_compare_dynamic(kt_remove_not_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_empty_not_d;
- index = main->program.parameters.array[kt_remove_parameter_empty_e].values.array[total_arguments - 1];
+ if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_not_fail_d;
+ }
- if (f_compare_dynamic(kt_remove_not_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_empty_not_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_only_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_only_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_fail_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_only_fail_d;
+ }
}
+ else if (f_compare_dynamic(kt_remove_not_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_empty_not_fail_d;
- if (main->setting.flag & kt_remove_main_flag_empty_only_d) {
- main->setting.flag -= kt_remove_main_flag_empty_only_d;
- }
+ if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_not_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
- main->setting.flag -= kt_remove_main_flag_empty_only_fail_d;
- }
- }
- else if (f_compare_dynamic(kt_remove_not_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_empty_not_fail_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_only_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_only_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_only_fail_d;
+ }
}
+ else if (f_compare_dynamic(kt_remove_only_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_empty_only_d;
- if (main->setting.flag & kt_remove_main_flag_empty_only_d) {
- main->setting.flag -= kt_remove_main_flag_empty_only_d;
- }
+ if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_not_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
- main->setting.flag -= kt_remove_main_flag_empty_only_fail_d;
- }
- }
- else if (f_compare_dynamic(kt_remove_only_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_empty_only_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_not_fail_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_only_fail_d;
+ }
}
+ else if (f_compare_dynamic(kt_remove_only_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_empty_only_fail_d;
- if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_fail_d;
- }
+ if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_not_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
- main->setting.flag -= kt_remove_main_flag_empty_only_fail_d;
- }
- }
- else if (f_compare_dynamic(kt_remove_only_fail_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_empty_only_fail_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_not_fail_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_d;
+ if (main->setting.flag & kt_remove_main_flag_empty_only_d) {
+ main->setting.flag -= kt_remove_main_flag_empty_only_d;
+ }
}
+ else {
+ main->setting.state.status = F_status_set_error(F_parameter);
- if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_fail_d;
- }
+ kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_empty_s, main->program.parameters.arguments.array[index]);
- if (main->setting.flag & kt_remove_main_flag_empty_only_d) {
- main->setting.flag -= kt_remove_main_flag_empty_only_d;
+ return;
}
+
+ main->setting.flag |= kt_remove_main_flag_option_used_d;
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
- kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_empty_s, main->program.parameters.arguments.array[index]);
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_empty_s, 1);
return;
}
-
- main->setting.flag |= kt_remove_main_flag_option_used_d;
}
- // kt_remove_parameter_group_e, needs additional parameters (gid).
if (main->program.parameters.array[kt_remove_parameter_group_e].result & f_console_result_found_e) {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_group_s, 1);
-
- return;
- }
-
- if (main->program.parameters.array[kt_remove_parameter_group_e].result & f_console_result_value_e) {
- total_arguments = main->program.parameters.array[kt_remove_parameter_group_e].values.used;
-
- if (main->program.parameters.array[kt_remove_parameter_group_e].locations.used != total_arguments) {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_group_s, 1);
-
- return;
- }
-
- main->setting.state.status = f_memory_array_increase_by(total_arguments, sizeof(uint32_t), (void **) &main->setting.groups.array, &main->setting.groups.used, &main->setting.groups.size);
+ if (main->program.parameters.array[kt_remove_parameter_group_e].result & f_console_result_value_e) {
+ total_arguments = main->program.parameters.array[kt_remove_parameter_group_e].values.used;
- if (F_status_is_error(main->setting.state.status)) {
- kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
-
- return;
- }
+ if (main->program.parameters.array[kt_remove_parameter_group_e].locations.used != total_arguments) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- for (i = 0; i < total_arguments; ++i) {
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_group_s, 1);
- index = main->program.parameters.array[kt_remove_parameter_group_e].values.array[i];
+ return;
+ }
- main->setting.groups.array[main->setting.groups.used] = kt_remove_get_id_group(main, main->program.parameters.arguments.array[index]);
+ main->setting.state.status = f_memory_array_increase_by(total_arguments, sizeof(uint32_t), (void **) &main->setting.groups.array, &main->setting.groups.used, &main->setting.groups.size);
if (F_status_is_error(main->setting.state.status)) {
- kt_remove_print_error(&main->program.error, macro_kt_remove_f(kt_remove_get_id_group));
+ kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
return;
}
- ++main->setting.groups.used;
- } // for
+ for (i = 0; i < total_arguments; ++i) {
- main->setting.flag |= kt_remove_main_flag_group_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
- }
+ index = main->program.parameters.array[kt_remove_parameter_group_e].values.array[i];
- // kt_remove_parameter_mode_e, needs additional parameters (modes, match parameters).
- if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_found_e) {
- main->setting.state.status = F_status_set_error(F_parameter);
+ main->setting.groups.array[main->setting.groups.used] = kt_remove_get_id_group(main, main->program.parameters.arguments.array[index]);
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_mode_s, 2);
+ if (F_status_is_error(main->setting.state.status)) {
+ kt_remove_print_error(&main->program.error, macro_kt_remove_f(kt_remove_get_id_group));
- return;
- }
+ return;
+ }
- if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_value_e) {
- total_locations = main->program.parameters.array[kt_remove_parameter_mode_e].locations.used;
- total_arguments = main->program.parameters.array[kt_remove_parameter_mode_e].values.used;
+ ++main->setting.groups.used;
+ } // for
- if (total_locations * 2 != total_arguments) {
+ main->setting.flag |= kt_remove_main_flag_group_d;
+ main->setting.flag |= kt_remove_main_flag_option_used_d;
+ }
+ else {
main->setting.state.status = F_status_set_error(F_parameter);
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_mode_s, 2);
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_group_s, 1);
return;
}
+ }
- if (main->setting.modes.used + total_locations > main->setting.modes.size) {
- main->setting.state.status = kt_remove_modes_resize(main->setting.modes.size + (total_locations - main->setting.modes.size), &main->setting.modes);
+ if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_found_e) {
+ if (main->program.parameters.array[kt_remove_parameter_mode_e].result & f_console_result_value_e) {
+ total_locations = main->program.parameters.array[kt_remove_parameter_mode_e].locations.used;
+ total_arguments = main->program.parameters.array[kt_remove_parameter_mode_e].values.used;
- if (F_status_is_error(main->setting.state.status)) {
- kt_remove_print_error(&main->program.error, macro_kt_remove_f(kt_remove_modes_resize));
+ if (total_locations * 2 != total_arguments) {
+ main->setting.state.status = F_status_set_error(F_parameter);
+
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_mode_s, 2);
return;
}
- }
- uint8_t enumerations[] = {
- kt_remove_flag_mode_different_d,
- kt_remove_flag_mode_same_d,
- kt_remove_flag_mode_similar_d,
- kt_remove_flag_mode_not_d,
- kt_remove_flag_mode_different_d,
- kt_remove_flag_mode_same_d,
- kt_remove_flag_mode_similar_d,
- kt_remove_flag_mode_not_d,
- };
+ if (main->setting.modes.used + total_locations > main->setting.modes.size) {
+ main->setting.state.status = kt_remove_modes_resize(main->setting.modes.size + (total_locations - main->setting.modes.size), &main->setting.modes);
- f_string_static_t strings[] = {
- kt_remove_mode_symbol_different_s,
- kt_remove_mode_symbol_same_s,
- kt_remove_mode_symbol_similar_s,
- kt_remove_mode_symbol_not_s,
- kt_remove_mode_word_different_s,
- kt_remove_mode_word_same_s,
- kt_remove_mode_word_similar_s,
- kt_remove_mode_word_not_s,
- };
+ if (F_status_is_error(main->setting.state.status)) {
+ kt_remove_print_error(&main->program.error, macro_kt_remove_f(kt_remove_modes_resize));
- for (i = 0; i < total_locations; i += 2) {
+ return;
+ }
+ }
- index = main->program.parameters.array[kt_remove_parameter_mode_e].values.array[i];
+ uint8_t enumerations[] = {
+ kt_remove_flag_mode_different_d,
+ kt_remove_flag_mode_same_d,
+ kt_remove_flag_mode_similar_d,
+ kt_remove_flag_mode_not_d,
+ kt_remove_flag_mode_different_d,
+ kt_remove_flag_mode_same_d,
+ kt_remove_flag_mode_similar_d,
+ kt_remove_flag_mode_not_d,
+ };
- main->setting.modes.array[main->setting.modes.used].type = 0;
+ f_string_static_t strings[] = {
+ kt_remove_mode_symbol_different_s,
+ kt_remove_mode_symbol_same_s,
+ kt_remove_mode_symbol_similar_s,
+ kt_remove_mode_symbol_not_s,
+ kt_remove_mode_word_different_s,
+ kt_remove_mode_word_same_s,
+ kt_remove_mode_word_similar_s,
+ kt_remove_mode_word_not_s,
+ };
- for (j = 0; j < 8; ++j) {
+ for (i = 0; i < total_locations; i += 2) {
- if (f_compare_dynamic(main->program.parameters.arguments.array[index], strings[j]) == F_equal_to) {
- main->setting.modes.array[main->setting.modes.used].type = enumerations[j];
+ index = main->program.parameters.array[kt_remove_parameter_mode_e].values.array[i];
- index2 = main->program.parameters.array[kt_remove_parameter_mode_e].values.array[i + 1];
+ main->setting.modes.array[main->setting.modes.used].type = 0;
- main->setting.modes.array[main->setting.modes.used].mode = kt_remove_get_mode(main, main->program.parameters.arguments.array[index2]);
- if (F_status_is_error(main->setting.state.status)) return;
+ for (j = 0; j < 8; ++j) {
- ++main->setting.modes.used;
+ if (f_compare_dynamic(main->program.parameters.arguments.array[index], strings[j]) == F_equal_to) {
+ main->setting.modes.array[main->setting.modes.used].type = enumerations[j];
- break;
- }
- } // for
+ index2 = main->program.parameters.array[kt_remove_parameter_mode_e].values.array[i + 1];
- if (j == 8) {
- main->setting.state.status = F_status_set_error(F_parameter);
-
- kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_mode_s, main->program.parameters.arguments.array[index]);
+ main->setting.modes.array[main->setting.modes.used].mode = kt_remove_get_mode(main, main->program.parameters.arguments.array[index2]);
+ if (F_status_is_error(main->setting.state.status)) return;
- return;
- }
- } // for
+ ++main->setting.modes.used;
- main->setting.flag |= kt_remove_main_flag_mode_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
- }
+ break;
+ }
+ } // for
- // kt_remove_parameter_user_e, needs additional parameters.
- if (main->program.parameters.array[kt_remove_parameter_user_e].result & f_console_result_found_e) {
- main->setting.state.status = F_status_set_error(F_parameter);
+ if (j == 8) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_user_s, 1);
+ kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_mode_s, main->program.parameters.arguments.array[index]);
- return;
- }
-
- if (main->program.parameters.array[kt_remove_parameter_user_e].result & f_console_result_value_e) {
- total_arguments = main->program.parameters.array[kt_remove_parameter_user_e].values.used;
+ return;
+ }
+ } // for
- if (main->program.parameters.array[kt_remove_parameter_user_e].locations.used != total_arguments) {
+ main->setting.flag |= kt_remove_main_flag_mode_d;
+ main->setting.flag |= kt_remove_main_flag_option_used_d;
+ }
+ else {
main->setting.state.status = F_status_set_error(F_parameter);
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_user_s, 1);
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_mode_s, 2);
return;
}
+ }
- main->setting.state.status = f_memory_array_increase_by(total_arguments, sizeof(uint32_t), (void **) &main->setting.users.array, &main->setting.users.used, &main->setting.users.size);
-
- if (F_status_is_error(main->setting.state.status)) {
- kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
+ if (main->program.parameters.array[kt_remove_parameter_user_e].result & f_console_result_found_e) {
+ if (main->program.parameters.array[kt_remove_parameter_user_e].result & f_console_result_value_e) {
+ total_arguments = main->program.parameters.array[kt_remove_parameter_user_e].values.used;
- return;
- }
+ if (main->program.parameters.array[kt_remove_parameter_user_e].locations.used != total_arguments) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- for (i = 0; i < total_arguments; ++i) {
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_user_s, 1);
- index = main->program.parameters.array[kt_remove_parameter_user_e].values.array[i];
+ return;
+ }
- main->setting.users.array[main->setting.users.used] = kt_remove_get_id_user(main, main->program.parameters.arguments.array[index]);
+ main->setting.state.status = f_memory_array_increase_by(total_arguments, sizeof(uint32_t), (void **) &main->setting.users.array, &main->setting.users.used, &main->setting.users.size);
if (F_status_is_error(main->setting.state.status)) {
- kt_remove_print_error(&main->program.error, macro_kt_remove_f(kt_remove_get_id_user));
+ kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
return;
}
- ++main->setting.users.used;
- } // for
+ for (i = 0; i < total_arguments; ++i) {
- main->setting.flag |= kt_remove_main_flag_user_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
- }
+ index = main->program.parameters.array[kt_remove_parameter_user_e].values.array[i];
- // kt_remove_parameter_prompt_e, needs additional parameters (all, follow, once).
- if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_found_e) {
- main->setting.state.status = F_status_set_error(F_parameter);
+ main->setting.users.array[main->setting.users.used] = kt_remove_get_id_user(main, main->program.parameters.arguments.array[index]);
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_prompt_s, 1);
+ if (F_status_is_error(main->setting.state.status)) {
+ kt_remove_print_error(&main->program.error, macro_kt_remove_f(kt_remove_get_id_user));
- return;
- }
+ return;
+ }
- if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_value_e) {
- total_arguments = main->program.parameters.array[kt_remove_parameter_prompt_e].values.used;
+ ++main->setting.users.used;
+ } // for
- if (main->program.parameters.array[kt_remove_parameter_prompt_e].locations.used != total_arguments) {
+ main->setting.flag |= kt_remove_main_flag_user_d;
+ main->setting.flag |= kt_remove_main_flag_option_used_d;
+ }
+ else {
main->setting.state.status = F_status_set_error(F_parameter);
- kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_prompt_s, 1);
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_user_s, 1);
return;
}
+ }
- index = main->program.parameters.array[kt_remove_parameter_prompt_e].values.array[total_arguments - 1];
+ if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_found_e) {
+ if (main->program.parameters.array[kt_remove_parameter_prompt_e].result & f_console_result_value_e) {
+ total_arguments = main->program.parameters.array[kt_remove_parameter_prompt_e].values.used;
- if (f_compare_dynamic(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_prompt_each_d;
+ if (main->program.parameters.array[kt_remove_parameter_prompt_e].locations.used != total_arguments) {
+ main->setting.state.status = F_status_set_error(F_parameter);
- if (main->setting.flag & kt_remove_main_flag_prompt_follow_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_follow_d;
- }
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_prompt_s, 1);
- if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_once_d;
+ return;
}
- if (main->setting.flag & kt_remove_main_flag_prompt_never_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_never_d;
- }
- }
- else if (f_compare_dynamic(kt_remove_follow_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_prompt_follow_d;
+ index = main->program.parameters.array[kt_remove_parameter_prompt_e].values.array[total_arguments - 1];
- if (main->setting.flag & kt_remove_main_flag_prompt_each_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_each_d;
- }
+ if (f_compare_dynamic(kt_remove_all_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_prompt_each_d;
- if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_once_d;
- }
+ if (main->setting.flag & kt_remove_main_flag_prompt_follow_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_follow_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_prompt_never_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_never_d;
- }
- }
- else if (f_compare_dynamic(kt_remove_once_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_prompt_once_d;
+ if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_once_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_prompt_each_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_each_d;
+ if (main->setting.flag & kt_remove_main_flag_prompt_never_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_never_d;
+ }
}
+ else if (f_compare_dynamic(kt_remove_follow_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_prompt_follow_d;
- if (main->setting.flag & kt_remove_main_flag_prompt_follow_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_follow_d;
- }
+ if (main->setting.flag & kt_remove_main_flag_prompt_each_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_each_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_prompt_never_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_never_d;
+ if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_once_d;
+ }
+
+ if (main->setting.flag & kt_remove_main_flag_prompt_never_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_never_d;
+ }
}
- }
- else if (f_compare_dynamic(kt_remove_never_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
- main->setting.flag |= kt_remove_main_flag_prompt_never_d;
+ else if (f_compare_dynamic(kt_remove_once_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_prompt_once_d;
+
+ if (main->setting.flag & kt_remove_main_flag_prompt_each_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_each_d;
+ }
+
+ if (main->setting.flag & kt_remove_main_flag_prompt_follow_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_follow_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_prompt_each_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_each_d;
+ if (main->setting.flag & kt_remove_main_flag_prompt_never_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_never_d;
+ }
}
+ else if (f_compare_dynamic(kt_remove_never_s, main->program.parameters.arguments.array[index]) == F_equal_to) {
+ main->setting.flag |= kt_remove_main_flag_prompt_never_d;
+
+ if (main->setting.flag & kt_remove_main_flag_prompt_each_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_each_d;
+ }
- if (main->setting.flag & kt_remove_main_flag_prompt_follow_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_follow_d;
+ if (main->setting.flag & kt_remove_main_flag_prompt_follow_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_follow_d;
+ }
+
+ if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
+ main->setting.flag -= kt_remove_main_flag_prompt_once_d;
+ }
}
+ else {
+ main->setting.state.status = F_status_set_error(F_parameter);
+
+ kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_prompt_s, main->program.parameters.arguments.array[index]);
- if (main->setting.flag & kt_remove_main_flag_prompt_once_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_once_d;
+ return;
}
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
- kt_remove_print_error_parameter_unknown_value(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_prompt_s, main->program.parameters.arguments.array[index]);
+ kt_remove_print_error_parameter_missing_value_requires_amount(&main->program.error, f_console_symbol_long_normal_s, kt_remove_long_prompt_s, 1);
return;
}
// Load all remaining files as static strings (setting size to 0).
if (main->program.parameters.remaining.used) {
- main->setting.state.status = f_memory_array_increase_by(main->program.parameters.remaining.used, sizeof(uint32_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size);
+ main->setting.state.status = f_memory_array_increase_by(main->program.parameters.remaining.used, sizeof(f_string_dynamic_t), (void **) &main->setting.files.array, &main->setting.files.used, &main->setting.files.size);
if (F_status_is_error(main->setting.state.status)) {
kt_remove_print_error(&main->program.error, macro_kt_remove_f(f_memory_array_increase_by));
#ifndef _di_kt_remove_operate_file_directory_
void kt_remove_operate_file_directory(kt_remove_main_t * const main, const f_string_static_t path, const uint8_t flag) {
- if (!(flag & kt_remove_flag_file_operate_remove_d)) {
- main->setting.state.status = F_no;
+ if (!(flag & kt_remove_flag_file_operate_remove_d) || flag & kt_remove_flag_file_operate_remove_not_fail_d) {
+ main->setting.state.status = (flag & kt_remove_flag_file_operate_remove_fail_d) ? F_status_set_error(F_no) : F_no;
return;
}
}
}
-
if (macro_f_file_type_is_directory(statistics.st_mode)) {
flag |= kt_remove_flag_file_operate_directory_d;
if (i < main->setting.modes.used) {
flag |= kt_remove_flag_file_operate_remove_d;
}
+ }
- if (main->setting.flag & kt_remove_main_flag_recurse_d) {
- flag |= kt_remove_flag_file_operate_recurse_d;
- }
+ if (flag & kt_remove_flag_file_operate_directory_d) {
+ flag |= kt_remove_flag_file_operate_recurse_d;
- if (main->setting.flag & kt_remove_main_flag_force_d) {
- flag |= kt_remove_flag_file_operate_remove_d;
- }
+ main->setting.state.status = f_directory_empty(path);
+ if (F_status_is_error(main->setting.state.status)) return flag;
- // Trigger the callback to make any modifications before simulating or performing the removal.
- if (main->setting.process_operate_file) {
- main->setting.state.status = F_okay;
+ if (main->setting.state.status) {
+ flag |= kt_remove_flag_file_operate_empty_d;
+ }
- main->setting.process_operate_file((void *) main, path, statistics, &flag);
- if (F_status_is_error(main->setting.state.status)) return flag;
+ if (main->setting.flag & kt_remove_main_flag_empty_all_d) {
+ if (main->setting.state.status) {
+ if (main->setting.flag & kt_remove_main_flag_empty_not_fail_d) {
+ flag |= kt_remove_flag_file_operate_remove_fail_d;
+ }
+ else if (main->setting.flag & kt_remove_main_flag_empty_not_d) {
+ flag |= kt_remove_flag_file_operate_remove_not_d;
+ }
+ }
+ else {
+ if (main->setting.flag & kt_remove_main_flag_empty_only_fail_d) {
+ flag |= kt_remove_flag_file_operate_remove_fail_d;
+ }
+ else if (main->setting.flag & kt_remove_main_flag_empty_only_d || !(main->setting.flag & kt_remove_main_flag_recurse_d)) {
+ flag |= kt_remove_flag_file_operate_remove_not_d;
+ }
+ }
+ }
+ else if (!main->setting.state.status) {
+ if (!(main->setting.flag & kt_remove_main_flag_recurse_d)) {
+ flag |= kt_remove_flag_file_operate_remove_not_d;
+ }
+ }
- if (main->setting.state.status == F_done) {
- main->setting.state.status = F_okay;
+ main->setting.state.status = F_okay;
- return flag;
- }
+ if (main->setting.flag & kt_remove_main_flag_tree_d) {
+ // @todo handle simulate for this.
}
+ // @todo call a similate fl_directory_do() or move this into the kt_remove_operate_file_directory() process.
+ }
+
+ if (main->setting.process_operate_file_simulate) {
main->setting.state.status = F_okay;
+
+ main->setting.process_operate_file_simulate((void *) main, path, statistics, &flag);
+ if (F_status_is_error(main->setting.state.status)) return flag;
+
+ if (main->setting.state.status == F_done) {
+ main->setting.state.status = F_okay;
+
+ return flag;
+ }
}
if (main->setting.flag & kt_remove_main_flag_force_d) {
kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_force_s, F_true);
+
+ flag |= kt_remove_flag_file_operate_remove_d;
}
if (flag & kt_remove_flag_file_operate_directory_d) {
- kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_recurse_s, flag & kt_remove_flag_file_operate_recurse_d);
-
- if (main->setting.flag & kt_remove_main_flag_empty_all_d) {
- // @todo handle simulate for this.
- // 1. print the particular empty flags set.
- // 2. determine if, when a directory, is empty or not.
- // 3. print the empty or not state.
- }
-
- // Recurse effectively forces tree.
- if (main->setting.flag & kt_remove_main_flag_recurse_d) {
- // @todo handle simulate for this.
- // @todo consider not following "rm" and having recurse not act like "--force" is specified.
- }
- else if (main->setting.flag & kt_remove_main_flag_tree_d) {
- // @todo handle simulate for this.
- }
-
- // @todo call a similate fl_directory_do() or move this into the kt_remove_operate_file_directory() process.
+ kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_recurse_s, main->setting.flag & kt_remove_main_flag_recurse_d);
}
+ // @todo not boolean, set prompt of yes/no based on conditions, however, if kt_remove_main_flag_prompt_each_d is set, then its always prompt.
if (main->setting.flag & kt_remove_main_flag_prompt_each_d) {
- // @todo handle simulate for this.
+ //kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_prompt_s, flag & kt_remove_main_flag_prompt_each_d);
}
- kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_remove_s, flag & kt_remove_flag_file_operate_remove_d);
+ // @todo determine if this path is part of a delete tree path.
+ //kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_tree_s, main->setting.flag & kt_remove_main_flag_tree_d);
+
+ kt_remove_print_simulate_operate_boolean(&main->program.output, kt_remove_remove_s, (flag & kt_remove_flag_file_operate_remove_d) && !(flag & kt_remove_flag_file_operate_remove_not_fail_d));
main->setting.state.status = F_okay;
#ifndef _di_kt_remove_operate_file_normal_
void kt_remove_operate_file_normal(kt_remove_main_t * const main, const f_string_static_t path, const uint8_t flag) {
- if (!(flag & kt_remove_flag_file_operate_remove_d)) {
- main->setting.state.status = F_no;
+ if (!(flag & kt_remove_flag_file_operate_remove_d) || flag & kt_remove_flag_file_operate_remove_not_fail_d) {
+ main->setting.state.status = (flag & kt_remove_flag_file_operate_remove_fail_d) ? F_status_set_error(F_no) : F_no;
return;
}