From 539af4c52fee9d2659a853b7813e19619e2078a0 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 27 Jan 2025 22:45:34 -0600 Subject: [PATCH] Update: Improve signal handling code. Move the `fll_program_print_signal_received()` calls to the main program to help ensure consistent printing at the end of the program. - Note: I am not certain if I want this instead in the main() function or not and I opted not to do so for now. --- sources/c/program/control/main/process.c | 8 ++++++++ sources/c/program/control/main/signal.c | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sources/c/program/control/main/process.c b/sources/c/program/control/main/process.c index 784777b..87c9e4e 100644 --- a/sources/c/program/control/main/process.c +++ b/sources/c/program/control/main/process.c @@ -22,6 +22,10 @@ extern "C" { fll_program_print_copyright(&main->program.message, fll_program_copyright_year_author_s); } + if (main->program.signal_received) { + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); + } + return; } @@ -98,6 +102,10 @@ extern "C" { main->setting.state.status = F_status_set_error(F_data_not); } + if (main->program.signal_received) { + fll_program_print_signal_received(&main->program.warning, main->program.signal_received); + } + if (F_status_is_error(main->setting.state.status)) return; main->setting.state.status = F_okay; diff --git a/sources/c/program/control/main/signal.c b/sources/c/program/control/main/signal.c index 6a577a7..d62a259 100644 --- a/sources/c/program/control/main/signal.c +++ b/sources/c/program/control/main/signal.c @@ -11,9 +11,7 @@ extern "C" { if (main->program.signal_received) return F_true; if (!((++main->program.signal_check) % control_signal_check_d)) { - if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interupt) { - fll_program_print_signal_received(&main->program.warning, main->program.signal_received); - + if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) { main->setting.state.status = F_status_set_error(F_interrupt); return F_true; @@ -32,8 +30,6 @@ extern "C" { if (!main) return F_false; if (main->program.signal_received) { - fll_program_print_signal_received(&main->program.warning, main->program.signal_received); - main->setting.state.status = F_status_set_error(F_interrupt); return F_true; -- 1.8.3.1