uint8_t j = 0;
+ main->setting.flag &= ~kt_remove_main_flag_version_copyright_help_d;
+
if (main->program.parameters.array[kt_remove_parameter_help_e].result & f_console_result_found_e) {
main->setting.flag |= kt_remove_main_flag_help_d;
}
- else {
- main->setting.flag -= main->setting.flag & kt_remove_main_flag_help_d;
- }
if (main->program.parameters.array[kt_remove_parameter_version_e].result & f_console_result_found_e) {
main->setting.flag |= kt_remove_main_flag_version_d;
}
- else {
- main->setting.flag -= main->setting.flag & kt_remove_main_flag_version_d;
- }
if (main->program.parameters.array[kt_remove_parameter_copyright_e].result & f_console_result_found_e) {
main->setting.flag |= kt_remove_main_flag_copyright_d;
}
- else {
- main->setting.flag -= main->setting.flag & kt_remove_main_flag_copyright_d;
- }
if (main->program.parameters.array[kt_remove_parameter_block_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_block_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_block_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_character_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_character_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_character_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_different_e].result & f_console_result_found_e) {
+ main->setting.flag &= ~kt_remove_main_flag_same_d;
+ main->setting.flag |= kt_remove_main_flag_different_d | kt_remove_main_flag_option_used_d;
+
if (main->program.parameters.array[kt_remove_parameter_same_e].result & f_console_result_found_e) {
index = main->program.parameters.array[kt_remove_parameter_different_e].locations.used;
index2 = main->program.parameters.array[kt_remove_parameter_same_e].locations.used;
- if (main->program.parameters.array[kt_remove_parameter_different_e].locations.array[index] > main->program.parameters.array[kt_remove_parameter_same_e].locations.array[index2]) {
- main->setting.flag |= kt_remove_main_flag_different_d;
-
- if (main->setting.flag & kt_remove_main_flag_same_d) {
- main->setting.flag -= kt_remove_main_flag_same_d;
- }
- }
- else {
+ if (main->program.parameters.array[kt_remove_parameter_different_e].locations.array[index] < main->program.parameters.array[kt_remove_parameter_same_e].locations.array[index2]) {
+ main->setting.flag &= ~kt_remove_main_flag_different_d;
main->setting.flag |= kt_remove_main_flag_same_d;
-
- if (main->setting.flag & kt_remove_main_flag_different_d) {
- main->setting.flag -= kt_remove_main_flag_different_d;
- }
}
}
- else {
- main->setting.flag |= kt_remove_main_flag_different_d;
-
- if (main->setting.flag & kt_remove_main_flag_same_d) {
- main->setting.flag -= kt_remove_main_flag_same_d;
- }
- }
-
- main->setting.flag |= kt_remove_main_flag_option_used_d;
}
else if (main->program.parameters.array[kt_remove_parameter_same_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_same_d;
-
- if (main->setting.flag & kt_remove_main_flag_different_d) {
- main->setting.flag -= kt_remove_main_flag_different_d;
- }
-
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag &= ~kt_remove_main_flag_different_d;
+ main->setting.flag |= kt_remove_main_flag_same_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_fifo_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_fifo_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_fifo_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_follow_e].result & f_console_result_found_e) {
+ main->setting.flag |= kt_remove_main_flag_follow_d;
+
if (main->program.parameters.array[kt_remove_parameter_stay_e].result & f_console_result_found_e) {
index = main->program.parameters.array[kt_remove_parameter_follow_e].locations.used;
index2 = main->program.parameters.array[kt_remove_parameter_stay_e].locations.used;
- if (main->program.parameters.array[kt_remove_parameter_follow_e].locations.array[index] > main->program.parameters.array[kt_remove_parameter_stay_e].locations.array[index2]) {
- main->setting.flag |= kt_remove_main_flag_follow_d;
- }
- else {
- if (main->setting.flag & kt_remove_main_flag_follow_d) {
- main->setting.flag -= kt_remove_main_flag_follow_d;
- }
+ if (main->program.parameters.array[kt_remove_parameter_follow_e].locations.array[index] < main->program.parameters.array[kt_remove_parameter_stay_e].locations.array[index2]) {
+ main->setting.flag &= ~kt_remove_main_flag_follow_d;
}
}
- else {
- main->setting.flag |= kt_remove_main_flag_follow_d;
- }
}
else if (main->program.parameters.array[kt_remove_parameter_stay_e].result & f_console_result_found_e) {
- if (main->setting.flag & kt_remove_main_flag_follow_d) {
- main->setting.flag -= kt_remove_main_flag_follow_d;
- }
+ main->setting.flag &= ~kt_remove_main_flag_follow_d;
}
if (main->program.parameters.array[kt_remove_parameter_directory_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_directory_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_directory_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_force_e].result & f_console_result_found_e) {
}
if (main->program.parameters.array[kt_remove_parameter_link_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_link_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_link_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_recurse_e].result & f_console_result_found_e) {
}
if (main->program.parameters.array[kt_remove_parameter_regular_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_regular_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_regular_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_simulate_e].result & f_console_result_found_e) {
}
if (main->program.parameters.array[kt_remove_parameter_socket_e].result & f_console_result_found_e) {
- main->setting.flag |= kt_remove_main_flag_socket_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_socket_d | kt_remove_main_flag_option_used_d;
}
if (main->program.parameters.array[kt_remove_parameter_tree_e].result & f_console_result_found_e) {
index = main->program.parameters.array[kt_remove_parameter_empty_e].values.array[total_arguments - 1];
+ main->setting.flag &= ~kt_remove_main_flag_empty_all_d;
+ main->setting.flag |= kt_remove_main_flag_option_used_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_not_fail_d) {
- 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_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_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;
- }
-
- 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_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_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_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_d) {
- main->setting.flag -= kt_remove_main_flag_empty_not_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_d) {
- main->setting.flag -= kt_remove_main_flag_empty_only_d;
- }
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
return;
}
-
- main->setting.flag |= kt_remove_main_flag_option_used_d;
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
++main->setting.groups.used;
} // for
- main->setting.flag |= kt_remove_main_flag_group_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_group_d | kt_remove_main_flag_option_used_d;
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
}
}
- uint8_t enumerations[] = {
+ const 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,
};
- f_string_static_t strings[] = {
+ const f_string_static_t strings[] = {
kt_remove_mode_symbol_different_s,
kt_remove_mode_symbol_same_s,
kt_remove_mode_symbol_similar_s,
}
} // for
- main->setting.flag |= kt_remove_main_flag_mode_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_mode_d | kt_remove_main_flag_option_used_d;
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
++main->setting.users.used;
} // for
- main->setting.flag |= kt_remove_main_flag_user_d;
- main->setting.flag |= kt_remove_main_flag_option_used_d;
+ main->setting.flag |= kt_remove_main_flag_user_d | kt_remove_main_flag_option_used_d;
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
index = main->program.parameters.array[kt_remove_parameter_prompt_e].values.array[total_arguments - 1];
+ main->setting.flag &= ~kt_remove_main_flag_prompt_all_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_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;
- }
-
- 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_each_d) {
- 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_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_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_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_once_d) {
- main->setting.flag -= kt_remove_main_flag_prompt_once_d;
- }
}
else {
main->setting.state.status = F_status_set_error(F_parameter);
}
if (main->program.parameters.array[kt_remove_parameter_utc_e].result & f_console_result_found_e) {
+ main->setting.flag |= kt_remove_main_flag_utc_d;
// Use the right most parameter when both --utc and --local are passed.
if (main->program.parameters.array[kt_remove_parameter_local_e].result & f_console_result_found_e) {
- const f_number_unsigned_t last_local = main->program.parameters.array[kt_remove_parameter_local_e].locations.array[main->program.parameters.array[kt_remove_parameter_local_e].locations.used];
- const f_number_unsigned_t last_utc = main->program.parameters.array[kt_remove_parameter_utc_e].locations.array[main->program.parameters.array[kt_remove_parameter_utc_e].locations.used];
+ index = main->program.parameters.array[kt_remove_parameter_local_e].locations.array[main->program.parameters.array[kt_remove_parameter_local_e].locations.used];
+ index2 = main->program.parameters.array[kt_remove_parameter_utc_e].locations.array[main->program.parameters.array[kt_remove_parameter_utc_e].locations.used];
- if (last_local > kt_remove_parameter_utc_e) {
- if (main->setting.flag & kt_remove_main_flag_utc_d) {
- main->setting.flag -= kt_remove_main_flag_utc_d;
- }
- }
- else {
- main->setting.flag |= kt_remove_main_flag_utc_d;
+ if (index > index2) {
+ main->setting.flag &= ~kt_remove_main_flag_utc_d;
}
}
- else {
- main->setting.flag |= kt_remove_main_flag_utc_d;
- }
}
else if (main->program.parameters.array[kt_remove_parameter_local_e].result & f_console_result_found_e) {
- if (main->setting.flag & kt_remove_main_flag_utc_d) {
- main->setting.flag -= kt_remove_main_flag_utc_d;
- }
+ main->setting.flag &= ~kt_remove_main_flag_utc_d;
}
// Load all remaining files as static strings (setting size to 0).
#if !defined(_di_kt_remove_signal_check_) && defined(_di_thread_support_)
f_status_t kt_remove_signal_check(kt_remove_main_t * const main) {
- if (!main) return F_false;
- if (main->program.signal.id == -1) return F_false;
+ if (!main || main->program.signal.id == -1) return F_false;
+ if (main->program.signal_received) return F_true;
if (!((++main->program.signal_check) % kt_remove_signal_check_d)) {
- if (fll_program_standard_signal_received(&main->program)) return F_true;
+ if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interupt) return F_true;
main->program.signal_check = 0;
}
#if !defined(_di_kt_remove_signal_check_) && !defined(_di_thread_support_)
f_status_t kt_remove_signal_check(kt_remove_main_t * const main) {
- if (!main) return F_false;
- if (main->program.signal.id == -1) return F_false;
+ if (!main || main->program.signal.id == -1) return F_false;
if (main->program.signal_received) return F_true;
return F_false;
if (!main) return;
- siginfo_t information;
- f_number_unsigned_t failsafe = 0;
-
- memset(&information, 0, sizeof(siginfo_t));
-
- main->program.signal_received = 0;
-
f_signal_set_empty(&main->program.signal.set);
f_signal_set_add(F_signal_abort, &main->program.signal.set);
f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
f_signal_set_add(F_signal_termination, &main->program.signal.set);
if (main->program.signal.id == -1) {
- main->setting.status_thread = f_signal_open(&main->program.signal);
+ main->program.signal_status = f_signal_open(&main->program.signal);
- if (F_status_is_error(main->setting.status_thread)) {
+ if (F_status_is_error(main->program.signal_status)) {
main->program.signal_received = F_signal_abort;
return;
}
}
- do {
- memset(&information, 0, sizeof(siginfo_t));
-
- main->setting.status_thread = f_signal_wait(&main->program.signal.set, &information);
-
- if (F_status_is_error(main->setting.status_thread) && F_status_set_fine(main->setting.status_thread) != F_interrupt) {
- if (++failsafe >= kt_remove_signal_check_failsafe_d) break;
- }
-
- switch (information.si_signo) {
- case F_signal_abort:
- case F_signal_broken_pipe:
- case F_signal_hangup:
- case F_signal_interrupt:
- case F_signal_quit:
- case F_signal_termination:
- main->program.signal_received = information.si_signo;
-
- break;
- }
-
- failsafe = 0;
- main->setting.status_thread = F_okay;
-
- } while (!main->program.signal_received);
+ fll_program_standard_signal_received_wait(&main->program, kt_remove_signal_check_failsafe_d);
f_signal_close(&main->program.signal);
- if (F_status_is_error(main->setting.status_thread)) {
+ if (F_status_is_error(main->program.signal_status)) {
main->program.signal_received = F_signal_abort;
}
}