From: Kevin Day Date: Sun, 8 Aug 2021 03:57:03 +0000 (-0500) Subject: Progress: Continue string and convert changes, fixing bugs. X-Git-Tag: 0.5.5~17 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=2eaa1b50d6d15e530fbb1635958aa190dfe7f9df;p=fll Progress: Continue string and convert changes, fixing bugs. Update all relevant dependencies. Convert the error projects. Convert control program. Begin converting controller program. I really wanted to get rid of those pesky mutex locks. With the addition of explicit calls to flockfile() and funlockfile() this felt like a possibility. Unfortunately, I still need to protect both stdout and stderr from both writing to the same destination (which is common for normal consoles). --- diff --git a/level_1/fl_print/data/build/settings b/level_1/fl_print/data/build/settings index 8fe3b99..fb520b6 100644 --- a/level_1/fl_print/data/build/settings +++ b/level_1/fl_print/data/build/settings @@ -20,7 +20,7 @@ build_compiler gcc build_indexer ar build_language c build_libraries -lc -build_libraries-individual -lf_conversion -lf_memory -lf_print -lf_string -lf_utf +build_libraries-individual -lf_color -lf_conversion -lf_memory -lf_print -lf_string -lf_utf build_sources_library print.c private-print.c build_sources_program build_sources_headers print.h diff --git a/level_2/fll_error/c/error.c b/level_2/fll_error/c/error.c index 1925bf4..9d89722 100644 --- a/level_2/fll_error/c/error.c +++ b/level_2/fll_error/c/error.c @@ -7,12 +7,14 @@ extern "C" { #ifndef _di_fll_error_print_ f_status_t fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback) { + return private_fll_error_print(print, status, function, fallback); } #endif // _di_fll_error_print_ #ifndef _di_fll_error_file_print_ f_status_t fll_error_file_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type) { + const char *type_name = fll_error_file_type_string_file; if (type == fll_error_file_type_directory) { @@ -24,10 +26,13 @@ extern "C" { if (status == F_access_denied) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sAccess denied while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SAccess denied while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -35,10 +40,13 @@ extern "C" { if (status == F_access_group) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sCurrent user is not allowed to use the given group while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SCurrent user is not allowed to use the given group while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -46,10 +54,13 @@ extern "C" { if (status == F_access_owner) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sCurrent user is not allowed to use the given owner while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SCurrent user is not allowed to use the given owner while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -57,10 +68,13 @@ extern "C" { if (status == F_directory) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid directory while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid directory while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -68,10 +82,13 @@ extern "C" { if (status == F_directory_empty_not) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', not empty.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', not empty.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -79,10 +96,13 @@ extern "C" { if (status == F_file_close) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', failed to close.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', failed to close.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -90,10 +110,13 @@ extern "C" { if (status == F_file_closed) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', is closed.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', is closed.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -101,10 +124,13 @@ extern "C" { if (status == F_file_found) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', found %s.%s%c", print.context.before->string, type_name, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', found.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -112,99 +138,153 @@ extern "C" { if (status == F_file_found_not) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', could not find %s.%s%c", print.context.before->string, type_name, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', could not find.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; } if (status == F_file_open) { - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', already open.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', already open.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_descriptor) { - fprintf(print.to.stream, "%s%sFile descriptor error while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SFile descriptor error while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_descriptor_max) { - fprintf(print.to.stream, "%s%sMax file descriptors reached while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SMax file descriptors reached while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_descriptor_not) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid file descriptor while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid file descriptor while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; } if (status == F_file_empty) { - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', %s is empty.%s%c", print.context.before->string, type_name, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', %s is empty.%]%c", print.to.stream, print.context, type_name, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_flush) { - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', flush failed.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', flush failed.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_open_max) { - fprintf(print.to.stream, "%s%sMax open files reached while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SMax open files reached while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_overflow) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sOverflow while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SOverflow while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; } if (status == F_file_purge) { - fprintf(print.to.stream, "%s%sUnable to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', purge failed.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', purge failed.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_read) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sRead failed while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SRead failed while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -212,10 +292,13 @@ extern "C" { if (status == F_file_seek) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sSeek failed while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SSeek failed while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -223,10 +306,13 @@ extern "C" { if (status == F_file_stat) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sStat failed while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SStat failed while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -234,10 +320,13 @@ extern "C" { if (status == F_file_synchronize) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sSynchronize failed while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SSynchronize failed while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -245,10 +334,13 @@ extern "C" { if (status == F_file_utf) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sUTF failure while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SUTF failure while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -256,37 +348,55 @@ extern "C" { if (status == F_file_utf_not) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid UTF while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid UTF while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; } if (status == F_file_underflow) { - fprintf(print.to.stream, "%s%sUnderflow while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnderflow while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_file_write) { - fprintf(print.to.stream, "%s%sFailed to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s', write failure.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SFailed to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[', write failure.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_loop) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sLoop while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SLoop while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -294,10 +404,13 @@ extern "C" { if (status == F_name) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid %s name '", print.context.before->string, print.prefix, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid %S name '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -305,33 +418,45 @@ extern "C" { if (status == F_number_overflow) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sNumber overflow while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SNumber overflow while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; } if (status == F_number_underflow) { - fprintf(print.to.stream, "%s%sNumber underflow while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + if (print.verbosity != f_console_verbosity_quiet) { + flockfile(print.to.stream); + + fl_print_string("%c%[%SNumber underflow while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); + } return F_false; } if (status == F_parameter) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid parameter", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid parameter", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, " for the %s '", type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + fl_print_string(" for the %S '%]", print.to.stream, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -339,10 +464,13 @@ extern "C" { if (status == F_prohibited) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sProhibited by system while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SProhibited by system while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -351,10 +479,13 @@ extern "C" { if (type == fll_error_file_type_file) { if (status == F_file_type_not_directory) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid or missing directory in path while trying to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid or missing directory in path while trying to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -363,10 +494,13 @@ extern "C" { if (status == F_failure) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sFailed to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SFailed to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -375,10 +509,13 @@ extern "C" { if (type == fll_error_file_type_file || type == fll_error_file_type_directory) { if (status == F_directory_found_not) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sFailed to %s %s '", print.context.before->string, print.prefix, operation, type_name); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - fprintf(print.to.stream, "%s' due to an invalid directory in the path.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SFailed to %S %S '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, operation, type_name, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, name, print.notable); + fl_print_string("%[' due to an invalid directory in the path.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -394,10 +531,13 @@ extern "C" { if (status == F_data_not) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sThe argument for the parameter '", print.context.before->string, print.prefix); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); - fprintf(print.to.stream, "%s' must not be an empty string.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe argument for the parameter '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, parameter, print.notable); + fl_print_string("%[' must not be an empty string.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -405,12 +545,15 @@ extern "C" { if (status == F_number) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - fprintf(print.to.stream, "%s' is not a valid number for the parameter '", print.context.before->string); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe argument '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, argument, print.notable); + fl_print_string("%[' is not a valid number for the parameter '%]", print.to.stream, print.context, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, parameter, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -418,12 +561,15 @@ extern "C" { if (status == F_number_negative) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - fprintf(print.to.stream, "%s' is negative, which is not allowed for the parameter '", print.context.before->string); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe argument '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, argument, print.notable); + fl_print_string("%[' is negative, which is not allowed for the parameter '%]", print.to.stream, print.context, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, parameter, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -431,12 +577,15 @@ extern "C" { if (status == F_number_overflow) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - fprintf(print.to.stream, "%s' is too large for the parameter '", print.context.before->string); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe argument '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, argument, print.notable); + fl_print_string("%[' is too large for the parameter '%]", print.to.stream, print.context, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, parameter, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -444,12 +593,15 @@ extern "C" { if (status == F_number_positive) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - fprintf(print.to.stream, "%s' is positive, which is not allowed for the parameter '", print.context.before->string); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe argument '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, argument, print.notable); + fl_print_string("%[' is positive, which is not allowed for the parameter '%]", print.to.stream, print.context, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, parameter, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -457,12 +609,15 @@ extern "C" { if (status == F_number_underflow) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sThe argument '", print.context.before->string, print.prefix); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - fprintf(print.to.stream, "%s' is too small for the parameter '", print.context.before->string); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); - fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe argument '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, argument, print.notable); + fl_print_string("%[' is too small for the parameter '%]", print.to.stream, print.context, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, parameter, print.notable); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; diff --git a/level_2/fll_error/c/error.h b/level_2/fll_error/c/error.h index b87047d..6c7321f 100644 --- a/level_2/fll_error/c/error.h +++ b/level_2/fll_error/c/error.h @@ -22,9 +22,10 @@ #include #include #include +#include // fll-1 includes -#include +#include // fll-2 error includes #include diff --git a/level_2/fll_error/c/private-error.c b/level_2/fll_error/c/private-error.c index c5f45b9..928ceb5 100644 --- a/level_2/fll_error/c/private-error.c +++ b/level_2/fll_error/c/private-error.c @@ -10,12 +10,15 @@ extern "C" { if (status == F_access_denied) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sAccess denied", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SAccess denied", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -23,12 +26,15 @@ extern "C" { if (status == F_array_too_large) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sMaximum array length reached", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SMaximum array length reached", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -36,12 +42,15 @@ extern "C" { if (status == F_buffer_too_large) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sMaximum buffer length reached", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SMaximum buffer length reached", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -49,12 +58,15 @@ extern "C" { if (status == F_memory_not) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sUnable to allocate memory", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SUnable to allocate memory", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -62,12 +74,15 @@ extern "C" { if (status == F_parameter) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid parameter", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid parameter", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -75,12 +90,15 @@ extern "C" { if (status == F_string_too_large) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sMaximum string length reached", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SMaximum string length reached", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -88,12 +106,15 @@ extern "C" { if (status == F_utf) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid UTF-8 character", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid UTF-8 character", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -101,20 +122,23 @@ extern "C" { if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sInvalid (incomplete) UTF-8 character found ", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SInvalid (incomplete) UTF-8 character found", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); if (status == F_complete_not_utf_eos) { - fprintf(print.to.stream, " at end of string.%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(" at the end of string.%]%c", print.to.stream, print.context, f_string_eol_s[0]); } else if (status == F_complete_not_utf_stop) { - fprintf(print.to.stream, " at stop point of string.%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(" at the stop point of string.%]%c", print.to.stream, print.context, f_string_eol_s[0]); } else { - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); } + + funlockfile(print.to.stream); } return F_false; @@ -122,12 +146,15 @@ extern "C" { if (status == F_failure) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sFailure", print.context.before->string, print.prefix); + flockfile(print.to.stream); + + fl_print_string("%c%[%SFailure", print.to.stream, f_string_eol_s[0], print.context, print.prefix); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(".%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } return F_false; @@ -135,14 +162,16 @@ extern "C" { if (fallback && print.verbosity != f_console_verbosity_quiet) { if (print.verbosity != f_console_verbosity_quiet) { - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%s(", print.context.before->string, print.prefix); - fprintf(print.to.stream, "%s%s%hu%s", print.context.after->string, print.notable.before->string, status, print.notable.after->string); - fprintf(print.to.stream, "%s)", print.context.before->string); + flockfile(print.to.stream); + + fl_print_string("%c%[%S(", print.to.stream, f_string_eol_s[0], print.context, print.prefix); + fl_print_string("%[%ui%]%[", print.to.stream, print.notable, status, print.notable, print.context); private_fll_error_print_function(print, function); - fprintf(print.to.stream, ".%s%c", print.context.after->string, f_string_eol_s[0]); + fl_print_string(").%]%c", print.to.stream, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); } } @@ -154,9 +183,9 @@ extern "C" { void private_fll_error_print_function(const fll_error_print_t print, const f_string_t function) { if (function) { - fprintf(print.to.stream, " when calling function %s", print.context.after->string); - fprintf(print.to.stream, "%s%s%s", print.notable.before->string, function, print.notable.after->string); - fprintf(print.to.stream, "%s()", print.context.before->string); + fl_print_string(" when calling function %]", print.to.stream, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, function, print.notable); + fl_print_string("%[()", print.to.stream, print.context); } } #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) diff --git a/level_2/fll_error/data/build/dependencies b/level_2/fll_error/data/build/dependencies index d5b5789..d70ee1a 100644 --- a/level_2/fll_error/data/build/dependencies +++ b/level_2/fll_error/data/build/dependencies @@ -9,3 +9,4 @@ f_color f_console f_file f_print +fl_print diff --git a/level_2/fll_error/data/build/settings b/level_2/fll_error/data/build/settings index f6c18c0..29366ee 100644 --- a/level_2/fll_error/data/build/settings +++ b/level_2/fll_error/data/build/settings @@ -20,7 +20,7 @@ build_compiler gcc build_indexer ar build_language c build_libraries -lc -build_libraries-individual -lf_color -lf_console -lf_file -lf_memory -lf_print -lf_string -lf_type_array -lf_utf +build_libraries-individual -lfl_print -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_print -lf_string -lf_type_array -lf_utf build_sources_library error.c error-common.c private-error.c build_sources_program build_sources_headers error.h error-common.h diff --git a/level_2/fll_print/data/build/settings b/level_2/fll_print/data/build/settings index b97cccc..ac3aa80 100644 --- a/level_2/fll_print/data/build/settings +++ b/level_2/fll_print/data/build/settings @@ -20,7 +20,7 @@ build_compiler gcc build_indexer ar build_language c build_libraries -lc -build_libraries-individual -lfl_print -lf_conversion -lf_memory -lf_print -lf_string -lf_utf +build_libraries-individual -lfl_print -lf_color -lf_conversion -lf_memory -lf_print -lf_string -lf_utf build_sources_library print.c build_sources_program build_sources_headers print.h diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 443865f..8d252bd 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -257,7 +257,7 @@ extern "C" { fl_print_string("%[%s%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_width, main->context.set.notable); fl_print_string("%[' value can only be a number (inclusively) between %]", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_string("%[1%]", main->error.to.stream, main->context.set.notable, main->context.set.notable); - fl_print_string("%[ and %]", main->error.to.stream, main->context.set.error, main->context.set.error); + fl_print_string(" %[and%] ", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_string("%[250%]", main->error.to.stream, main->context.set.notable, main->context.set.notable); fl_print_string("%[.%]%c", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s[0]); @@ -297,7 +297,7 @@ extern "C" { fl_print_string("%[%s%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first, main->context.set.notable); fl_print_string("%[' value can only be a number (inclusively) between %]", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_string("%[0%]", main->error.to.stream, main->context.set.notable, main->context.set.notable); - fl_print_string("%[ and %]", main->error.to.stream, main->context.set.error, main->context.set.error); + fl_print_string(" %[and%] ", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_string("%[%ul%]", main->error.to.stream, main->context.set.notable, f_number_t_size_unsigned, main->context.set.notable); fl_print_string("%[.%]%c", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s[0]); @@ -337,7 +337,7 @@ extern "C" { fl_print_string("%[%s%s%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last, main->context.set.notable); fl_print_string("%[' value can only be a number (inclusively) between %]", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_string("%[0%]", main->error.to.stream, main->context.set.notable, main->context.set.notable); - fl_print_string("%[ and %]", main->error.to.stream, main->context.set.error, main->context.set.error); + fl_print_string(" %[and%] ", main->error.to.stream, main->context.set.error, main->context.set.error); fl_print_string("%[%ul%]", main->error.to.stream, main->context.set.notable, f_number_t_size_unsigned, main->context.set.notable); fl_print_string("%[.%]%c", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s[0]); @@ -455,7 +455,7 @@ extern "C" { f_print_terminated(f_string_eol_s, main->output.stream); fl_print_string("%[Byte Dump of: %]%[", main->output.stream, main->context.set.title, main->context.set.title, main->context.set.notable); fll_print_safely_terminated(arguments.argv[main->remaining.array[counter]], main->output.stream); - fl_print_string("%]%[ (in ", main->output.stream, main->context.set.notable, main->context.set.title); + fl_print_string("%] %[(in ", main->output.stream, main->context.set.notable, main->context.set.title); if (main->mode == byte_dump_mode_hexidecimal) { f_print_terminated("Hexidecimal", main->output.stream); diff --git a/level_3/byte_dump/data/build/dependencies b/level_3/byte_dump/data/build/dependencies index f198a5c..f48f7f0 100644 --- a/level_3/byte_dump/data/build/dependencies +++ b/level_3/byte_dump/data/build/dependencies @@ -14,6 +14,7 @@ f_print fl_console fl_conversion fl_print +fl_string fll_error fll_print fll_program diff --git a/level_3/control/c/control.c b/level_3/control/c/control.c index a1adcf9..e1bc988 100644 --- a/level_3/control/c/control.c +++ b/level_3/control/c/control.c @@ -29,6 +29,7 @@ extern "C" { #ifndef _di_control_main_ f_status_t control_main(const f_console_arguments_t arguments, control_main_t *main) { + f_status_t status = F_none; { @@ -56,7 +57,7 @@ extern "C" { if (F_status_is_error(status)) { if (main->error.verbosity != f_console_verbosity_quiet) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); - fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fll_print_terminated(f_string_eol_s, main->error.to.stream); } control_main_delete(main); @@ -113,7 +114,7 @@ extern "C" { // ensure a newline is always put at the end of the program execution, unless in quiet mode. if (main->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fll_print_terminated(f_string_eol_s, main->error.to.stream); } } diff --git a/level_3/control/c/control.h b/level_3/control/c/control.h index 8c5c13e..e3e3603 100644 --- a/level_3/control/c/control.h +++ b/level_3/control/c/control.h @@ -30,10 +30,12 @@ // fll-1 includes #include +#include #include // fll-2 includes #include +#include #include #ifdef __cplusplus diff --git a/level_3/control/data/build/dependencies b/level_3/control/data/build/dependencies index 81a9424..6e70413 100644 --- a/level_3/control/data/build/dependencies +++ b/level_3/control/data/build/dependencies @@ -11,5 +11,7 @@ f_file f_pipe f_print fl_console +fl_print +fl_string fll_error fll_program diff --git a/level_3/control/data/build/settings b/level_3/control/data/build/settings index 1ffa648..0128b71 100644 --- a/level_3/control/data/build/settings +++ b/level_3/control/data/build/settings @@ -20,7 +20,7 @@ build_compiler gcc build_indexer ar build_language c build_libraries -lc -build_libraries-individual -lfll_error -lfll_program -lfl_console -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf +build_libraries-individual -lfll_error -lfll_program -lfl_console -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library control.c private-common.c private-control.c @@ -51,7 +51,7 @@ defines_all -D_libcap_legacy_only_ defines_static defines_shared -flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses +flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses flags_shared flags_static flags_library -fPIC diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index 7cc45d4..7e17166 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -13,6 +13,8 @@ extern "C" { #ifndef _di_controller_print_help_ f_status_t controller_print_help(const f_file_t output, const f_color_context_t context) { + flockfile(output.stream); + fll_program_print_help_header(output, context, controller_name_long, controller_version); fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message."); @@ -25,7 +27,7 @@ extern "C" { fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output."); fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number."); - fprintf(output.stream, "%c", f_string_eol_s[0]); + f_print_terminated(f_string_eol_s, output.stream); fll_program_print_help_option(output, context, controller_short_control, controller_long_control, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom control group file path, such as '" f_control_group_path_system_prefix f_control_group_path_system_default "'."); fll_program_print_help_option(output, context, controller_short_daemon, controller_long_daemon, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Run in daemon only mode (do not process the entry)."); @@ -38,12 +40,14 @@ extern "C" { fll_program_print_help_usage(output, context, controller_name, "entry"); - fprintf(output.stream, " When both the "); - f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, controller_long_simulate); - fprintf(output.stream, " parameter and the "); - f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, controller_long_validate); - fprintf(output.stream, " parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed."); - fprintf(output.stream, "%c", f_string_eol_s[0]); + f_print_terminated(" When both the ", output.stream); + fl_print_string("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, controller_long_simulate, context.set.notable); + f_print_terminated(" parameter and the ", output.stream); + fl_print_string("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, controller_long_validate, context.set.notable); + f_print_terminated(" parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.", output.stream); + f_print_terminated(f_string_eol_s, output.stream); + + funlockfile(output.stream); return F_none; } @@ -79,7 +83,7 @@ extern "C" { if (F_status_is_error(status)) { if (main->error.verbosity != f_console_verbosity_quiet) { fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); - fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); + fll_print_terminated(f_string_eol_s, main->error.to.stream); } controller_main_delete(main); @@ -129,8 +133,12 @@ extern "C" { } if (main->parameters[controller_parameter_version].result == f_console_result_found) { + flockfile(main->output.stream); + fll_program_print_version(main->output, controller_version); + funlockfile(main->output.stream); + controller_main_delete(main); return F_none; } @@ -162,10 +170,13 @@ extern "C" { if (main->parameters[controller_parameter_settings].result == f_console_result_found) { if (main->error.verbosity != f_console_verbosity_quiet) { - fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); - fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_settings, main->error.notable.after->string); - fprintf(main->error.to.stream, "%s' was specified, but no value was given.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); + flockfile(main->error.to.stream); + + fl_print_string("%c%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_string("%[%s%s%]", main->error.to.stream, main->context.notable, f_console_symbol_long_enable_s, controller_long_settings, main->context.notable); + fl_print_string("%[' was specified, but no value was given.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]); + + funlockfile(main->error.to.stream); } status = F_status_set_error(F_parameter); @@ -176,9 +187,7 @@ extern "C" { status = fll_path_canonical(arguments.argv[location], &setting.path_setting); if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); } } else { @@ -190,18 +199,19 @@ extern "C" { } if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); } } if (main->parameters[controller_parameter_pid].result == f_console_result_found) { if (main->error.verbosity != f_console_verbosity_quiet) { - fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); - fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_pid, main->error.notable.after->string); - fprintf(main->error.to.stream, "%s' was specified, but no value was given.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); + flockfile(main->error.to.stream); + + fl_print_string("%c%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_string("%[%s%s%]", main->error.to.stream, main->context.notable, f_console_symbol_long_enable_s, controller_long_pid, main->context.notable); + fl_print_string("%[' was specified, but no value was given.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]); + + funlockfile(main->error.to.stream); } status = F_status_set_error(F_parameter); @@ -213,17 +223,18 @@ extern "C" { status = fll_path_canonical(arguments.argv[location], &setting.path_pid); if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); } } else { if (main->warning.verbosity == f_console_verbosity_debug) { - fprintf(main->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->warning.to.stream, "%s%sThe parameter '", main->warning.context.before->string, main->warning.prefix ? main->warning.prefix : f_string_empty_s); - fprintf(main->warning.to.stream, "%s%s%s%s%s", main->warning.context.after->string, main->warning.notable.before->string, f_console_symbol_long_enable_s, controller_long_pid, main->warning.notable.after->string); - fprintf(main->warning.to.stream, "%s' must be a file path but instead is an empty string, falling back to the default.%s%c", main->warning.context.before->string, main->warning.context.after->string, f_string_eol_s[0]); + flockfile(main->warning.to.stream); + + fl_print_string("%c%[%SThe parameter '%]", main->warning.to.stream, f_string_eol_s[0], main->warning.context, main->warning.prefix ? main->warning.prefix : f_string_empty_s, main->warning.context); + fl_print_string("%[%s%s%]", main->warning.to.stream, main->context.notable, f_console_symbol_long_enable_s, controller_long_pid, main->context.notable); + fl_print_string("%[' must be a file path but instead is an empty string, falling back to the default.%]%c", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s[0]); + + funlockfile(main->warning.to.stream); } } } @@ -247,18 +258,19 @@ extern "C" { } if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true); } } if (main->parameters[controller_parameter_control].result == f_console_result_found) { if (main->error.verbosity != f_console_verbosity_quiet) { - fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); - fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_control, main->error.notable.after->string); - fprintf(main->error.to.stream, "%s' was specified, but no value was given.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); + flockfile(main->error.to.stream); + + fl_print_string("%c%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_string("%[%s%s%]", main->error.to.stream, main->context.notable, f_console_symbol_long_enable_s, controller_long_control, main->context.notable); + fl_print_string("%[' was specified, but no value was given.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]); + + funlockfile(main->error.to.stream); } status = F_status_set_error(F_parameter); @@ -270,35 +282,32 @@ extern "C" { status = fll_path_canonical(arguments.argv[location], &setting.path_control); if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true); } else { status = f_string_append_assure(f_path_separator, 1, &setting.path_control); if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); } else { status = f_string_dynamic_terminate_after(&setting.path_control); if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); } } } } else { if (main->warning.verbosity == f_console_verbosity_debug) { - fprintf(main->warning.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->warning.to.stream, "%s%sThe parameter '", main->warning.context.before->string, main->warning.prefix ? main->warning.prefix : f_string_empty_s); - fprintf(main->warning.to.stream, "%s%s%s%s%s", main->warning.context.after->string, main->warning.notable.before->string, f_console_symbol_long_enable_s, controller_long_control, main->warning.notable.after->string); - fprintf(main->warning.to.stream, "%s' must be a file directory path but instead is an empty string, falling back to the default.%s%c", main->warning.context.before->string, main->warning.context.after->string, f_string_eol_s[0]); + flockfile(main->warning.to.stream); + + fl_print_string("%c%[%SThe parameter '%]", main->warning.to.stream, f_string_eol_s[0], main->warning.context, main->warning.prefix ? main->warning.prefix : f_string_empty_s, main->warning.context); + fl_print_string("%[%s%s%]", main->warning.to.stream, main->context.notable, f_console_symbol_long_enable_s, controller_long_control, main->context.notable); + fl_print_string("%[' must be a file directory path but instead is an empty string, falling back to the default.%]%c", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s[0]); + + funlockfile(main->warning.to.stream); } } } @@ -306,12 +315,14 @@ extern "C" { if (main->parameters[controller_parameter_daemon].result == f_console_result_found) { if (main->parameters[controller_parameter_validate].result == f_console_result_found) { if (main->error.verbosity != f_console_verbosity_quiet) { - fprintf(main->error.to.stream, "%c", f_string_eol_s[0]); - fprintf(main->error.to.stream, "%s%sThe parameter '", main->error.context.before->string, main->error.prefix ? main->error.prefix : f_string_empty_s); - fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_validate, main->error.notable.after->string); - fprintf(main->error.to.stream, "%s' must not be specified with the parameter '", main->error.context.before->string); - fprintf(main->error.to.stream, "%s%s%s%s%s", main->error.context.after->string, main->error.notable.before->string, f_console_symbol_long_enable_s, controller_long_daemon, main->error.notable.after->string); - fprintf(main->error.to.stream, "%s'.%s%c", main->error.context.before->string, main->error.context.after->string, f_string_eol_s[0]); + flockfile(main->error.to.stream); + + fl_print_string("%c%[%SThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix ? main->error.prefix : f_string_empty_s, main->error.context); + fl_print_string("%[' must not be specified with the parameter '%]", main->error.to.stream, main->error.context, main->error.context); + fl_print_string("%[%s%s%]", main->error.to.stream, main->context.notable, f_console_symbol_long_enable_s, controller_long_daemon, main->context.notable); + fl_print_string("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]); + + funlockfile(main->error.to.stream); } status = F_status_set_error(F_parameter); @@ -342,25 +353,19 @@ extern "C" { } if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true); } else { status = f_string_append_assure(f_path_separator, 1, &setting.path_control); if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true); } else { status = f_string_dynamic_terminate_after(&setting.path_control); if (F_status_is_error(status)) { - if (main->error.verbosity != f_console_verbosity_quiet) { - fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); - } + fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true); } } } diff --git a/level_3/controller/c/controller.h b/level_3/controller/c/controller.h index f127f41..8bd28f8 100644 --- a/level_3/controller/c/controller.h +++ b/level_3/controller/c/controller.h @@ -65,6 +65,7 @@ #include #include #include +#include #include // fll-2 includes @@ -76,6 +77,7 @@ #include #include #include +#include #include #ifdef __cplusplus diff --git a/level_3/controller/c/private-common.c b/level_3/controller/c/private-common.c index 8f744e7..271fc31 100644 --- a/level_3/controller/c/private-common.c +++ b/level_3/controller/c/private-common.c @@ -200,10 +200,14 @@ extern "C" { if (thread) f_thread_mutex_lock(&thread->lock.print); - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sThe pid file '", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, path, print.notable.after->string); - fprintf(print.to.stream, "%s' doesn't contain the expected number, not deleting file.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe pid file '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix ? print.prefix : f_string_empty_s, print.context); + fl_print_string("%[' must not be specified with the parameter '%]", print.to.stream, print.context, print.context); + fl_print_string("%[%S%]", print.to.stream, print.notable, path, print.notable); + fl_print_string("%[' doesn't contain the expected number, not deleting file.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); if (thread) controller_print_unlock_flush(print.to.stream, &thread->lock.print); } @@ -304,25 +308,32 @@ extern "C" { if (print.verbosity != f_console_verbosity_quiet) { f_thread_mutex_lock(&thread->lock.print); - fprintf(print.to.stream, "%c", f_string_eol_s[0]); - fprintf(print.to.stream, "%s%sCritical failure while attempting to establish ", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s); - fprintf(print.to.stream, "%s%s%s lock%s", print.context.after->string, print.notable.before->string, read ? "read" : "write", print.notable.after->string); + flockfile(print.to.stream); + + fl_print_string("%c%[%SThe pid file '%]", print.to.stream, f_string_eol_s[0], print.context, print.prefix ? print.prefix : f_string_empty_s, print.context); + fl_print_string("%['Critical failure while attempting to establish '%]", print.to.stream, print.context, print.context); + fl_print_string("%[%s lock%]", print.to.stream, print.notable, read ? "read" : "write", print.notable); if (status != F_failure) { - fprintf(print.to.stream, "%s' due to %s", print.context.before->string, print.context.after->string); + fl_print_string(" %['due to%] ", print.to.stream, print.context, print.context); if (status == F_parameter) { - fprintf(print.to.stream, "%s%s%s", print.notable.before->string, "Invalid Parameter", print.notable.after->string); + fl_print_string("%[%s%]", print.to.stream, print.notable, "Invalid Parameter", print.notable); } else if (status == F_deadlock) { - fprintf(print.to.stream, "%s%s%s", print.notable.before->string, "Deadlock", print.notable.after->string); + fl_print_string("%[%s%]", print.to.stream, print.notable, "Deadlock", print.notable); } else if (status == F_resource_not) { - fprintf(print.to.stream, "%s%s%s", print.notable.before->string, "Too Many Locks", print.notable.after->string); + fl_print_string("%[%s%]", print.to.stream, print.notable, "Too Many Locks", print.notable); + } + else { + fl_print_string("%[%s%]", print.to.stream, print.notable, "Unknown Error", print.notable); } } - fprintf(print.to.stream, "%s.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); + fl_print_string("%['.%]%c", print.to.stream, print.context, print.context, f_string_eol_s[0]); + + funlockfile(print.to.stream); controller_print_unlock_flush(print.to.stream, &thread->lock.print); } diff --git a/level_3/controller/c/private-common.h b/level_3/controller/c/private-common.h index 695943b..4725868 100644 --- a/level_3/controller/c/private-common.h +++ b/level_3/controller/c/private-common.h @@ -1649,8 +1649,8 @@ extern "C" { * @return * F_none on success. * - * Errors (with error bit) from f_thread_lock_delete(). - * Errors (with error bit) from f_thread_mutex_delete(). + * Errors (with error bit) from: f_thread_lock_delete(). + * Errors (with error bit) from: f_thread_mutex_delete(). * * @see f_thread_lock_delete() * @see f_thread_mutex_delete() @@ -1955,7 +1955,7 @@ extern "C" { * F_none on success. * F_signal on success and signal found. * - * Success from f_thread_condition_wait_timed(). + * Success from: f_thread_condition_wait_timed(). * * Errors (with error bit) from: f_thread_condition_wait_timed(). * diff --git a/level_3/controller/c/private-controller.c b/level_3/controller/c/private-controller.c index 9d4345a..c965ccd 100644 --- a/level_3/controller/c/private-controller.c +++ b/level_3/controller/c/private-controller.c @@ -570,7 +570,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe %s item named '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, entry->items.array[i].name.string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, entry->items.array[i].name.string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' cannot be executed because recursion is not allowed.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); controller_entry_error_print_cache(is_entry, global.main->error, cache->action); @@ -633,7 +637,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe %s item named '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, actions->array[cache->ats.array[at_j]].parameters.array[0].string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, actions->array[cache->ats.array[at_j]].parameters.array[0].string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' does not exist.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); controller_entry_error_print_cache(is_entry, global.main->error, cache->action); @@ -759,7 +767,11 @@ extern "C" { fprintf(global->main->output.stream, "%c", f_string_eol_s[0]); fprintf(global->main->output.stream, "Processing %s%s item '", (failsafe ? "failsafe " : ""), is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global->main->output.stream, "%s%s%s", global->main->context.set.title.before->string, cache->action.name_item.string, global->main->context.set.title.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, cache->action.name_item.string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global->main->output.stream, "'.%c", f_string_eol_s[0]); controller_print_unlock_flush(global->main->output.stream, &global->thread->lock.print); diff --git a/level_3/controller/c/private-entry.c b/level_3/controller/c/private-entry.c index 827b272..e565d00 100644 --- a/level_3/controller/c/private-entry.c +++ b/level_3/controller/c/private-entry.c @@ -15,7 +15,8 @@ extern "C" { for (;;) { - f_print_dynamic(stream, action.parameters.array[index]); + // @fixme there needs to be a dynamic string equivalent of: f_print_safely_terminated(). + fll_print_dynamic(stream, action.parameters.array[index]); ++index; @@ -331,7 +332,7 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug) { fprintf(global.main->warning.to.stream, "%s%sUnknown %s item action '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); - f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fll_print_dynamic(global.main->warning.to.stream, cache->action.name_action); // @todo needs a f_print_safely_terminated(). fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); @@ -373,7 +374,11 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet) { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe %s item action '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, cache->action.name_action.string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, cache->action.name_action.string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' requires ", global.main->error.context.before->string); if (at_least == at_most) { @@ -519,7 +524,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe %s item action second parameter '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[1].string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, action->parameters.array[1].string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' must be a base path name, such as '", global.main->error.context.before->string); fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, cache->buffer_path.string, global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -575,7 +584,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%s', or '", global.main->error.context.before->string); fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_wait_s, global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' but instead has '", global.main->error.context.before->string); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[j].string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, action->parameters.array[j].string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } @@ -624,7 +637,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%s', or '", global.main->error.context.before->string); fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_stop_s, global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' but instead has '", global.main->error.context.before->string); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[0].string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, action->parameters.array[0].string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } @@ -654,7 +671,11 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet) { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe %s item action parameter '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[1].string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, action->parameters.array[1].string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' is not a valid supported number.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } @@ -673,7 +694,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%s%sThe %s item action may only have '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, controller_string_wait_s, global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' but instead has '", global.main->error.context.before->string); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[0].string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, action->parameters.array[0].string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } } @@ -715,7 +740,11 @@ extern "C" { if (cache.name_action.used) { fprintf(print.to.stream, "action '"); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, cache.name_action.string, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, cache.name_action.string); + fprintf(print.to.stream, "%s", print.notable.after->string); + fprintf(print.to.stream, "%s' on line ", print.context.before->string); fprintf(print.to.stream, "%s%s%llu%s", print.context.after->string, print.notable.before->string, cache.line_action, print.notable.after->string); fprintf(print.to.stream, "%s for ", print.context.before->string); @@ -723,7 +752,11 @@ extern "C" { if (cache.name_item.used) { fprintf(print.to.stream, "%s item '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, cache.name_item.string, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, cache.name_item.string); + fprintf(print.to.stream, "%s", print.notable.after->string); + fprintf(print.to.stream, "%s' on line ", print.context.before->string); fprintf(print.to.stream, "%s%s%llu%s", print.context.after->string, print.notable.before->string, cache.line_item, print.notable.after->string); fprintf(print.to.stream, "%s for ", print.context.before->string); @@ -731,7 +764,11 @@ extern "C" { if (cache.name_file.used) { fprintf(print.to.stream, "%s file '", is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, cache.name_file.string, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, cache.name_file.string); + fprintf(print.to.stream, "%s", print.notable.after->string); + fprintf(print.to.stream, "%s'.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } } @@ -920,7 +957,11 @@ extern "C" { fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->warning.to.stream, "%s%sIgnoring duplicate %s item '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->warning.to.stream, "%s%s%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string, cache->action.name_file.string, global.main->warning.notable.after->string); + + fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, cache->action.name_file.string); + fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); + fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); controller_entry_error_print_cache(is_entry, global.main->warning, cache->action); @@ -1064,7 +1105,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe required %s item '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, action->parameters.array[0].string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, action->parameters.array[0].string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' does not exist.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); controller_entry_error_print_cache(is_entry, global.main->error, cache->action); @@ -1157,7 +1202,11 @@ extern "C" { if (global.main->error.verbosity != f_console_verbosity_quiet) { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe %s item setting '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); - fprintf(global.main->error.to.stream, "%s%s%s%s", global.main->error.context.after->string, global.main->error.notable.before->string, cache->action.name_action.string, global.main->error.notable.after->string); + + fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); + f_print_safely_terminated(global.main->error.to.stream, cache->action.name_action.string); + fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); + fprintf(global.main->error.to.stream, "%s' requires exactly ", global.main->error.context.before->string); fprintf(global.main->error.to.stream, "%s%s%d%s", global.main->error.context.after->string, global.main->error.notable.before->string, 1, global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s parameter.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -1176,10 +1225,10 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug) { fprintf(global.main->warning.to.stream, "%s%sUnknown %s item setting value '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); - f_print_dynamic_partial(global.main->warning.to.stream, cache->buffer_file, cache->content_actions.array[i].array[0]); + fll_print_dynamic_partial(global.main->warning.to.stream, cache->buffer_file, cache->content_actions.array[i].array[0]); fprintf(global.main->warning.to.stream, "%s%s for %s item setting '", global.main->warning.notable.after->string, global.main->warning.context.before->string, is_entry ? controller_string_entry_s : controller_string_exit_s); fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); - f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fll_print_dynamic(global.main->warning.to.stream, cache->action.name_action); // @todo needs safe print dynamic fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); @@ -1193,7 +1242,7 @@ extern "C" { if (global.main->warning.verbosity == f_console_verbosity_debug) { fprintf(global.main->warning.to.stream, "%s%sUnknown %s item setting '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s, is_entry ? controller_string_entry_s : controller_string_exit_s); fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); - f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fll_print_dynamic(global.main->warning.to.stream, cache->action.name_action); // @todo needs safe print dynamic fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); diff --git a/level_3/controller/c/private-rule.c b/level_3/controller/c/private-rule.c index 598a816..977d784 100644 --- a/level_3/controller/c/private-rule.c +++ b/level_3/controller/c/private-rule.c @@ -689,7 +689,7 @@ extern "C" { if (cache.name_action.used) { fprintf(output.to.stream, "%s '", item ? "action" : "value"); fprintf(output.to.stream, "%s%s", output.context.after->string, output.notable.before->string); - f_print_dynamic(output.to.stream, cache.name_action); + fll_print_dynamic(output.to.stream, cache.name_action); // @todo safe dynamic print fprintf(output.to.stream, "%s%s' on line ", output.notable.after->string, output.context.before->string); fprintf(output.to.stream, "%s%s%llu%s", output.context.after->string, output.notable.before->string, cache.line_action, output.notable.after->string); fprintf(output.to.stream, "%s for ", output.context.before->string); @@ -698,7 +698,7 @@ extern "C" { if (cache.name_item.used) { fprintf(output.to.stream, "rule %s '", item ? "item" : "setting"); fprintf(output.to.stream, "%s%s", output.context.after->string, output.notable.before->string); - f_print_dynamic(output.to.stream, cache.name_item); + fll_print_dynamic(output.to.stream, cache.name_item); // @todo safe dynamic print fprintf(output.to.stream, "%s%s' on line ", output.notable.after->string, output.context.before->string); fprintf(output.to.stream, "%s%s%llu%s", output.context.after->string, output.notable.before->string, cache.line_item, output.notable.after->string); fprintf(output.to.stream, "%s for ", output.context.before->string); @@ -707,7 +707,7 @@ extern "C" { if (cache.name_file.used) { fprintf(output.to.stream, "rule file '"); fprintf(output.to.stream, "%s%s", output.context.after->string, output.notable.before->string); - f_print_dynamic(output.to.stream, cache.name_file); + fll_print_dynamic(output.to.stream, cache.name_file); // @todo safe dynamic print fprintf(output.to.stream, "%s'.%s%c", output.context.before->string, output.context.after->string, f_string_eol_s[0]); } } @@ -733,7 +733,10 @@ extern "C" { if (print.verbosity != f_console_verbosity_quiet) { fprintf(print.to.stream, "%c", f_string_eol_s[0]); fprintf(print.to.stream, "%s%sThe %s '", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s, script_is ? controller_string_script_s : controller_string_program_s); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name ? name : f_string_empty_s, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, name); + fprintf(print.to.stream, "%s", print.notable.after->string); if (status == F_control_group || status == F_limit || status == F_processor || status == F_schedule) { fprintf(print.to.stream, "%s' failed due to a failure to setup the '", print.context.before->string); @@ -773,7 +776,11 @@ extern "C" { if (print.verbosity != f_console_verbosity_quiet) { fprintf(print.to.stream, "%c", f_string_eol_s[0]); fprintf(print.to.stream, "%s%sThe %s '", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s, script_is ? controller_string_script_s : controller_string_program_s); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, name ? name : f_string_empty_s, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, name); + fprintf(print.to.stream, "%s", print.notable.after->string); + fprintf(print.to.stream, "%s' could not be executed because it was not found.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } } @@ -785,7 +792,11 @@ extern "C" { if (print.verbosity != f_console_verbosity_quiet) { fprintf(print.to.stream, "%c", f_string_eol_s[0]); fprintf(print.to.stream, "%s%sThe %s rule '", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s, need_want_wish); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, value, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, value); + fprintf(print.to.stream, "%s", print.notable.after->string); + fprintf(print.to.stream, "%s' %s.%s%c", print.context.before->string, why, print.context.after->string, f_string_eol_s[0]); } } @@ -797,7 +808,11 @@ extern "C" { if (print.verbosity != f_console_verbosity_quiet) { fprintf(print.to.stream, "%c", f_string_eol_s[0]); fprintf(print.to.stream, "%s%sThe rule '", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, alias, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, alias); + fprintf(print.to.stream, "%s", print.notable.after->string); + fprintf(print.to.stream, "%s' is no longer loaded.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } } @@ -809,7 +824,11 @@ extern "C" { if (print.verbosity != f_console_verbosity_quiet) { fprintf(print.to.stream, "%c", f_string_eol_s[0]); fprintf(print.to.stream, "%s%sThe rule '", print.context.before->string, print.prefix ? print.prefix : f_string_empty_s); - fprintf(print.to.stream, "%s%s%s%s", print.context.after->string, print.notable.before->string, alias, print.notable.after->string); + + fprintf(print.to.stream, "%s%s", print.context.after->string, print.notable.before->string); + f_print_safely_terminated(print.to.stream, alias); + fprintf(print.to.stream, "%s", print.notable.after->string); + fprintf(print.to.stream, "%s' is not designating a pid file.%s%c", print.context.before->string, print.context.after->string, f_string_eol_s[0]); } } @@ -1142,15 +1161,24 @@ extern "C" { fprintf(global.main->output.stream, "%c", f_string_eol_s[0]); fprintf(global.main->output.stream, "Simulating execution of '"); - fprintf(global.main->output.stream, "%s%s%s", global.main->context.title.string, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s, global.main->context.reset.string); - fprintf(global.main->output.stream, "' with the arguments: '%s", global.main->context.important.string); + + fprintf(global.main->output.stream, "%s", global.main->context.title.string); + f_print_safely_terminated(global.main->output.stream, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s); + fprintf(global.main->output.stream, "%s' with the arguments: '%s", global.main->context.reset.string, global.main->context.important.string); for (f_array_length_t i = program ? 0 : 1; i < arguments.used; ++i) { - fprintf(global.main->output.stream, "%s%s", (program && i || !program && i > 1) ? f_string_space_s : "", arguments.array[i].string); + + if (program && i || !program && i > 1) { + fprintf(global.main->output.stream, "%c", f_string_space_s[0]); + } + + f_print_safely_terminated(global.main->output.stream, arguments.array[i].string); } // for fprintf(global.main->output.stream, "%s' from '", global.main->context.reset.string); - fprintf(global.main->output.stream, "%s%s%s", global.main->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, global.main->context.reset.string); + + fprintf(global.main->output.stream, "%s", global.main->context.notable.string); + f_print_safely_terminated(global.main->output.stream, process->rule.name.used ? process->rule.name.string : f_string_empty_s); fprintf(global.main->output.stream, "%s'.%c", global.main->context.reset.string, f_string_eol_s[0]); controller_print_unlock_flush(global.main->output.stream, &global.thread->lock.print); @@ -1385,15 +1413,24 @@ extern "C" { fprintf(global.main->output.stream, "%c", f_string_eol_s[0]); fprintf(global.main->output.stream, "Simulating execution of '"); - fprintf(global.main->output.stream, "%s%s%s", global.main->context.title.string, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s, global.main->context.reset.string); - fprintf(global.main->output.stream, "' with the arguments: '%s", global.main->context.important.string); + + fprintf(global.main->output.stream, "%s", global.main->context.title.string); + f_print_safely_terminated(global.main->output.stream, program ? program : arguments.used && arguments.array[0].used ? arguments.array[0].string : f_string_empty_s); + fprintf(global.main->output.stream, "%s' with the arguments: '%s", global.main->context.reset.string, global.main->context.important.string); for (f_array_length_t i = program ? 0 : 1; i < arguments.used; ++i) { - fprintf(global.main->output.stream, "%s%s", (program && i || !program && i > 1) ? f_string_space_s : "", arguments.array[i].string); + + if (program && i || !program && i > 1) { + fprintf(global.main->output.stream, "%c", f_string_space_s[0]); + } + + f_print_safely_terminated(global.main->output.stream, arguments.array[i].string); } // for fprintf(global.main->output.stream, "%s' from '", global.main->context.reset.string); - fprintf(global.main->output.stream, "%s%s%s", global.main->context.notable.string, process->rule.name.used ? process->rule.name.string : f_string_empty_s, global.main->context.reset.string); + + fprintf(global.main->output.stream, "%s", global.main->context.notable.string); + f_print_safely_terminated(global.main->output.stream, process->rule.name.used ? process->rule.name.string : f_string_empty_s); fprintf(global.main->output.stream, "%s'.%c", global.main->context.reset.string, f_string_eol_s[0]); controller_print_unlock_flush(global.main->output.stream, &global.thread->lock.print); @@ -1713,7 +1750,7 @@ extern "C" { fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->warning.to.stream, "%s%sUnknown rule item action '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s); fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); - f_print_dynamic(global.main->warning.to.stream, cache->action.name_action); + fll_print_dynamic(global.main->warning.to.stream, cache->action.name_action); fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); @@ -1734,7 +1771,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sFSS Extended List is not allowed for the rule item action '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic(global.main->error.to.stream, cache->action.name_action); + fll_print_dynamic(global.main->error.to.stream, cache->action.name_action); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -3186,7 +3223,7 @@ extern "C" { fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->warning.to.stream, "%s%sUnknown rule item '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s); fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); - f_print_dynamic(global.main->warning.to.stream, cache->action.name_item); + fll_print_dynamic(global.main->warning.to.stream, cache->action.name_item); fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); @@ -3380,7 +3417,7 @@ extern "C" { fprintf(global.main->warning.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->warning.to.stream, "%s%sUnknown rule setting '", global.main->warning.context.before->string, global.main->warning.prefix ? global.main->warning.prefix : f_string_empty_s); fprintf(global.main->warning.to.stream, "%s%s", global.main->warning.context.after->string, global.main->warning.notable.before->string); - f_print_dynamic(global.main->warning.to.stream, cache->action.name_item); + fll_print_dynamic(global.main->warning.to.stream, cache->action.name_item); fprintf(global.main->warning.to.stream, "%s", global.main->warning.notable.after->string); fprintf(global.main->warning.to.stream, "%s'.%s%c", global.main->warning.context.before->string, global.main->warning.context.after->string, f_string_eol_s[0]); @@ -3529,7 +3566,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an unsupported number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); fprintf(global.main->error.to.stream, "%s%s', the number is too large for this system.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); @@ -3540,7 +3577,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); fprintf(global.main->error.to.stream, "%s%s', only whole numbers are allowed for an affinity value.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); controller_print_unlock_flush(global.main->error.to.stream, &global.thread->lock.print); @@ -3746,7 +3783,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an unknown option '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); fprintf(global.main->error.to.stream, "%s%s'.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. @@ -3909,7 +3946,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sUnknown resource limit type '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic(global.main->error.to.stream, cache->action.name_action); + fll_print_dynamic(global.main->error.to.stream, cache->action.name_action); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4005,14 +4042,14 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an unsupported number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); fprintf(global.main->error.to.stream, "%s%s', the number is too large for this system.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } else { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); fprintf(global.main->error.to.stream, "%s%s', only whole numbers are allowed for a resource limit value.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); } @@ -4136,7 +4173,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid name '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic(global.main->error.to.stream, *setting_value); + fll_print_dynamic(global.main->error.to.stream, *setting_value); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s', there must be at least 1 graph character.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4281,7 +4318,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an unknown scheduler '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); fprintf(global.main->error.to.stream, "%s%s'.%s%c", global.main->error.notable.after->string, global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); // get the current line number within the settings item. @@ -4320,7 +4357,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); if (zero_only) { fprintf(global.main->error.to.stream, "%s%s', only ", global.main->error.notable.after->string, global.main->error.context.before->string); @@ -4519,7 +4556,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid number '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); fprintf(global.main->error.to.stream, "%s%s', only the whole numbers inclusively between ", global.main->error.notable.after->string, global.main->error.context.before->string); fprintf(global.main->error.to.stream, "%s%s-20%s", global.main->error.context.after->string, global.main->error.notable.before->string, global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s and ", global.main->error.context.before->string); @@ -4570,7 +4607,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid user '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' because no user was found by that name.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4584,7 +4621,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid user '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' because the given ID is too large.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4598,7 +4635,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid user '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[0]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4699,7 +4736,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid group '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' because no group was found by that name.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4713,7 +4750,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid group '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' because the given ID is too large.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4727,7 +4764,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting has an invalid group '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[j]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' because the given ID is not a valid supported number.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -4951,7 +4988,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting's first value has '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' but only supports %s, %s, %s, %s, %s", global.main->error.context.before->string, controller_string_freeze_s, controller_string_kill_s, controller_string_pause_s, controller_string_reload_s, controller_string_restart_s); fprintf(global.main->error.to.stream, "%s, %s, %s, and %s.%s%c", controller_string_resume_s, controller_string_start_s, controller_string_stop_s, controller_string_thaw_s, global.main->error.context.after->string, f_string_eol_s[0]); @@ -5002,7 +5039,7 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sRule setting's second value has '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[1]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' but only supports %s, %s, and %s.%s%c", global.main->error.context.before->string, controller_string_need_s, controller_string_want_s, controller_string_wish_s, global.main->error.context.after->string, f_string_eol_s[0]); @@ -5106,11 +5143,11 @@ extern "C" { fprintf(global.main->error.to.stream, "%c", f_string_eol_s[0]); fprintf(global.main->error.to.stream, "%s%sThe rule item action third parameter '", global.main->error.context.before->string, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[2]); + fll_print_dynamic_partial(global.main->error.to.stream, cache->buffer_item, cache->content_actions.array[i].array[2]); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s' must be a base path name, such as %llu '", global.main->error.context.before->string, cache->buffer_path.used); fprintf(global.main->error.to.stream, "%s%s", global.main->error.context.after->string, global.main->error.notable.before->string); - f_print_dynamic(global.main->error.to.stream, cache->buffer_path); + fll_print_dynamic(global.main->error.to.stream, cache->buffer_path); fprintf(global.main->error.to.stream, "%s", global.main->error.notable.after->string); fprintf(global.main->error.to.stream, "%s'.%s%c", global.main->error.context.before->string, global.main->error.context.after->string, f_string_eol_s[0]); @@ -5243,7 +5280,7 @@ extern "C" { if (rule.control_group.groups.array[i].used) { fprintf(main->output.stream, "%s", f_string_space_s); - f_print_dynamic(main->output.stream, rule.control_group.groups.array[i]); + fll_print_dynamic(main->output.stream, rule.control_group.groups.array[i]); } } // for } diff --git a/level_3/controller/c/private-thread.h b/level_3/controller/c/private-thread.h index 5ccc921..aa2f88a 100644 --- a/level_3/controller/c/private-thread.h +++ b/level_3/controller/c/private-thread.h @@ -239,7 +239,7 @@ extern "C" { * @return * F_none on success. * - * Success from f_thread_join(). + * Success from: f_thread_join(). * * Errors (with error bit) from: f_thread_join(). * diff --git a/level_3/controller/data/build/dependencies b/level_3/controller/data/build/dependencies index 6e62175..1c830fe 100644 --- a/level_3/controller/data/build/dependencies +++ b/level_3/controller/data/build/dependencies @@ -29,10 +29,12 @@ fl_conversion fl_environment fl_fss fl_iki +fl_print fl_string fll_control_group fll_error fll_execute fll_fss fll_path +fll_print fll_program diff --git a/level_3/controller/data/build/settings b/level_3/controller/data/build/settings index 252d504..2063574 100644 --- a/level_3/controller/data/build/settings +++ b/level_3/controller/data/build/settings @@ -20,7 +20,7 @@ build_compiler gcc build_indexer ar build_language c build_libraries -lc -lcap -build_libraries-individual -lfll_control_group -lfll_error -lfll_execute -lfll_fss -lfll_path -lfll_program -lfl_console -lfl_control_group -lfl_conversion -lfl_directory -lfl_environment -lfl_fss -lfl_iki -lfl_status -lfl_string -lf_account -lf_capability -lf_color -lf_console -lf_control_group -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_iki -lf_limit -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_string -lf_thread -lf_type_array -lf_utf +build_libraries-individual -lfll_control_group -lfll_error -lfll_execute -lfll_fss -lfll_path -lfll_print -lfll_program -lfl_console -lfl_control_group -lfl_conversion -lfl_directory -lfl_environment -lfl_fss -lfl_iki -lfl_print -lfl_status -lfl_string -lf_account -lf_capability -lf_color -lf_console -lf_control_group -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_iki -lf_limit -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_string -lf_thread -lf_type_array -lf_utf build_libraries-level -lfll_2 -lfll_1 -lfll_0 build_libraries-monolithic -lfll build_sources_library controller.c private-common.c private-control.c private-controller.c private-entry.c private-rule.c private-thread.c @@ -52,7 +52,7 @@ defines_all -D_libcap_legacy_only_ -D_pthread_attr_unsupported_ -D_pthread_sigqu defines_static defines_shared -flags_all -z now -g -fdiagnostics-color=always -pthread -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses +flags_all -O2 -z now -g -fdiagnostics-color=always -pthread -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses flags_shared flags_static flags_library -fPIC