From 4eb8a2a7ce577c55294946079cda3343a3d618c9 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 9 Nov 2020 20:19:03 -0600 Subject: [PATCH] Cleanup: remove unnecessary tabbing and move newline. Move the newline to its own printf function that is after any color codes. --- level_3/fake/c/main.c | 31 ++++++++++++++----------------- level_3/fake/c/private-fake.c | 3 ++- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/level_3/fake/c/main.c b/level_3/fake/c/main.c index b0bc9bd..7aa0125 100644 --- a/level_3/fake/c/main.c +++ b/level_3/fake/c/main.c @@ -15,25 +15,22 @@ int main(const unsigned long argc, const f_string_t *argv) { const f_console_arguments_t arguments = { argc, argv }; fake_data_t data = fake_data_t_initialize; - f_status_t status = F_none; - { - f_signal_set_empty(&data.signal.set); - f_signal_set_add(F_signal_abort, &data.signal.set); - f_signal_set_add(F_signal_hangup, &data.signal.set); - f_signal_set_add(F_signal_interrupt, &data.signal.set); - f_signal_set_add(F_signal_quit, &data.signal.set); - f_signal_set_add(F_signal_termination, &data.signal.set); - f_signal_set_handle(SIG_BLOCK, &data.signal.set); - - status = f_signal_open(&data.signal); - - // if there is an error opening a signal descriptor, then do not handle signals. - if (F_status_is_error(status)) { - f_signal_set_handle(SIG_UNBLOCK, &data.signal.set); - f_signal_close(&data.signal); - } + f_signal_set_empty(&data.signal.set); + f_signal_set_add(F_signal_abort, &data.signal.set); + f_signal_set_add(F_signal_hangup, &data.signal.set); + f_signal_set_add(F_signal_interrupt, &data.signal.set); + f_signal_set_add(F_signal_quit, &data.signal.set); + f_signal_set_add(F_signal_termination, &data.signal.set); + f_signal_set_handle(SIG_BLOCK, &data.signal.set); + + status = f_signal_open(&data.signal); + + // if there is an error opening a signal descriptor, then do not handle signals. + if (F_status_is_error(status)) { + f_signal_set_handle(SIG_UNBLOCK, &data.signal.set); + f_signal_close(&data.signal); } // @fixme: bad design in POSIX where there is no get umask without setting it. diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index fb89392..8e550ca 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -937,7 +937,8 @@ extern "C" { if (data.error.verbosity != f_console_verbosity_quiet) { fprintf(data.error.to.stream, "%c", f_string_eol[0]); - fl_color_print(data.error.to.stream, data.context.set.error, "ALERT: An appropriate exit signal has been received, now aborting.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ALERT: An appropriate exit signal has been received, now aborting."); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); } return F_true; -- 1.8.3.1