From: Kevin Day Date: Thu, 24 Sep 2020 04:30:16 +0000 (-0500) Subject: Progress: print function changes. X-Git-Tag: 0.5.1~64 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=c81a71efdd4b9d1a93c8409fb7858b1cdaa4440c;p=fll Progress: print function changes. After getting byte_dump switched to file descriptors and testing it, I discovered that the unbuffered write has massive performance issues over the buffer writer that is a file stream. Do some back pedalling and then go down a different route. Add functions for managing file streams. Make it possible to have both the descriptor and the stream to give more control at the higher level on when to decide which to use. There is still much more cleanup, back-pedalling, as well as redesigning the code to (now) use fprintf() over printf() and similar. --- diff --git a/level_0/f_file/c/file-common.h b/level_0/f_file/c/file-common.h index 5fd135a..c7ef2b7 100644 --- a/level_0/f_file/c/file-common.h +++ b/level_0/f_file/c/file-common.h @@ -89,6 +89,7 @@ extern "C" { /** * Commonly used file related properties. * + * stream: File stream. * id: File descriptor, with a value of -1 represents a closed file. * flag: Flags used for opening the file. * size_read: The default number of 1-byte characters to read at a time and is often used for the read buffer size. @@ -96,21 +97,26 @@ extern "C" { */ #ifndef _di_f_file_t_ typedef struct { + FILE *stream; int id; int flag; size_t size_read; size_t size_write; } f_file_t; - #define f_file_t_initialize { -1, f_file_flag_read_only, f_file_default_read_size, f_file_default_write_size } + #define f_file_t_initialize { 0, -1, f_file_flag_read_only, f_file_default_read_size, f_file_default_write_size } + + #define f_macro_file_t_initialize(stream, id, flag) { stream, id, flag, f_file_default_read_size, f_file_default_write_size } #define f_macro_file_t_clear(file) \ + file.stream = 0; \ file.id = -1; \ file.flag = 0; \ file.size_read = 0; \ file.size_write = 0; #define f_macro_file_t_reset(file) \ + file.stream = 0; \ file.id = -1; \ file.flag = f_file_flag_read_only; \ file.size_read = f_file_default_read_size; \ diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index d830795..076a59a 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -299,6 +299,18 @@ extern "C" { } #endif // _di_f_file_create_node_at_ +#ifndef _di_f_file_descriptor_ + f_return_status f_file_descriptor(f_file_t *file) { + file->id = fileno(file->stream); + + if (file->id == -1) { + return F_status_set_error(F_file); + } + + return F_none; + } +#endif // _di_f_file_descriptor_ + #ifndef _di_f_file_exists_ f_return_status f_file_exists(const f_string_t path) { #ifndef _di_level_0_parameter_checking_ @@ -1857,6 +1869,147 @@ extern "C" { } #endif // _di_f_file_stat_by_id_ +#ifndef _di_f_file_stream_close_ + f_return_status f_file_stream_close(const bool complete, f_file_t *file) { + #ifndef _di_level_0_parameter_checking_ + if (!file) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!fclose(file->stream)) { + if (errno == EACCES) return F_status_set_error(F_access_denied); + if (errno == EAGAIN) return F_status_set_error(F_prohibited); + if (errno == EBADF) return F_status_set_error(F_file_descriptor); + if (errno == EDEADLK) return F_status_set_error(F_deadlock); + if (errno == EFAULT) return F_status_set_error(F_buffer); + if (errno == EINTR) return F_status_set_error(F_interrupted); + if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EMFILE) return F_status_set_error(F_file_descriptor_max); + if (errno == ENOLCK) return F_status_set_error(F_lock); + if (errno == ENOTDIR) return F_status_set_error(F_file_type_not_directory); + if (errno == EPERM) return F_status_set_error(F_prohibited); + + return F_status_set_error(F_failure); + } + + file->stream = 0; + + if (complete) { + return private_f_file_close(&file->id); + } + + return F_none; + } +#endif // _di_f_file_stream_close_ + +#ifndef _di_f_file_stream_descriptor_ + f_return_status f_file_stream_descriptor(const int id, const f_string_t mode, FILE *stream) { + #ifndef _di_level_0_parameter_checking_ + if (id == -1) return F_status_set_error(F_parameter); + if (!mode) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + stream = fdopen(id, mode); + + if (!stream) { + if (errno == EACCES) return F_status_set_error(F_access_denied); + if (errno == EAGAIN) return F_status_set_error(F_prohibited); + if (errno == EBADF) return F_status_set_error(F_file_descriptor); + if (errno == EDEADLK) return F_status_set_error(F_deadlock); + if (errno == EFAULT) return F_status_set_error(F_buffer); + if (errno == EINTR) return F_status_set_error(F_interrupted); + if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EMFILE) return F_status_set_error(F_file_descriptor_max); + if (errno == ENOLCK) return F_status_set_error(F_lock); + if (errno == ENOTDIR) return F_status_set_error(F_file_type_not_directory); + if (errno == EPERM) return F_status_set_error(F_prohibited); + + return F_status_set_error(F_failure); + } + + return F_none; + } +#endif // _di_f_file_stream_descriptor_ + + +#ifndef _di_f_file_stream_open_ + f_return_status f_file_stream_open(const f_string_t path, const f_string_t mode, f_file_t *file) { + #ifndef _di_level_0_parameter_checking_ + if (!path) return F_status_set_error(F_parameter); + if (!mode) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + file->stream = fopen(path, mode); + + if (!file->stream) { + if (errno == EACCES) return F_status_set_error(F_access_denied); + if (errno == EDQUOT) return F_status_set_error(F_filesystem_quota_block); + if (errno == EEXIST) return F_status_set_error(F_file_found); + if (errno == ENAMETOOLONG) return F_status_set_error(F_name); + if (errno == EFAULT) return F_status_set_error(F_buffer); + if (errno == EFBIG || errno == EOVERFLOW) return F_status_set_error(F_number_overflow); + if (errno == EINTR) return F_status_set_error(F_interrupted); + if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == ELOOP) return F_status_set_error(F_loop); + if (errno == ENFILE) return F_status_set_error(F_file_open_max); + if (errno == ENOENT) return F_status_set_error(F_file_found_not); + if (errno == ENOTDIR) return F_status_set_error(F_file_type_not_directory); + if (errno == ENOMEM) return F_status_set_error(F_memory_out); + if (errno == ENOSPC) return F_status_set_error(F_space_not); + if (errno == EPERM) return F_status_set_error(F_prohibited); + if (errno == EROFS) return F_status_set_error(F_read_only); + if (errno == ETXTBSY) return F_status_set_error(F_busy); + if (errno == EISDIR) return F_status_set_error(F_directory); + if (errno == EOPNOTSUPP) return F_status_set_error(F_unsupported); + + return F_status_set_error(F_failure); + } + + file->id = fileno(file->stream); + + if (file->id == -1) { + return F_status_set_error(F_file_descriptor); + } + + return F_none; + } +#endif // _di_f_file_stream_open_ + +#ifndef _di_f_file_stream_reopen_ + f_return_status f_file_stream_reopen(const f_string_t path, const f_string_t mode, f_file_t *file) { + #ifndef _di_level_0_parameter_checking_ + if (!path) return F_status_set_error(F_parameter); + if (!mode) return F_status_set_error(F_parameter); + if (!file) return F_status_set_error(F_parameter); + #endif // _di_level_0_parameter_checking_ + + if (!freopen(path, mode, file->stream)) { + if (errno == EACCES) return F_status_set_error(F_access_denied); + if (errno == EAGAIN) return F_status_set_error(F_prohibited); + if (errno == EBADF) return F_status_set_error(F_file_descriptor); + if (errno == EDEADLK) return F_status_set_error(F_deadlock); + if (errno == EFAULT) return F_status_set_error(F_buffer); + if (errno == EINTR) return F_status_set_error(F_interrupted); + if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EMFILE) return F_status_set_error(F_file_descriptor_max); + if (errno == ENOLCK) return F_status_set_error(F_lock); + if (errno == ENOTDIR) return F_status_set_error(F_file_type_not_directory); + if (errno == EPERM) return F_status_set_error(F_prohibited); + + return F_status_set_error(F_failure); + } + + file->id = fileno(file->stream); + + if (file->id == -1) { + return F_status_set_error(F_file_descriptor); + } + + return F_none; + } +#endif // _di_f_file_stream_reopen_ + #ifndef _di_f_file_touch_ f_return_status f_file_touch(const f_string_t path, const mode_t mode, const bool dereference) { #ifndef _di_level_0_parameter_checking_ diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index f77f49a..19f7771 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -484,6 +484,23 @@ extern "C" { #endif // _di_f_file_create_node_at_ /** + * Identify the file descriptor of a valid file stream. + * + * @param file + * The file stream to get descriptor of. + * + * @return + * F_none is returned on success. + * F_parameter (with error bit) if a parameter is invalid. + * F_file (with error bit) if file is not a valid stream. + * + * @see fileno() + */ +#ifndef _di_f_file_descriptor_ + extern f_return_status f_file_descriptor(f_file_t *file); +#endif // _di_f_file_descriptor_ + +/** * Identify whether or not a file exists at the given path. * * This does not require access on the file itself. @@ -1177,7 +1194,8 @@ extern "C" { /** * Open a particular file and save its stream. * - * This will open the file and obtain the file descriptor. + * This will open the file as a file descriptor. + * This does not open a file stream. * * @param path * The path file name. @@ -1189,11 +1207,24 @@ extern "C" { * This will be updated with the file descriptor. * * @return - * F_none on success. - * F_file_descriptor (with error bit) if unable to load the file descriptor (the file pointer may still be valid). + * F_none is returned on success. + * F_access_denied (with error bit) on access denied. + * F_buffer (with error bit) if the buffer is invalid. + * F_busy (with error bit) if filesystem is too busy to perform write. * F_file_found_not (with error bit) if the file was not found. - * F_file_open (with error bit) if the file is already open. + * F_file_open_max (with error bit) when system-wide max open files is reached. + * F_file_type_not_directory (with error bit) if F_NOTIFY was specified and file.id is not a directory. + * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. + * F_interrupted (with error bit) when program received an interrupt signal, halting operation. + * F_loop (with error bit) on loop error. + * F_memory_out (with error bit) if out of memory. + * F_name (with error bit) on path name is too long. + * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. + * F_prohibited (with error bit) if filesystem does not allow for making changes. + * F_read_only (with error bit) if file is read-only. + * F_unsupported (with error bit) fo unsupported file types. + * F_failure (with error bit) for any other error. * * @see open() */ @@ -1204,7 +1235,8 @@ extern "C" { /** * Open a particular file and save its stream. * - * This will open the file and obtain the file descriptor. + * This will open the file as a file descriptor. + * This does not open a file stream. * * @param at_id * The parent directory, as an open directory file descriptor, in which path is relative to. @@ -1774,6 +1806,158 @@ extern "C" { #endif // _di_f_file_stat_by_id_ /** + * Close an open file stream. + * + * @param complete + * When TRUE, will close the file descriptor as well, setting file.id is reset to -1, on success. + * When FALSE, will do nothing in regards to the file descriptor. + * @param file + * The file information. + * The file.stream is set to 0, on success. + * + * @return + * F_none is returned on success. + * F_access_denied (with error bit) on access denied. + * F_buffer (with error bit) if the buffer is invalid. + * F_deadlock (with error bit) if operation would cause a deadlock. + * F_file_close (with error bit) if fclose() failed for any other reason. + * F_file_descriptor (with error bit) if file descriptor is invalid. + * F_file_descriptor_max (with error bit) if max file descriptors was reached. + * F_file_synchronize (with error bit) on flush failure. + * F_file_type_not_directory (with error bit) if F_NOTIFY was specified and file.id is not a directory. + * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. + * F_input_output (with error bit) on I/O error. + * F_interrupted (with error bit) when program received an interrupt signal, halting operation. + * F_lock (with error bit) if failed to lock, such as lock table is full or too many open segments. + * F_parameter (with error bit) if a parameter is invalid. + * F_prohibited (with error bit) if filesystem does not allow for making changes. + * F_space_not (with error bit) if filesystem is out of space (or filesystem quota is reached). + * + * @see close() + * @see fclose() + */ +#ifndef _di_f_file_stream_close_ + extern f_return_status f_file_stream_close(const bool complete, f_file_t *file); +#endif // _di_f_file_stream_close_ + +/** + * Open a file stream from a file descriptor. + * + * @param id + * The file descriptor. + * @param mode + * The file modes do use when opening. + * This should match the modes used to open the file descriptor as it relates to the stream modes. + * @param stream + * The file stream. + * Updated on success, but may be set to NULL on error. + * + * @return + * F_none is returned on success. + * F_access_denied (with error bit) on access denied. + * F_buffer (with error bit) if the buffer is invalid. + * F_deadlock (with error bit) if operation would cause a deadlock. + * F_file_descriptor (with error bit) if file descriptor is invalid. + * F_file_descriptor_max (with error bit) if max file descriptors was reached. + * F_file_type_not_directory (with error bit) if F_NOTIFY was specified and file.id is not a directory. + * F_interrupted (with error bit) when program received an interrupt signal, halting operation. + * F_lock (with error bit) if failed to lock, such as lock table is full or too many open segments. + * F_parameter (with error bit) if a parameter is invalid. + * F_prohibited (with error bit) if filesystem does not allow for making changes. + * + * @see fdopen() + */ +#ifndef _di_f_file_stream_descriptor_ + extern f_return_status f_file_stream_descriptor(const int id, const f_string_t mode, FILE *stream); +#endif // _di_f_file_stream_descriptor_ + +/** + * Open a file stream. + * + * The file descriptor is retrieved on success, if necessary and able. + * + * @param path + * The file path + * @param mode + * The file modes do use when opening. + * @param file + * The file information. + * The file.stream is updated if necessary. + * The file.id is updated with the file descriptor, if necessary and able. + * + * @return + * F_none is returned on success. + * F_access_denied (with error bit) on access denied. + * F_buffer (with error bit) if the buffer is invalid. + * F_busy (with error bit) if filesystem is too busy to perform write. + * F_file_descriptor (with error bit) if unable to load the file descriptor. + * F_file_found_not (with error bit) if the file was not found. + * F_file_open_max (with error bit) when system-wide max open files is reached. + * F_file_type_not_directory (with error bit) if F_NOTIFY was specified and file.id is not a directory. + * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. + * F_interrupted (with error bit) when program received an interrupt signal, halting operation. + * F_loop (with error bit) on loop error. + * F_memory_out (with error bit) if out of memory. + * F_name (with error bit) on path name is too long. + * F_number_overflow (with error bit) on overflow error. + * F_parameter (with error bit) if a parameter is invalid. + * F_prohibited (with error bit) if filesystem does not allow for making changes. + * F_read_only (with error bit) if file is read-only. + * F_unsupported (with error bit) fo unsupported file types. + * F_failure (with error bit) for any other error. + * + * @see fileno() + * @see fopen() + */ +#ifndef _di_f_file_stream_open_ + extern f_return_status f_file_stream_open(const f_string_t path, const f_string_t mode, f_file_t *file); +#endif // _di_f_file_stream_open_ + +/** + * Re-open a file stream. + * + * This allows for re-using an existing file stream and possibly file-descriptor. + * + * The file descriptor is retrieved on success, if necessary and able. + * + * @param path + * The file path + * @param mode + * The file modes do use when opening. + * @param file + * The file information. + * The file.stream is updated, if necessary. + * The file.id is updated with the file descriptor, if necessary and able. + * + * @return + * F_none is returned on success. + * F_access_denied (with error bit) on access denied. + * F_buffer (with error bit) if the buffer is invalid. + * F_busy (with error bit) if filesystem is too busy to perform write. + * F_file_descriptor (with error bit) if unable to load the file descriptor. + * F_file_found_not (with error bit) if the file was not found. + * F_file_open_max (with error bit) when system-wide max open files is reached. + * F_file_type_not_directory (with error bit) if F_NOTIFY was specified and file.id is not a directory. + * F_filesystem_quota_block (with error bit) if filesystem's disk blocks or inodes are exhausted. + * F_interrupted (with error bit) when program received an interrupt signal, halting operation. + * F_loop (with error bit) on loop error. + * F_memory_out (with error bit) if out of memory. + * F_name (with error bit) on path name is too long. + * F_number_overflow (with error bit) on overflow error. + * F_parameter (with error bit) if a parameter is invalid. + * F_prohibited (with error bit) if filesystem does not allow for making changes. + * F_read_only (with error bit) if file is read-only. + * F_unsupported (with error bit) fo unsupported file types. + * F_failure (with error bit) for any other error. + * + * @see fileno() + * @see freopen() + */ +#ifndef _di_f_file_stream_reopen_ + extern f_return_status f_file_stream_reopen(const f_string_t path, const f_string_t mode, f_file_t *file); +#endif // _di_f_file_stream_reopen_ + +/** * Update the files access and modification timestamp, creating the file if it does not already exist. * * When the file is created, it is created as a regular file. diff --git a/level_0/f_file/c/private-file.c b/level_0/f_file/c/private-file.c index 68342a8..860708b 100644 --- a/level_0/f_file/c/private-file.c +++ b/level_0/f_file/c/private-file.c @@ -5,7 +5,7 @@ extern "C" { #endif -#if !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) +#if !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_stream_close_) f_return_status private_f_file_close(int *id) { if (*id == -1) return F_none; @@ -25,7 +25,7 @@ extern "C" { *id = -1; return F_none; } -#endif // !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) +#endif // !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_stream_close_) #if !defined(_di_f_file_copy_) || !defined(_di_f_file_clone_) f_return_status private_f_file_copy_content(const f_string_t source, const f_string_t destination, const f_number_unsigned_t size_block) { diff --git a/level_0/f_file/c/private-file.h b/level_0/f_file/c/private-file.h index 0f33582..215e982 100644 --- a/level_0/f_file/c/private-file.h +++ b/level_0/f_file/c/private-file.h @@ -36,10 +36,11 @@ extern "C" { * * @see f_file_close() * @see f_file_copy() + * @see f_file_stream_close() */ -#if !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) +#if !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_stream_close_) extern f_return_status private_f_file_close(int *id) f_gcc_attribute_visibility_internal; -#endif // !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) +#endif // !defined(_di_f_file_close_) || !defined(_di_f_file_copy_) || !defined(_di_f_file_stream_close_) /** * Copy a file. diff --git a/level_0/f_status/c/status.h b/level_0/f_status/c/status.h index f8f180c..28990f6 100644 --- a/level_0/f_status/c/status.h +++ b/level_0/f_status/c/status.h @@ -152,6 +152,7 @@ extern "C" { F_connected, F_connected_not, F_critical, + F_deadlock, F_descriptor, F_device, F_dummy, @@ -170,6 +171,8 @@ extern "C" { F_invalid, F_output, F_link, + F_lock, + F_lock_not, F_loop, F_maybe, F_memory_out, diff --git a/level_1/fl_color/c/color.c b/level_1/fl_color/c/color.c index 619a25e..047a187 100644 --- a/level_1/fl_color/c/color.c +++ b/level_1/fl_color/c/color.c @@ -5,9 +5,9 @@ extern "C" { #endif #ifndef _di_fl_color_set_ - f_return_status fl_color_set(FILE *file, const f_color_format_t format, const int8_t *color1, const int8_t *color2, const int8_t *color3, const int8_t *color4, const int8_t *color5) { + f_return_status fl_color_set(FILE *stream, const f_color_format_t format, const int8_t *color1, const int8_t *color2, const int8_t *color3, const int8_t *color4, const int8_t *color5) { #ifndef _di_level_1_parameter_checking_ - if (!file) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); if (!color1) return F_status_set_error(F_parameter); // make sure all data is in the proper order @@ -16,11 +16,11 @@ extern "C" { if (!color4 && color5 != 0) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ - if (!color2) fprintf(file, "%s%s%s", format.begin, color1, format.end); - else if (!color3) fprintf(file, "%s%s%s%s%s", format.begin, color1, format.medium, color2, format.end); - else if (!color4) fprintf(file, "%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.end); - else if (!color5) fprintf(file, "%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.end); - else fprintf(file, "%s%s%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.medium, color5, format.end); + if (!color2) fprintf(stream, "%s%s%s", format.begin, color1, format.end); + else if (!color3) fprintf(stream, "%s%s%s%s%s", format.begin, color1, format.medium, color2, format.end); + else if (!color4) fprintf(stream, "%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.end); + else if (!color5) fprintf(stream, "%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.end); + else fprintf(stream, "%s%s%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.medium, color5, format.end); return F_none; } @@ -136,26 +136,26 @@ extern "C" { #endif // _di_fl_color_save_ #ifndef _di_fl_color_print_ - f_return_status fl_color_print(FILE *file, const f_color_set_t set, const f_string_t string, ...) { + f_return_status fl_color_print(FILE *stream, const f_color_set_t set, const f_string_t string, ...) { #ifndef _di_level_1_parameter_checking_ - if (!file) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (set.before) { - fprintf(file, "%s", set.before->string); + fprintf(stream, "%s", set.before->string); } va_list ap; va_start(ap, string); - vfprintf(file, string, ap); + vfprintf(stream, string, ap); va_end(ap); if (set.after) { - fprintf(file, "%s", set.after->string); + fprintf(stream, "%s", set.after->string); } return F_none; @@ -163,36 +163,36 @@ extern "C" { #endif // _di_fl_color_print_ #ifndef _di_fl_color_print2_ - f_return_status fl_color_print2(FILE *file, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...) { + f_return_status fl_color_print2(FILE *stream, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...) { #ifndef _di_level_1_parameter_checking_ - if (!file) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); if (!string) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ f_status_t status = F_none; if (set.before) { - fprintf(file, "%s", set.before->string); + fprintf(stream, "%s", set.before->string); } if (extra.before) { - fprintf(file, "%s", extra.before->string); + fprintf(stream, "%s", extra.before->string); } va_list ap; va_start(ap, string); - vfprintf(file, string, ap); + vfprintf(stream, string, ap); va_end(ap); if (set.after) { - fprintf(file, "%s", set.after->string); + fprintf(stream, "%s", set.after->string); } if (extra.after) { - fprintf(file, "%s", extra.after->string); + fprintf(stream, "%s", extra.after->string); } return F_none; @@ -200,13 +200,13 @@ extern "C" { #endif // _di_fl_color_print2_ #ifndef _di_fl_color_print_code_ - f_return_status fl_color_print_code(FILE *file, const f_string_static_t color) { + f_return_status fl_color_print_code(FILE *stream, const f_string_static_t color) { #ifndef _di_level_1_parameter_checking_ - if (!file) return F_status_set_error(F_parameter); + if (!stream) return F_status_set_error(F_parameter); #endif // _di_level_1_parameter_checking_ if (color.used) { - fprintf(file, "%s", color.string); + fprintf(stream, "%s", color.string); } return F_none; diff --git a/level_1/fl_color/c/color.h b/level_1/fl_color/c/color.h index 59cde6b..00337ac 100644 --- a/level_1/fl_color/c/color.h +++ b/level_1/fl_color/c/color.h @@ -35,8 +35,8 @@ extern "C" { * * Up to 5 colors may be associted with a single color format block. * - * @param file - * The file or standard io. + * @param stream + * The file stream or standard output. * @param format * The color format parts. * @param color1 @@ -55,13 +55,13 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. */ #ifndef _di_fl_color_set_ - extern f_return_status fl_color_set(FILE *file, const f_color_format_t format, const int8_t *color1, const int8_t *color2, const int8_t *color3, const int8_t *color4, const int8_t *color5); + extern f_return_status fl_color_set(FILE *stream, const f_color_format_t format, const int8_t *color1, const int8_t *color2, const int8_t *color3, const int8_t *color4, const int8_t *color5); - #define fl_macro_color_set_1(file, format, color1) fl_color_set(file, format, color1, 0, 0, 0, 0) - #define fl_macro_color_set_2(file, format, color1, color2) fl_color_set(file, format, color1, color2, 0, 0, 0) - #define fl_macro_color_set_3(file, format, color1, color2, color3) fl_color_set(file, format, color1, color2, color3, 0, 0) - #define fl_macro_color_set_4(file, format, color1, color2, color3, color4) fl_color_set(file, format, color1, color2, color3, color4, 0) - #define fl_macro_color_set_5(file, format, color1, color2, color3, color4, color5) fl_color_set(file, format, color1, color2, color3, color4, color5) + #define fl_macro_color_set_1(stream, format, color1) fl_color_set(stream, format, color1, 0, 0, 0, 0) + #define fl_macro_color_set_2(stream, format, color1, color2) fl_color_set(stream, format, color1, color2, 0, 0, 0) + #define fl_macro_color_set_3(stream, format, color1, color2, color3) fl_color_set(stream, format, color1, color2, color3, 0, 0) + #define fl_macro_color_set_4(stream, format, color1, color2, color3, color4) fl_color_set(stream, format, color1, color2, color3, color4, 0) + #define fl_macro_color_set_5(stream, format, color1, color2, color3, color4, color5) fl_color_set(stream, format, color1, color2, color3, color4, color5) #endif // _di_fl_color_set_ /** @@ -138,23 +138,21 @@ extern "C" { * * If the colors strings have nothing used in them, then this will only print the string. * - * @param file - * The file or standard io. + * @param stream + * The file stream or standard output. * @param set * The color set used for printing. * @param string - * The string to print to the file or standard io. + * The string to print. * @param ... * Variable arguments, processed in the same way fprintf() processes them. * * @return * F_none on success. * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_print_dynamic(). */ #ifndef _di_fl_color_print_ - extern f_return_status fl_color_print(FILE *file, const f_color_set_t set, const f_string_t string, ...); + extern f_return_status fl_color_print(FILE *stream, const f_color_set_t set, const f_string_t string, ...); #endif // _di_fl_color_print_ /** @@ -165,25 +163,23 @@ extern "C" { * It is common for colors to be bolded. * This is intended to simplify printing bold colors. * - * @param file - * The file or standard io. + * @param stream + * The file stream or standard output. * @param set * The color set used for printing. * @param extra * The a second color set used for printing, which gets appended after set.before and set.after, respectively. * @param string - * The string to print to the file or standard io. + * The string to print. * @param ... * Variable arguments, processed in the same way fprintf() processes them. * * @return * F_none on success. * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_print_dynamic(). */ #ifndef _di_fl_color_print2_ - extern f_return_status fl_color_print2(FILE *file, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...); + extern f_return_status fl_color_print2(FILE *stream, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...); #endif // _di_fl_color_print2_ /** @@ -191,8 +187,8 @@ extern "C" { * * Be sure to forget to print the color reset when done. * - * @param file - * The file or standard io. + * @param stream + * The file stream or standard output. * @param start_color * The color code to print. * @@ -203,7 +199,7 @@ extern "C" { * Errors (with error bit) from: f_print_dynamic(). */ #ifndef _di_fl_color_print_code_ - extern f_return_status fl_color_print_code(FILE *file, const f_string_static_t color); + extern f_return_status fl_color_print_code(FILE *stream, const f_string_static_t color); #endif // _di_fl_color_print_code_ /** @@ -236,7 +232,7 @@ extern "C" { * @param set * The color set used for printing. * @param string - * The string to print to the file or standard io. + * The string to print. * @param ... * Variable arguments, processed in the same way fprintf() processes them. * @@ -265,7 +261,7 @@ extern "C" { * @param extra * The a second color set used for printing, which gets appended after set.before and set.after, respectively. * @param string - * The string to print to the file or standard io. + * The string to print. * @param ... * Variable arguments, processed in the same way fprintf() processes them. * diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index b9bbb1c..916ffc1 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -75,7 +75,7 @@ extern "C" { status = private_fl_directory_clone(static_source, static_destination, role, recurse, 1); } - if (status == F_none && recurse.output && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source, destination); } @@ -131,7 +131,7 @@ extern "C" { status = private_fl_directory_clone(static_source, static_destination, role, recurse, 1); - if (status == F_none && recurse.output != -1 && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source, destination); } @@ -197,7 +197,7 @@ extern "C" { status = private_fl_directory_copy(static_source, static_destination, mode, recurse, 1); } - if (status == F_none && recurse.output != -1 && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source, destination); } @@ -251,7 +251,7 @@ extern "C" { status = private_fl_directory_copy(static_source, static_destination, mode, recurse, 1); } - if (status == F_none && recurse.output != -1 && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source, destination); } diff --git a/level_1/fl_directory/c/directory.h b/level_1/fl_directory/c/directory.h index 8412542..c42df55 100644 --- a/level_1/fl_directory/c/directory.h +++ b/level_1/fl_directory/c/directory.h @@ -64,7 +64,7 @@ extern "C" { * verbose: * Set to 0 to not print on successful operation. * Set to address of a function to be called for printing such that: - * - The first parameter represents the file pointer from the output variable. + * - The first parameter represents the output file type. * - The second parameter represents the source string. * - The third parameter represents the destination string. * failures: @@ -78,12 +78,12 @@ extern "C" { f_number_unsigned_t depth_max; f_number_unsigned_t size_block; bool exclusive; - int output; - void (*verbose)(const int, const f_string_t, const f_string_t); + f_file_t output; + void (*verbose)(const f_file_t, const f_string_t, const f_string_t); f_directory_statuss_t *failures; } fl_directory_recurse_t; - #define fl_directory_recurse_t_initialize { fl_directory_recurse_depth_max, f_file_default_read_size, F_false, -1, 0, 0 } + #define fl_directory_recurse_t_initialize { fl_directory_recurse_depth_max, f_file_default_read_size, F_false, f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), 0, 0 } #endif // _di_fl_directory_recurse_t_ /** diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 15edf84..4245059 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -116,7 +116,7 @@ extern "C" { if (depth < recurse.depth_max) { status = private_fl_directory_clone(source_sub, destination_sub, role, recurse, depth + 1); - if (status == F_none && recurse.output != -1 && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source_sub.string, destination_sub.string); } } @@ -208,7 +208,7 @@ extern "C" { return F_failure; } - if (recurse.output != -1 && recurse.verbose) { + if ((!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, path_source, path_destination); } @@ -312,7 +312,7 @@ extern "C" { if (depth < recurse.depth_max) { status = private_fl_directory_copy(source_sub, destination_sub, mode, recurse, depth + 1); - if (status == F_none && recurse.output != -1 && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source_sub.string, destination_sub.string); } } @@ -405,7 +405,7 @@ extern "C" { return F_failure; } - if (recurse.output != -1 && recurse.verbose) { + if ((!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, path_source, path_destination); } diff --git a/level_1/fl_status/c/status.c b/level_1/fl_status/c/status.c index 76d340a..809e337 100644 --- a/level_1/fl_status/c/status.c +++ b/level_1/fl_status/c/status.c @@ -239,6 +239,9 @@ extern "C" { case F_critical: *string = FL_status_string_critical; break; + case F_deadlock: + *string = FL_status_string_deadlock; + break; case F_descriptor: *string = FL_status_string_descriptor; break; @@ -293,6 +296,12 @@ extern "C" { case F_link: *string = FL_status_string_link; break; + case F_lock: + *string = FL_status_string_lock; + break; + case F_lock_not: + *string = FL_status_string_lock_not; + break; case F_loop: *string = FL_status_string_loop; break; diff --git a/level_1/fl_status/c/status.h b/level_1/fl_status/c/status.h index a1c0e61..92d4182 100644 --- a/level_1/fl_status/c/status.h +++ b/level_1/fl_status/c/status.h @@ -171,6 +171,7 @@ extern "C" { #define FL_status_string_connected "F_connected" #define FL_status_string_connected_not "F_connected_not" #define FL_status_string_critical "F_critical" + #define FL_status_string_deadlock "F_deadlock" #define FL_status_string_descriptor "F_descriptor" #define FL_status_string_device "F_device" #define FL_status_string_dummy "F_dummy" @@ -189,6 +190,8 @@ extern "C" { #define FL_status_string_invalid "F_invalid" #define FL_status_string_output "F_output" #define FL_status_string_link "F_link" + #define FL_status_string_lock "F_lock" + #define FL_status_string_lock_not "F_lock_not" #define FL_status_string_loop "F_loop" #define FL_status_string_maybe "F_maybe" #define FL_status_string_memory_out "F_memory_out" @@ -225,6 +228,7 @@ extern "C" { #define FL_status_string_connected_length 11 #define FL_status_string_connected_not_length 15 #define FL_status_string_critical_length 10 + #define FL_status_string_deadlock_length 10 #define FL_status_string_descriptor_length 12 #define FL_status_string_device_length 8 #define FL_status_string_dummy_length 7 @@ -243,6 +247,8 @@ extern "C" { #define FL_status_string_invalid_length 9 #define FL_status_string_output_length 8 #define FL_status_string_link_length 6 + #define FL_status_string_lock_length 6 + #define FL_status_string_lock_not_length 10 #define FL_status_string_loop_length 6 #define FL_status_string_maybe_length 7 #define FL_status_string_memory_out_length 12 diff --git a/level_2/fll_error/c/error-common.h b/level_2/fll_error/c/error-common.h index 108f2dc..7700b34 100644 --- a/level_2/fll_error/c/error-common.h +++ b/level_2/fll_error/c/error-common.h @@ -38,7 +38,7 @@ extern "C" { /** * Structure for facilitating the error printing. * - * to: The file descriptor to print to. + * to: The file to print to. * verbosity: The verbosity mode. * prefix: A prefix string to display before the error. * context: The color codes for the entire error message. @@ -52,7 +52,7 @@ extern "C" { #define fll_error_print_warning_length 9 typedef struct { - int to; + f_file_t to; uint8_t verbosity; const char *prefix; @@ -62,7 +62,7 @@ extern "C" { } fll_error_print_t; #define fll_error_print_t_initialize { \ - f_type_descriptor_error, \ + f_macro_file_t_initialize(f_type_error, f_type_descriptor_error, f_file_flag_write_only), \ f_console_verbosity_normal, \ fll_error_print_error, \ f_color_set_t_initialize, \ diff --git a/level_2/fll_error/c/error.c b/level_2/fll_error/c/error.c index 19facd4..40679c9 100644 --- a/level_2/fll_error/c/error.c +++ b/level_2/fll_error/c/error.c @@ -6,13 +6,13 @@ extern "C" { #endif #ifndef _di_fll_error_print_ - f_return_status 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); + f_return_status fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback) { + return private_fll_error_print(error, status, function, fallback); } #endif // _di_fll_error_print_ #ifndef _di_fll_error_file_print_ - f_return_status 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) { + f_return_status fll_error_file_print(const fll_error_print_t error, 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) { @@ -23,169 +23,169 @@ extern "C" { } if (status == F_access_denied) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sAccess denied while trying to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sAccess denied while trying to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_access_group) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sCurrrent user is not allowed to use the given group while trying to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sCurrrent user is not allowed to use the given group while trying to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_access_owner) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sCurrrent user is not allowed to use the given owner while trying to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sCurrrent user is not allowed to use the given owner while trying to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_directory) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sInvalid directory while trying to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sInvalid directory while trying to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_directory_empty_not) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sThe %s '", print.context.before->string, print.prefix ? print.prefix : "", type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "' is not empty.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix ? error.prefix : "", type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "' is not empty.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_file_closed) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sThe %s '", print.context.before->string, print.prefix ? print.prefix : "", type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "' is not open.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix ? error.prefix : "", type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "' is not open.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_file_found) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sThe %s '", print.context.before->string, print.prefix ? print.prefix : "", type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "' already exists.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sThe %s '", error.context.before->string, error.prefix ? error.prefix : "", type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "' already exists.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_file_found_not) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sFailed to find %s '", print.context.before->string, print.prefix ? print.prefix : "", type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sFailed to find %s '", error.context.before->string, error.prefix ? error.prefix : "", type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_file_read) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sA read error occurred while accessing the file '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sA read error occurred while accessing the file '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_file_seek) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sA seek error occurred while accessing the file '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sA seek error occurred while accessing the file '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_loop) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sLoop while trying to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sLoop while trying to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_name) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sInvalid %s name '", print.context.before->string, print.prefix ? print.prefix : "", type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sInvalid %s name '", error.context.before->string, error.prefix ? error.prefix : "", type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_number_overflow) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sOverflow while trying to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sOverflow while trying to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_parameter) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sInvalid parameter", print.context.before->string, print.prefix ? print.prefix : ""); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sInvalid parameter", error.context.before->string, error.prefix ? error.prefix : ""); - private_fll_error_print_function(print, function); + private_fll_error_print_function(error, function); - dprintf(print.to, " for the %s '", type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, " for the %s '", type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_prohibited) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sProhibited by system while trying to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "'.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sProhibited by system while trying to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "'.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; @@ -193,11 +193,11 @@ extern "C" { if (type == fll_error_file_type_file) { if (status == F_directory_found_not) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sFailed to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "' due to an invalid directory in the path.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "' due to an invalid directory in the path.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; @@ -205,144 +205,111 @@ extern "C" { } else if (type == fll_error_file_type_directory) { if (status == F_directory_found_not) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sFailed to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); - dprintf(print.to, "' due to an invalid directory in the path.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); + fprintf(error.to.stream, "' due to an invalid directory in the path.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_failure) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sFailed to %s %s '", print.context.before->string, print.prefix ? print.prefix : "", operation, type_name); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, name, print.notable.after->string); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sFailed to %s %s '", error.context.before->string, error.prefix ? error.prefix : "", operation, type_name); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, name, error.notable.after->string); } return F_false; } } - return private_fll_error_print(print, status, function, fallback); + return private_fll_error_print(error, status, function, fallback); } #endif // _di_fll_error_file_print_ -#ifndef _di_fll_error_parameter_print_ - f_return_status fll_error_parameter_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback) { - - if (status == F_data_not) { - if (print.verbosity != f_console_verbosity_quiet) { - // @todo there is a way to identify which parameter is incorrect - // to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0 - // nothing can be 0 as that represents the program name, unless argv[] is improperly created - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sOne of the parameters passed requires an additional argument that was not passed.%s%c", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "' must not be an empty string.%s%c", print.context.after->string, f_string_eol[0]); - } - - return F_false; - } - - if (status == F_utf) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sInvalid UTF-8 character in a parameter when calling ", print.context.before->string, print.prefix ? print.prefix : ""); - - private_fll_error_print_function(print, function); - - dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]); - } - - return F_false; - } - - return private_fll_error_print(print, status, function, fallback); - } -#endif // _di_fll_error_parameter_print_ - #ifndef _di_fll_error_parameter_integer_print_ - f_return_status fll_error_parameter_integer_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument) { + f_return_status fll_error_parameter_integer_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument) { if (status == F_data_not) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sThe argument for the parameter '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string); - dprintf(print.to, "' must not be an empty string.%s%c", print.context.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sThe argument for the parameter '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string); + fprintf(error.to.stream, "' must not be an empty string.%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_number) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", argument[0]); - dprintf(print.to, "%s%sThe argument '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "' is not a valid number for the parameter '"); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "%s%s%s%s%c", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", argument[0]); + fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "' is not a valid number for the parameter '"); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "%s%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); } return F_false; } if (status == F_number_negative) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", argument[0]); - dprintf(print.to, "%s%sThe argument '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "' is negative, which is not allowed for the parameter '"); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "%s%s%s%s%c", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", argument[0]); + fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "' is negative, which is not allowed for the parameter '"); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "%s%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); } return F_false; } if (status == F_number_overflow) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", argument[0]); - dprintf(print.to, "%s%sThe argument '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "' is too large for the parameter '"); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "%s%s%s%s%c", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", argument[0]); + fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "' is too large for the parameter '"); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "%s%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); } return F_false; } if (status == F_number_positive) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", argument[0]); - dprintf(print.to, "%s%sThe argument '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "' is positive, which is not allowed for the parameter '"); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "%s%s%s%s%c", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", argument[0]); + fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "' is positive, which is not allowed for the parameter '"); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "%s%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); } return F_false; } if (status == F_number_underflow) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", argument[0]); - dprintf(print.to, "%s%sThe argument '", print.context.before->string, print.prefix ? print.prefix : ""); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "' is too small for the parameter '"); - dprintf(print.to, "%s%s%s%s", print.context.after->string, print.notable.before->string, argument, print.notable.after->string); - dprintf(print.to, "%s%s%s%s%c", print.context.after->string, print.notable.before->string, parameter, print.notable.after->string, f_string_eol[0]); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", argument[0]); + fprintf(error.to.stream, "%s%sThe argument '", error.context.before->string, error.prefix ? error.prefix : ""); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "' is too small for the parameter '"); + fprintf(error.to.stream, "%s%s%s%s", error.context.after->string, error.notable.before->string, argument, error.notable.after->string); + fprintf(error.to.stream, "%s%s%s%s%c", error.context.after->string, error.notable.before->string, parameter, error.notable.after->string, f_string_eol[0]); } return F_false; } - return private_fll_error_print(print, status, function, fallback); + return private_fll_error_print(error, status, function, fallback); } #endif // _di_fll_error_parameter_integer_print_ diff --git a/level_2/fll_error/c/error.h b/level_2/fll_error/c/error.h index 0908071..4848e57 100644 --- a/level_2/fll_error/c/error.h +++ b/level_2/fll_error/c/error.h @@ -51,7 +51,7 @@ extern "C" { * F_true is returned if the status code is unknown. */ #ifndef _di_fll_error_print_ - extern f_return_status fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback); + extern f_return_status fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback); #endif // _di_fll_error_print_ /** @@ -79,32 +79,10 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fll_error_file_print_ - extern f_return_status 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); + extern f_return_status fll_error_file_print(const fll_error_print_t error, 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); #endif // _di_fll_error_file_print_ /** - * Print parameter related error or warning messages. - * - * @param print - * Designates how printing is to be performed. - * @param status - * The status code to process. - * Make sure this has F_status_set_fine() called if the status code has any error or warning bits. - * @param function - * The name of the function where the error happened. - * Set to 0 to disable. - * @param fallback - * Set to F_true to print the fallback error message for unknown errors. - * - * @return - * F_false is returned on successful print of known errors. - * F_true is returned if the status code is unknown. - */ -#ifndef _di_fll_error_parameter_print_ - extern f_return_status fll_error_parameter_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback); -#endif // _di_fll_error_parameter_print_ - -/** * Print integer related error or warning messages. * * @param print @@ -127,7 +105,7 @@ extern "C" { * F_false is returned on successful print of known errors. */ #ifndef _di_fll_error_parameter_integer_print_ - extern f_return_status fll_error_parameter_integer_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument); + extern f_return_status fll_error_parameter_integer_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t parameter, const f_string_t argument); #endif // _di_fll_error_parameter_integer_print_ #ifdef __cplusplus diff --git a/level_2/fll_error/c/private-error.c b/level_2/fll_error/c/private-error.c index 8e983e6..e8c7296 100644 --- a/level_2/fll_error/c/private-error.c +++ b/level_2/fll_error/c/private-error.c @@ -6,81 +6,81 @@ extern "C" { #endif #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - f_return_status private_fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback) { + f_return_status private_fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback) { if (status == F_buffer_too_large) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sMaximum buffer length reached while processing ", print.context.before->string, print.prefix ? print.prefix : ""); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sMaximum buffer length reached while processing ", error.context.before->string, error.prefix ? error.prefix : ""); - private_fll_error_print_function(print, function); + private_fll_error_print_function(error, function); - dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_memory_allocation || status == F_memory_reallocation || status == F_memory_out) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sUnable to allocate memory in function ", print.context.before->string, print.prefix ? print.prefix : ""); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sUnable to allocate memory in function ", error.context.before->string, error.prefix ? error.prefix : ""); - private_fll_error_print_function(print, function); + private_fll_error_print_function(error, function); - dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_parameter) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sInvalid parameter", print.context.before->string, print.prefix ? print.prefix : ""); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sInvalid parameter", error.context.before->string, error.prefix ? error.prefix : ""); - private_fll_error_print_function(print, function); + private_fll_error_print_function(error, function); - dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_string_too_large) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sMaximum string length reached while processing ", print.context.before->string, print.prefix ? print.prefix : ""); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sMaximum string length reached while processing ", error.context.before->string, error.prefix ? error.prefix : ""); - private_fll_error_print_function(print, function); + private_fll_error_print_function(error, function); - dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } if (status == F_utf) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%sInvalid UTF-8 character while calling ", print.context.before->string, print.prefix ? print.prefix : ""); + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%sInvalid UTF-8 character while calling ", error.context.before->string, error.prefix ? error.prefix : ""); - private_fll_error_print_function(print, function); + private_fll_error_print_function(error, function); - dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol[0]); } return F_false; } - if (fallback && print.verbosity != f_console_verbosity_quiet) { - if (print.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - dprintf(print.to, "%s%s(%llu)", print.context.before->string, print.prefix ? print.prefix : "", status); + if (fallback && error.verbosity != f_console_verbosity_quiet) { + if (error.verbosity != f_console_verbosity_quiet) { + fprintf(error.to.stream, "%c", f_string_eol[0]); + fprintf(error.to.stream, "%s%s(%llu)", error.context.before->string, error.prefix ? error.prefix : "", status); - private_fll_error_print_function(print, function); + private_fll_error_print_function(error, function); - dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]); + fprintf(error.to.stream, ".%s%c", error.context.after->string, f_string_eol[0]); } } @@ -89,12 +89,12 @@ extern "C" { #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - void private_fll_error_print_function(const fll_error_print_t print, const f_string_t function) { + void private_fll_error_print_function(const fll_error_print_t error, const f_string_t function) { if (function) { - dprintf(print.to, " when calling function %s", print.context.after->string); - dprintf(print.to, "%s%s%s", print.notable.before->string, function, print.notable.after->string); - dprintf(print.to, "%s()", print.context.before->string); + fprintf(error.to.stream, " when calling function %s", error.context.after->string); + fprintf(error.to.stream, "%s%s%s", error.notable.before->string, function, error.notable.after->string); + fprintf(error.to.stream, "%s()", error.context.before->string); } } #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/c/private-error.h b/level_2/fll_error/c/private-error.h index 1d01a9e..7044dc2 100644 --- a/level_2/fll_error/c/private-error.h +++ b/level_2/fll_error/c/private-error.h @@ -39,7 +39,7 @@ extern "C" { * @see fll_error_file_print() */ #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - extern f_return_status private_fll_error_print(const fll_error_print_t print, const f_status_t status, const f_string_t function, const bool fallback) f_gcc_attribute_visibility_internal; + extern f_return_status private_fll_error_print(const fll_error_print_t error, const f_status_t status, const f_string_t function, const bool fallback) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) /** @@ -61,7 +61,7 @@ extern "C" { * @see fll_error_file_print() */ #if !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) - void private_fll_error_print_function(const fll_error_print_t print, const f_string_t function) f_gcc_attribute_visibility_internal; + void private_fll_error_print_function(const fll_error_print_t error, const f_string_t function) f_gcc_attribute_visibility_internal; #endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_) #ifdef __cplusplus diff --git a/level_2/fll_file/c/file.c b/level_2/fll_file/c/file.c index 8b55322..e9fe5a7 100644 --- a/level_2/fll_file/c/file.c +++ b/level_2/fll_file/c/file.c @@ -6,65 +6,65 @@ extern "C" { #endif #ifndef _di_fll_file_error_print_ - f_return_status fll_file_error_print(FILE *file, const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status) { + f_return_status fll_file_error_print(FILE *stream, const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status) { if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print(file, context.set.error, "CRITICAL ERROR: Unable to allocate memory."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_file_closed) { - fl_color_print(file, context.set.error, "INTERNAL ERROR: The file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "' is no longer open."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "INTERNAL ERROR: The file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "' is no longer open."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_file_seek) { - fl_color_print(file, context.set.error, "ERROR: A seek error occurred while accessing the file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "'."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "ERROR: A seek error occurred while accessing the file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "'."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_file_read) { - fl_color_print(file, context.set.error, "ERROR: A read error occurred while accessing the file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "'."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "ERROR: A read error occurred while accessing the file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "'."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print(file, context.set.error, "ERROR: Unable to find the file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "'."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "ERROR: Unable to find the file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "'."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print(file, context.set.error, "ERROR: Unable to open the file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "'."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "ERROR: Unable to open the file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "'."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print(file, context.set.error, "ERROR: File descriptor error while trying to open the file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "'."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "ERROR: File descriptor error while trying to open the file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "'."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_parameter) { - fl_color_print(file, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print(file, context.set.notable, "%s()", function_name); - fl_color_print(file, context.set.error, "."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(stream, context.set.notable, "%s()", function_name); + fl_color_print(stream, context.set.error, "."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print(file, context.set.error, "ERROR: Integer overflow while trying to buffer the file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "'."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "ERROR: Integer overflow while trying to buffer the file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "'."); + fprintf(stream, "%c", f_string_eol[0]); } else if (status == F_number_underflow) { - fl_color_print(file, context.set.error, "ERROR: Integer underflow while trying to buffer the file '"); - fl_color_print(file, context.set.notable, "%s", file_name); - fl_color_print(file, context.set.error, "'."); - fprintf(file, "%c", f_string_eol[0]); + fl_color_print(stream, context.set.error, "ERROR: Integer underflow while trying to buffer the file '"); + fl_color_print(stream, context.set.notable, "%s", file_name); + fl_color_print(stream, context.set.error, "'."); + fprintf(stream, "%c", f_string_eol[0]); } else { return F_false; @@ -94,7 +94,7 @@ extern "C" { f_status_t status = f_file_rename(source, destination); if (F_status_set_fine(status) != F_mount) { - if (status == F_none && recurse.output && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source, destination); } @@ -120,7 +120,7 @@ extern "C" { status = f_directory_remove(source, recurse.depth_max, F_false); - if (status == F_none && recurse.output && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source, destination); } } @@ -133,7 +133,7 @@ extern "C" { status = f_file_remove(source); - if (status == F_none && recurse.output && recurse.verbose) { + if (status == F_none && (!recurse.output.stream || recurse.output.id != -1) && recurse.verbose) { recurse.verbose(recurse.output, source, destination); } } diff --git a/level_2/fll_file/c/file.h b/level_2/fll_file/c/file.h index 793d7f4..933cd72 100644 --- a/level_2/fll_file/c/file.h +++ b/level_2/fll_file/c/file.h @@ -33,8 +33,8 @@ extern "C" { /** * Print file error messages. * - * @param file - * The file to write to, such as f_type_output or f_type_error. + * @param stream + * The file stream to write to, such as f_type_output or f_type_error. * @param context * The color context information to use when printing. * @param function_name @@ -50,7 +50,7 @@ extern "C" { * F_false if no error message was printed. */ #ifndef _di_fll_file_error_print_ - extern f_return_status fll_file_error_print(FILE *file, const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status); + extern f_return_status fll_file_error_print(FILE *stream, const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status); #endif // _di_fll_file_error_print_ /** diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index 1cb0482..4a83f73 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -5,93 +5,93 @@ extern "C" { #endif #ifndef _di_fll_program_print_help_header_ - f_return_status fll_program_print_help_header(const int id, const f_color_context_t context, const f_string_t name, const f_string_t version) { + f_return_status fll_program_print_help_header(const f_file_t file, const f_color_context_t context, const f_string_t name, const f_string_t version) { - dprintf(id, "%c", f_string_eol[0]); - fl_color_print_to(id, context.set.title, " %s", name); + fprintf(file.stream, "%c", f_string_eol[0]); + fl_color_print(file.stream, context.set.title, " %s", name); - dprintf(id, "%c", f_string_eol[0]); - fl_color_print_to(id, context.set.notable, " Version %s", version); + fprintf(file.stream, "%c", f_string_eol[0]); + fl_color_print(file.stream, context.set.notable, " Version %s", version); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); - fl_color_print_to(id, context.set.important, " Available Options: "); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); + fl_color_print(file.stream, context.set.important, " Available Options: "); return F_none; } #endif // _di_fll_program_print_help_header_ #ifndef _di_fll_program_print_help_option_ - f_return_status fll_program_print_help_option(const int id, const f_color_context_t context, const f_string_t option_short, const f_string_t option_long, const f_string_t symbol_short, const f_string_t symbol_long, const f_string_t description) { + f_return_status fll_program_print_help_option(const f_file_t file, const f_color_context_t context, const f_string_t option_short, const f_string_t option_long, const f_string_t symbol_short, const f_string_t symbol_long, const f_string_t description) { - dprintf(id, "%c %s", f_string_eol[0], symbol_short); - fl_color_print_to(id, context.set.standout, option_short); + fprintf(file.stream, "%c %s", f_string_eol[0], symbol_short); + fl_color_print(file.stream, context.set.standout, option_short); - dprintf(id, ", %s", symbol_long); - fl_color_print_to(id, context.set.standout, option_long); + fprintf(file.stream, ", %s", symbol_long); + fl_color_print(file.stream, context.set.standout, option_long); - dprintf(id, " %s", description); + fprintf(file.stream, " %s", description); return F_none; } #endif // _di_fll_program_print_help_option_ #ifndef _di_fll_program_print_help_option_long_ - f_return_status fll_program_print_help_option_long(const int id, const f_color_context_t context, const f_string_t option_long, const f_string_t symbol_long, const f_string_t description) { + f_return_status fll_program_print_help_option_long(const f_file_t file, const f_color_context_t context, const f_string_t option_long, const f_string_t symbol_long, const f_string_t description) { - dprintf(id, "%c %s", f_string_eol[0], symbol_long); - fl_color_print_to(id, context.set.standout, option_long); + fprintf(file.stream, "%c %s", f_string_eol[0], symbol_long); + fl_color_print(file.stream, context.set.standout, option_long); - dprintf(id, " %s", description); + fprintf(file.stream, " %s", description); return F_none; } #endif // _di_fll_program_print_help_option_long_ #ifndef _di_fll_program_print_help_option_other_ - f_return_status fll_program_print_help_option_other(const int id, const f_color_context_t context, const f_string_t option_other, const f_string_t description) { + f_return_status fll_program_print_help_option_other(const f_file_t file, const f_color_context_t context, const f_string_t option_other, const f_string_t description) { - dprintf(id, "%c ", f_string_eol[0]); - fl_color_print_to(id, context.set.standout, option_other); + fprintf(file.stream, "%c ", f_string_eol[0]); + fl_color_print(file.stream, context.set.standout, option_other); - dprintf(id, " %s", description); + fprintf(file.stream, " %s", description); return F_none; } #endif // _di_fll_program_print_help_option_other_ #ifndef _di_fll_program_print_help_usage_ - f_return_status fll_program_print_help_usage(const int id, const f_color_context_t context, const f_string_t name, const f_string_t parameters) { + f_return_status fll_program_print_help_usage(const f_file_t file, const f_color_context_t context, const f_string_t name, const f_string_t parameters) { - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); - fl_color_print_to(id, context.set.important, " Usage:"); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); + fl_color_print(file.stream, context.set.important, " Usage:"); - dprintf(id, "%c ", f_string_eol[0]); - fl_color_print_to(id, context.set.standout, name); + fprintf(file.stream, "%c ", f_string_eol[0]); + fl_color_print(file.stream, context.set.standout, name); - dprintf(id, " "); - fl_color_print_to(id, context.set.notable, "["); + fprintf(file.stream, " "); + fl_color_print(file.stream, context.set.notable, "["); - dprintf(id, " options "); - fl_color_print_to(id, context.set.notable, "]"); + fprintf(file.stream, " options "); + fl_color_print(file.stream, context.set.notable, "]"); if (parameters[0] != '\0') { - dprintf(id, " "); - fl_color_print_to(id, context.set.notable, "["); + fprintf(file.stream, " "); + fl_color_print(file.stream, context.set.notable, "["); - dprintf(id, " %s ", parameters); - fl_color_print_to(id, context.set.notable, "]"); + fprintf(file.stream, " %s ", parameters); + fl_color_print(file.stream, context.set.notable, "]"); } - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); return F_none; } #endif // _di_fll_program_print_help_usage_ #ifndef _di_fll_program_print_version_ - f_return_status fll_program_print_version(const int id, const f_string_t version) { + f_return_status fll_program_print_version(const f_file_t file, const f_string_t version) { - dprintf(id, "%s%c", version, f_string_eol[0]); + fprintf(file.stream, "%s%c", version, f_string_eol[0]); return F_none; } diff --git a/level_2/fll_program/c/program.h b/level_2/fll_program/c/program.h index 8495d34..cc04b2d 100644 --- a/level_2/fll_program/c/program.h +++ b/level_2/fll_program/c/program.h @@ -32,8 +32,8 @@ extern "C" { /** * Print standard help header. * - * @param id - * The file descriptor to output to. + * @param file + * The file to output to. * @param context * The color context. * @param name @@ -49,14 +49,14 @@ extern "C" { * @param fl_color_print() */ #ifndef _di_fll_program_print_help_header_ - extern f_return_status fll_program_print_help_header(const int id, const f_color_context_t context, const f_string_t name, const f_string_t version); + extern f_return_status fll_program_print_help_header(const f_file_t file, const f_color_context_t context, const f_string_t name, const f_string_t version); #endif // _di_fll_program_print_help_header_ /** * Print standard help option. * - * @param id - * The file descriptor to output to. + * @param file + * The file to output to. * @param context * The color context. * @param option_short @@ -78,14 +78,14 @@ extern "C" { * @param fl_color_print() */ #ifndef _di_fll_program_print_help_option_ - extern f_return_status fll_program_print_help_option(const int id, const f_color_context_t context, const f_string_t option_short, const f_string_t option_long, const f_string_t symbol_short, const f_string_t symbol_long, const f_string_t description); + extern f_return_status fll_program_print_help_option(const f_file_t file, const f_color_context_t context, const f_string_t option_short, const f_string_t option_long, const f_string_t symbol_short, const f_string_t symbol_long, const f_string_t description); #endif // _di_fll_program_print_help_option_ /** * Print standard help option (long option only). * - * @param id - * The file descriptor to output to. + * @param file + * The file to output to. * @param context * The color context. * @param option_long @@ -103,14 +103,14 @@ extern "C" { * @param fl_color_print() */ #ifndef _di_fll_program_print_help_option_long_ - extern f_return_status fll_program_print_help_option_long(const int id, const f_color_context_t context, const f_string_t option_long, const f_string_t symbol_long, const f_string_t description); + extern f_return_status fll_program_print_help_option_long(const f_file_t file, const f_color_context_t context, const f_string_t option_long, const f_string_t symbol_long, const f_string_t description); #endif // _di_fll_program_print_help_option_long_ /** * Print standard help option (other option only). * - * @param id - * The file descriptor to output to. + * @param file + * The file to output to. * @param context * The color context. * @param option_other @@ -126,14 +126,14 @@ extern "C" { * @param fl_color_print() */ #ifndef _di_fll_program_print_help_option_other_ - extern f_return_status fll_program_print_help_option_other(const int id, const f_color_context_t context, const f_string_t option_other, const f_string_t description); + extern f_return_status fll_program_print_help_option_other(const f_file_t file, const f_color_context_t context, const f_string_t option_other, const f_string_t description); #endif // _di_fll_program_print_help_option_other_ /** * Print standard help usage. * - * @param id - * The file descriptor to output to. + * @param file + * The file to output to. * @param context * The color context. * @param name @@ -150,14 +150,14 @@ extern "C" { * @param fl_color_print() */ #ifndef _di_fll_program_print_help_usage_ - extern f_return_status fll_program_print_help_usage(const int id, const f_color_context_t context, const f_string_t name, const f_string_t parameters); + extern f_return_status fll_program_print_help_usage(const f_file_t file, const f_color_context_t context, const f_string_t name, const f_string_t parameters); #endif // _di_fll_program_print_help_usage_ /** * Print the program version. * - * @param id - * The file descriptor to output to. + * @param file + * The file to output to. * @param version * The version number of the program. * @@ -165,7 +165,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fll_program_print_version_ - extern f_return_status fll_program_print_version(const int id, const f_string_t version); + extern f_return_status fll_program_print_version(const f_file_t file, const f_string_t version); #endif // _di_fll_program_print_version_ /** diff --git a/level_2/fll_status/c/status.c b/level_2/fll_status/c/status.c index 4a335e0..010a735 100644 --- a/level_2/fll_status/c/status.c +++ b/level_2/fll_status/c/status.c @@ -401,6 +401,11 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_deadlock, length, FL_status_string_deadlock_length) == F_equal_to) { + *code = F_deadlock; + return F_none; + } + if (fl_string_compare(string, FL_status_string_descriptor, length, FL_status_string_descriptor_length) == F_equal_to) { *code = F_descriptor; return F_none; @@ -491,6 +496,16 @@ extern "C" { return F_none; } + if (fl_string_compare(string, FL_status_string_lock, length, FL_status_string_lock_length) == F_equal_to) { + *code = F_lock; + return F_none; + } + + if (fl_string_compare(string, FL_status_string_lock_not, length, FL_status_string_lock_not_length) == F_equal_to) { + *code = F_lock_not; + return F_none; + } + if (fl_string_compare(string, FL_status_string_loop, length, FL_status_string_loop_length) == F_equal_to) { *code = F_loop; return F_none; diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 4d5a2ea..da36080 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -6,70 +6,70 @@ extern "C" { #endif #ifndef _di_byte_dump_print_help_ - f_return_status byte_dump_print_help(const int id, const f_color_context_t context) { + f_return_status byte_dump_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, byte_dump_name_long, byte_dump_version); + fll_program_print_help_header(file, context, byte_dump_name_long, byte_dump_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); - dprintf(id, "%c", f_string_eol[0]); + fprintf(file.stream, "%c", f_string_eol[0]); - fll_program_print_help_option(id, context, byte_dump_short_binary, byte_dump_long_binary, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display binary representation."); - fll_program_print_help_option(id, context, byte_dump_short_decimal, byte_dump_long_decimal, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display decimal representation."); - fll_program_print_help_option(id, context, byte_dump_short_duodecimal, byte_dump_long_duodecimal, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display duodecimal representation."); - fll_program_print_help_option(id, context, byte_dump_short_hexidecimal, byte_dump_long_hexidecimal, f_console_symbol_short_enable, f_console_symbol_long_enable, "Display hexadecimal representation."); - fll_program_print_help_option(id, context, byte_dump_short_octal, byte_dump_long_octal, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display octal representation."); + fll_program_print_help_option(file, context, byte_dump_short_binary, byte_dump_long_binary, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display binary representation."); + fll_program_print_help_option(file, context, byte_dump_short_decimal, byte_dump_long_decimal, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display decimal representation."); + fll_program_print_help_option(file, context, byte_dump_short_duodecimal, byte_dump_long_duodecimal, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display duodecimal representation."); + fll_program_print_help_option(file, context, byte_dump_short_hexidecimal, byte_dump_long_hexidecimal, f_console_symbol_short_enable, f_console_symbol_long_enable, "Display hexadecimal representation."); + fll_program_print_help_option(file, context, byte_dump_short_octal, byte_dump_long_octal, f_console_symbol_short_enable, f_console_symbol_long_enable, " Display octal representation."); - dprintf(id, "%c", f_string_eol[0]); + fprintf(file.stream, "%c", f_string_eol[0]); - fll_program_print_help_option(id, context, byte_dump_short_first, byte_dump_long_first, f_console_symbol_short_enable, f_console_symbol_long_enable, " Start reading at this byte offset."); - fll_program_print_help_option(id, context, byte_dump_short_last, byte_dump_long_last, f_console_symbol_short_enable, f_console_symbol_long_enable, " Stop reading at this (inclusive) byte offset."); - fll_program_print_help_option(id, context, byte_dump_short_width, byte_dump_long_width, f_console_symbol_short_enable, f_console_symbol_long_enable, " Set number of columns of Bytes to display."); + fll_program_print_help_option(file, context, byte_dump_short_first, byte_dump_long_first, f_console_symbol_short_enable, f_console_symbol_long_enable, " Start reading at this byte offset."); + fll_program_print_help_option(file, context, byte_dump_short_last, byte_dump_long_last, f_console_symbol_short_enable, f_console_symbol_long_enable, " Stop reading at this (inclusive) byte offset."); + fll_program_print_help_option(file, context, byte_dump_short_width, byte_dump_long_width, f_console_symbol_short_enable, f_console_symbol_long_enable, " Set number of columns of Bytes to display."); - dprintf(id, "%c", f_string_eol[0]); + fprintf(file.stream, "%c", f_string_eol[0]); - fll_program_print_help_option(id, context, byte_dump_short_text, byte_dump_long_text, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include a column of text when displaying the bytes."); - fll_program_print_help_option(id, context, byte_dump_short_placeholder, byte_dump_long_placeholder, f_console_symbol_short_enable, f_console_symbol_long_enable, "Use a placeholder character instead of a space for placeholders."); + fll_program_print_help_option(file, context, byte_dump_short_text, byte_dump_long_text, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include a column of text when displaying the bytes."); + fll_program_print_help_option(file, context, byte_dump_short_placeholder, byte_dump_long_placeholder, f_console_symbol_short_enable, f_console_symbol_long_enable, "Use a placeholder character instead of a space for placeholders."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); - fl_color_print_to(id, context.set.important, " Special Options: "); + fl_color_print(file.stream, context.set.important, " Special Options: "); - fll_program_print_help_option_long(id, context, byte_dump_long_normal, f_console_symbol_long_enable, " Display UTF-8 symbols for ASCII control codes."); - fll_program_print_help_option_long(id, context, byte_dump_long_simple, f_console_symbol_long_enable, " Display spaces for ASCII control codes."); - fll_program_print_help_option_long(id, context, byte_dump_long_classic, f_console_symbol_long_enable, "Display periods for ASCII control codes."); + fll_program_print_help_option_long(file, context, byte_dump_long_normal, f_console_symbol_long_enable, " Display UTF-8 symbols for ASCII control codes."); + fll_program_print_help_option_long(file, context, byte_dump_long_simple, f_console_symbol_long_enable, " Display spaces for ASCII control codes."); + fll_program_print_help_option_long(file, context, byte_dump_long_classic, f_console_symbol_long_enable, "Display periods for ASCII control codes."); - fll_program_print_help_usage(id, context, byte_dump_name, "filename(s)"); + fll_program_print_help_usage(file, context, byte_dump_name, "filename(s)"); - dprintf(id, " When using the "); - fl_color_print_to(id, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_text); - dprintf(id, " option, some UTF-8 characters may be replaced by your instance and cause display alignment issues."); + fprintf(file.stream, " When using the "); + fl_color_print(file.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_text); + fprintf(file.stream, " option, some UTF-8 characters may be replaced by your instance and cause display alignment issues."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); - dprintf(id, " Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the "); - fl_color_print_to(id, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_placeholder); - dprintf(id, " option is used)."); + fprintf(file.stream, " Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the "); + fl_color_print(file.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_placeholder); + fprintf(file.stream, " option is used)."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); - dprintf(id, " UTF-8 \"Combining\" characters might have a space appended to allow a proper display but this may cause copy and paste issues."); + fprintf(file.stream, " UTF-8 \"Combining\" characters might have a space appended to allow a proper display but this may cause copy and paste issues."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); - dprintf(id, " When "); - fl_color_print_to(id, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); - dprintf(id, " is used, any UTF-8 sequences will still be printed in full should any part is found within the requested range."); + fprintf(file.stream, " When "); + fl_color_print(file.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); + fprintf(file.stream, " is used, any UTF-8 sequences will still be printed in full should any part is found within the requested range."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); return F_none; } @@ -90,7 +90,7 @@ extern "C" { status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); if (F_status_is_error(status)) { - fll_error_parameter_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); byte_dump_delete_data(data); return F_status_set_error(status); @@ -106,6 +106,8 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { + fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + byte_dump_delete_data(data); return status; } @@ -165,6 +167,8 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { + fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + byte_dump_delete_data(data); return F_status_set_error(status); } @@ -199,9 +203,9 @@ extern "C" { if (data->remaining.used > 0 || data->process_pipe) { if (data->parameters[byte_dump_parameter_width].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width); - fl_color_print_to(data->error.to, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width); + fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); byte_dump_delete_data(data); return F_status_set_error(status); @@ -215,13 +219,13 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status) || number < 1 || number >= 0xfb) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width); - fl_color_print_to(data->error.to, data->context.set.error, "' value can only be a number between "); - fl_color_print_to(data->error.to, data->context.set.notable, "0"); - fl_color_print_to(data->error.to, data->context.set.error, " and "); - fl_color_print_to(data->error.to, data->context.set.notable, "251"); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width); + fl_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number between "); + fl_color_print(data->error.to.stream, data->context.set.notable, "0"); + fl_color_print(data->error.to.stream, data->context.set.error, " and "); + fl_color_print(data->error.to.stream, data->context.set.notable, "251"); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); byte_dump_delete_data(data); return F_status_set_error(status); @@ -231,9 +235,9 @@ extern "C" { } if (data->parameters[byte_dump_parameter_first].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); - fl_color_print_to(data->error.to, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); + fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); byte_dump_delete_data(data); return F_status_set_error(status); @@ -247,13 +251,13 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status) || number > f_number_t_size_unsigned) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); - fl_color_print_to(data->error.to, data->context.set.error, "' value can only be a number (inclusively) between "); - fl_color_print_to(data->error.to, data->context.set.notable, "0"); - fl_color_print_to(data->error.to, data->context.set.error, " and "); - fl_color_print_to(data->error.to, data->context.set.notable, "%llu", f_number_t_size_unsigned); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); + fl_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number (inclusively) between "); + fl_color_print(data->error.to.stream, data->context.set.notable, "0"); + fl_color_print(data->error.to.stream, data->context.set.error, " and "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%llu", f_number_t_size_unsigned); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); byte_dump_delete_data(data); return F_status_set_error(status); @@ -263,9 +267,9 @@ extern "C" { } if (data->parameters[byte_dump_parameter_last].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); - fl_color_print_to(data->error.to, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); + fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); byte_dump_delete_data(data); return F_status_set_error(status); @@ -279,13 +283,13 @@ extern "C" { status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); if (F_status_is_error(status) || number < 0 || number > f_number_t_size_unsigned) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); - fl_color_print_to(data->error.to, data->context.set.error, "' value can only be a number (inclusively) between "); - fl_color_print_to(data->error.to, data->context.set.notable, "0"); - fl_color_print_to(data->error.to, data->context.set.error, " and "); - fl_color_print_to(data->error.to, data->context.set.notable, "%llu", f_number_t_size_unsigned); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); + fl_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number (inclusively) between "); + fl_color_print(data->error.to.stream, data->context.set.notable, "0"); + fl_color_print(data->error.to.stream, data->context.set.error, " and "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%llu", f_number_t_size_unsigned); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); byte_dump_delete_data(data); return F_status_set_error(status); @@ -296,11 +300,11 @@ extern "C" { if (data->parameters[byte_dump_parameter_first].result == f_console_result_additional && data->parameters[byte_dump_parameter_last].result == f_console_result_additional) { if (data->first > data->last) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); - fl_color_print_to(data->error.to, data->context.set.error, "' value cannot be greater than the parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); - fl_color_print_to(data->error.to, data->context.set.error, "' value.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); + fl_color_print(data->error.to.stream, data->context.set.error, "' value cannot be greater than the parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); + fl_color_print(data->error.to.stream, data->context.set.error, "' value.%c", f_string_eol[0]); byte_dump_delete_data(data); return F_status_set_error(status); @@ -316,29 +320,31 @@ extern "C" { file.id = f_type_descriptor_input; printf("%c", f_string_eol[0]); - fl_color_print_to(data->output, data->context.set.title, "Piped Byte Dump: (in "); + fl_color_print(data->output.stream, data->context.set.title, "Piped Byte Dump: (in "); if (data->mode == byte_dump_mode_hexidecimal) { - fl_color_print_to(data->output, data->context.set.title, "Hexidecimal"); + fl_color_print(data->output.stream, data->context.set.title, "Hexidecimal"); } else if (data->mode == byte_dump_mode_duodecimal) { - fl_color_print_to(data->output, data->context.set.title, "Duodecimal"); + fl_color_print(data->output.stream, data->context.set.title, "Duodecimal"); } else if (data->mode == byte_dump_mode_octal) { - fl_color_print_to(data->output, data->context.set.title, "Octal"); + fl_color_print(data->output.stream, data->context.set.title, "Octal"); } else if (data->mode == byte_dump_mode_binary) { - fl_color_print_to(data->output, data->context.set.title, "Binary"); + fl_color_print(data->output.stream, data->context.set.title, "Binary"); } else if (data->mode == byte_dump_mode_decimal) { - fl_color_print_to(data->output, data->context.set.title, "Decimal"); + fl_color_print(data->output.stream, data->context.set.title, "Decimal"); } - fl_color_print_to(data->output, data->context.set.title, ")%c", f_string_eol[0]); + fl_color_print(data->output.stream, data->context.set.title, ")%c", f_string_eol[0]); status = byte_dump_file(*data, "-", file); if (F_status_is_error(status)) { + fll_error_print(data->error, F_status_set_fine(status), "byte_dump_file", F_true); + byte_dump_delete_data(data); return status; } @@ -358,7 +364,7 @@ extern "C" { missing_files = status; } - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_exists", F_true, arguments.argv[data->remaining.array[counter]], "find", fll_error_file_type_file); + fll_error_file_print(data.error, F_status_set_fine(status), "f_file_exists", F_true, arguments.argv[data->remaining.array[counter]], "find", fll_error_file_type_file); } } // for @@ -370,46 +376,48 @@ extern "C" { } } - for (f_array_length_t counter = 0; counter < data->remaining.used; counter++) { - f_file_t file = f_file_t_initialize; + f_file_t file = f_file_t_initialize; + for (f_array_length_t counter = 0; counter < data->remaining.used; counter++) { status = f_file_open(arguments.argv[data->remaining.array[counter]], 0, &file); if (F_status_is_error(status)) { - fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[counter]], "open", fll_error_file_type_file); + fll_error_file_print(data.error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[counter]], "open", fll_error_file_type_file); byte_dump_delete_data(data); return status; } printf("%c", f_string_eol[0]); - fl_color_print_to(data->output, data->context.set.title, "Byte Dump of: "); - fl_color_print_to(data->output, data->context.set.notable, "%s", arguments.argv[data->remaining.array[counter]]); - fl_color_print_to(data->output, data->context.set.title, " (in "); + fl_color_print(data->output.stream, data->context.set.title, "Byte Dump of: "); + fl_color_print(data->output.stream, data->context.set.notable, "%s", arguments.argv[data->remaining.array[counter]]); + fl_color_print(data->output.stream, data->context.set.title, " (in "); if (data->mode == byte_dump_mode_hexidecimal) { - fl_color_print_to(data->output, data->context.set.title, "Hexidecimal"); + fl_color_print(data->output.stream, data->context.set.title, "Hexidecimal"); } else if (data->mode == byte_dump_mode_duodecimal) { - fl_color_print_to(data->output, data->context.set.title, "Duodecimal"); + fl_color_print(data->output.stream, data->context.set.title, "Duodecimal"); } else if (data->mode == byte_dump_mode_octal) { - fl_color_print_to(data->output, data->context.set.title, "Octal"); + fl_color_print(data->output.stream, data->context.set.title, "Octal"); } else if (data->mode == byte_dump_mode_binary) { - fl_color_print_to(data->output, data->context.set.title, "Binary"); + fl_color_print(data->output.stream, data->context.set.title, "Binary"); } else if (data->mode == byte_dump_mode_decimal) { - fl_color_print_to(data->output, data->context.set.title, "Decimal"); + fl_color_print(data->output.stream, data->context.set.title, "Decimal"); } - fl_color_print_to(data->output, data->context.set.title, ")%c", f_string_eol[0]); + fl_color_print(data->output.stream, data->context.set.title, ")%c", f_string_eol[0]); status = byte_dump_file(*data, arguments.argv[data->remaining.array[counter]], file); f_file_close(&file.id); if (F_status_is_error(status)) { + fll_error_file_print(data.error, F_status_set_fine(status), "byte_dump_file", F_true, arguments.argv[data->remaining.array[counter]], "open", fll_error_file_type_file); + byte_dump_delete_data(data); return status; } @@ -420,7 +428,7 @@ extern "C" { } } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify one or more filenames.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more filenames.%c", f_string_eol[0]); status = F_status_set_error(F_parameter); } diff --git a/level_3/byte_dump/c/byte_dump.h b/level_3/byte_dump/c/byte_dump.h index 9d9d2d7..d81902e 100644 --- a/level_3/byte_dump/c/byte_dump.h +++ b/level_3/byte_dump/c/byte_dump.h @@ -214,7 +214,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; uint64_t first; @@ -231,7 +231,7 @@ extern "C" { byte_dump_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ 0, \ 0, \ @@ -243,10 +243,10 @@ extern "C" { #endif // _di_byte_dump_data_t_ /** - * Print help to standard output. + * Print help. * - * @param id - * The file descriptor to print to. + * @param file + * The file to print to. * @param context * The color context settings. * @@ -254,7 +254,7 @@ extern "C" { * F_none on success. */ #ifndef _di_byte_dump_print_help_ - extern f_return_status byte_dump_print_help(const int id, const f_color_context_t context); + extern f_return_status byte_dump_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_byte_dump_print_help_ /** diff --git a/level_3/byte_dump/c/main.c b/level_3/byte_dump/c/main.c index cd6de32..9a955d2 100644 --- a/level_3/byte_dump/c/main.c +++ b/level_3/byte_dump/c/main.c @@ -8,9 +8,7 @@ int main(const unsigned long argc, const f_string_t *argv) { data.process_pipe = F_true; } - f_status_t status = byte_dump_main(arguments, &data); - - if (F_status_is_error(status)) { + if (F_status_is_error(byte_dump_main(arguments, &data))) { return 1; } diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index dddccd1..63119c5 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -158,38 +158,38 @@ extern "C" { while (cell.column < data.width) { if (data.mode == byte_dump_mode_hexidecimal) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_duodecimal) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_octal) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_binary) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_decimal) { - printf(" "); + fprintf(data.output.stream, " "); } cell.column++; if (cell.column < data.width) { if (data.mode == byte_dump_mode_hexidecimal && cell.column % 8 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_duodecimal && cell.column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_octal && cell.column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_binary && cell.column % 4 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_decimal && cell.column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } } } // while @@ -198,28 +198,29 @@ extern "C" { byte_dump_print_text(data, characters, invalid, &previous, &offset); } else { - printf("%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); } } - printf("%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); // make sure to flush standard out to help prevent standard error from causing poblems. fflush(f_type_output); if (found_invalid_utf) { - fl_color_print_to(data.error.to, data.context.set.error, "Invalid UTF-8 codes were detected for file '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", file_name); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); - printf("%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "Invalid UTF-8 codes were detected for file '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", file_name); + fl_color_print(data.error.to.stream, data.context.set.error, "'."); + fprintf(data.error.to.stream, "%c%c", f_string_eol[0], f_string_eol[0]); } if (size < 0) { // @todo: determine what the error from read() is and display it. - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: read() failed for '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", file_name); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); - printf("%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: read() failed for '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", file_name); + fl_color_print(data.error.to.stream, data.context.set.error, "'."); + fprintf(data.error.to.stream, "%c%x", f_string_eol[0], f_string_eol[0]); + status = F_status_set_error(F_failure); } @@ -251,7 +252,7 @@ extern "C" { } if (!cell->column) { - fl_color_print(f_type_output, data.context.set.notable, "%016X ", (uint64_t) cell->row); + fl_color_print(data.output.stream, data.context.set.notable, "%016X ", (uint64_t) cell->row); if (*offset > 0) { uint8_t offset_to_print = *offset; @@ -259,19 +260,19 @@ extern "C" { // Pad the buffer with spaces to hide any skipped bytes (skipped via --first). while (offset_to_print > 0 && cell->column < data.width) { if (data.mode == byte_dump_mode_hexidecimal) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_duodecimal) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_octal) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_binary) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_decimal) { - printf(" "); + fprintf(data.output.stream, " "); } offset_to_print--; @@ -279,19 +280,19 @@ extern "C" { if (cell->column < data.width) { if (data.mode == byte_dump_mode_hexidecimal && cell->column % 8 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_duodecimal && cell->column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_octal && cell->column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_binary && cell->column % 4 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_decimal && cell->column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } } } @@ -301,53 +302,53 @@ extern "C" { if (cell->column < data.width) { if (data.mode == byte_dump_mode_hexidecimal) { if (invalid[character_current]) { - fl_color_print(f_type_output, data.context.set.error, " %02x", (uint8_t) byte); + fl_color_print(data.output.stream, data.context.set.error, " %02x", (uint8_t) byte); } else { - printf(" %02x", (uint8_t) byte); + fprintf(data.output.stream, " %02x", (uint8_t) byte); } } else if (data.mode == byte_dump_mode_duodecimal) { if (invalid[character_current]) { - f_print_dynamic(f_type_output, data.context.error); + fprintf(data.output.stream, "%s", data.context.error); } - printf(" %01d", byte / 144); + fprintf(data.output.stream, " %01d", byte / 144); uint8_t current = (byte % 144) / 12; if (current == 11) { - printf("b"); + fprintf(data.output.stream, "b"); } else if (current == 10) { - printf("a"); + fprintf(data.output.stream, "a"); } else { - printf("%01d", current); + fprintf(data.output.stream, "%01d", current); } current = (byte % 144) % 12; if (current == 11) { - printf("b"); + fprintf(data.output.stream, "b"); } else if (current == 10) { - printf("a"); + fprintf(data.output.stream, "a"); } else { - printf("%01d", current); + fprintf(data.output.stream, "%01d", current); } if (invalid[character_current]) { - f_print_dynamic(f_type_output, data.context.reset); + fprintf(data.output.stream, "%s", data.context.reset); } } else if (data.mode == byte_dump_mode_octal) { if (invalid[character_current]) { - fl_color_print(f_type_output, data.context.set.error, " %03o", (uint8_t) byte); + fl_color_print(data.output.stream, data.context.set.error, " %03o", (uint8_t) byte); } else { - printf(" %03o", (uint8_t) byte); + fprintf(data.output.stream, " %03o", (uint8_t) byte); } } else if (data.mode == byte_dump_mode_binary) { @@ -363,18 +364,18 @@ extern "C" { binary_string[7] = (byte & 0x01) ? '1' : '0'; if (invalid[character_current]) { - fl_color_print(f_type_output, data.context.set.error, " %s", binary_string); + fl_color_print(data.output.stream, data.context.set.error, " %s", binary_string); } else { - printf(" %s", binary_string); + fprintf(data.output.stream, " %s", binary_string); } } else if (data.mode == byte_dump_mode_decimal) { if (invalid[character_current]) { - fl_color_print(f_type_output, data.context.set.error, " %3d", (uint8_t) byte); + fl_color_print(data.output.stream, data.context.set.error, " %3d", (uint8_t) byte); } else { - printf(" %3d", (uint8_t) byte); + fprintf(data.output.stream, " %3d", (uint8_t) byte); } } @@ -394,7 +395,7 @@ extern "C" { byte_dump_print_text(data, characters, invalid, previous, offset); } else { - printf("%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); } cell->column = 0; @@ -410,19 +411,19 @@ extern "C" { } } else if (data.mode == byte_dump_mode_hexidecimal && cell->column % 8 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_duodecimal && cell->column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_octal && cell->column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_binary && cell->column % 4 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.mode == byte_dump_mode_decimal && cell->column % 6 == 0) { - printf(" "); + fprintf(data.output.stream, " "); } return reset; @@ -436,25 +437,25 @@ extern "C" { uint8_t width_utf = 0; bool printed = F_false; - fl_color_print(f_type_output, data.context.set.notable, " %s ", byte_dump_character_wall); + fl_color_print(data.output.stream, data.context.set.notable, " %s ", byte_dump_character_wall); if (*offset > 0) { if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { while (*offset > 0 && j < data.width) { - printf("."); + fprintf(data.output.stream, "."); (*offset)--; j++; } // while } else { - f_string_t placeholder = " "; + const char *placeholder = " "; if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { placeholder = byte_dump_character_placeholder; } while (*offset > 0 && j < data.width) { - fl_color_print(f_type_output, data.context.set.warning, "%s", placeholder); + fl_color_print(data.output.stream, data.context.set.warning, "%s", placeholder); (*offset)--; j++; } // while @@ -474,19 +475,19 @@ extern "C" { for (; j < previous->bytes && j < data.width; j++) { if (previous->invalid) { - fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); } else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - printf("."); + fprintf(data.output.stream, "."); } else { - fl_color_print(f_type_output, data.context.set.warning, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); } } // for } else { for (; j < previous->bytes && j < data.width; j++) { - printf(" "); + fprintf(data.output.stream, " "); } // for } } @@ -506,200 +507,200 @@ extern "C" { width_utf = f_macro_utf_byte_width_is(output); if (invalid[i]) { - fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_incomplete); + fl_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_incomplete); } else if (output >= 0 && output <= 32 || output == 127) { if (data.presentation == byte_dump_presentation_normal) { if (!output) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_null); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_null); } else if (output == 1) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_start_of_header); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_start_of_header); } else if (output == 2) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_start_of_text); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_start_of_text); } else if (output == 3) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_text); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_text); } else if (output == 4) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_transmission); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_transmission); } else if (output == 5) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_enquiry); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_enquiry); } else if (output == 6) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_acknowledge); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_acknowledge); } else if (output == 7) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_bell); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_bell); } else if (output == 8) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_backspace); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_backspace); } else if (output == 9) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_tab); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_tab); } else if (output == 10) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_new_line); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_new_line); } else if (output == 11) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_tab_vertical); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_tab_vertical); } else if (output == 12) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_form_feed); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_form_feed); } else if (output == 13) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_carriage_return); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_carriage_return); } else if (output == 14) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_shift_out); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_shift_out); } else if (output == 15) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_shift_in); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_shift_in); } else if (output == 16) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_data_link_escape); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_data_link_escape); } else if (output == 17) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_1); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_1); } else if (output == 18) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_2); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_2); } else if (output == 19) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_3); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_3); } else if (output == 20) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_4); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_device_control_4); } else if (output == 21) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_negative_acknowledge); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_negative_acknowledge); } else if (output == 22) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_synchronous_idle); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_synchronous_idle); } else if (output == 23) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_transmission_block); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_transmission_block); } else if (output == 24) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_cancel); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_cancel); } else if (output == 25) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_medium); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_end_of_medium); } else if (output == 26) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_substitute); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_substitute); } else if (output == 27) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_escape); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_escape); } else if (output == 28) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_file_separator); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_file_separator); } else if (output == 29) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_group_separator); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_group_separator); } else if (output == 30) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_record_separator); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_record_separator); } else if (output == 31) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_unit_separator); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_unit_separator); } else if (output == 32) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_space); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_space); } else if (output == 127) { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_delete); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_delete); } } else if (data.presentation == byte_dump_presentation_simple) { - printf(" "); + fprintf(data.output.stream, " "); } else if (data.presentation == byte_dump_presentation_classic) { - printf("."); + fprintf(data.output.stream, "."); } } else if (f_utf_character_is_whitespace(characters.string[i]) == F_true) { if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - printf("."); + fprintf(data.output.stream, "."); } else { - fl_color_print2(f_type_output, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_space); + fl_color_print2(data.output.stream, data.context.set.notable, data.context.set.warning, "%s", byte_dump_sequence_space); } } else if (f_utf_character_is_zero_width(characters.string[i]) == F_true) { if (data.presentation == byte_dump_presentation_classic) { - printf("."); + fprintf(data.output.stream, "."); } else if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { - fl_color_print(f_type_output, data.context.set.warning, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); } else { - printf(" "); + fprintf(data.output.stream, " "); } } else if (f_utf_character_is_control(characters.string[i]) == F_true) { // print a space (or '.') for control characters. if (data.presentation == byte_dump_presentation_classic) { - fl_color_print(f_type_output, data.context.set.warning, "."); + fl_color_print(data.output.stream, data.context.set.warning, "."); } else { - printf(" "); + fprintf(data.output.stream, " "); } } else if (width_utf == 2 && characters.string[i] == 0xd89d0000) { // U+061C - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 3 && characters.string[i] >= 0xefbfb000 && characters.string[i] <= 0xefbfbc00) { // Use space to represent Specials codes. // 0xefbfbd00 is excluded because it is printable (and is the "Replacement Character" code). - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 3 && characters.string[i] >= 0xe290a700 && characters.string[i] <= 0xe290bf00) { // Use space to represent Control Pictues codes that are not currently defined but are reserved. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 3 && characters.string[i] >= 0xee808000 && characters.string[i] <= 0xefa3bf00) { // Use space to represent Private Use Area codes. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 4 && characters.string[i] >= 0xf09c80a0 && characters.string[i] <= 0xf09c80bd) { // Use space to represent Vaiation Selectors Supplement codes. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 4 && characters.string[i] >= 0xf3b08080 && characters.string[i] <= 0xf3bfbfbf) { // Use space to represent Supplemental Private Use Area-A codes. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 4 && characters.string[i] >= 0xf4808080 && characters.string[i] <= 0xf48fbfbf) { // Use space to represent Supplemental Private Use Area-B codes. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 1) { // print invalid placeholder for invalid UTF-8 widths. if (invalid[i]) { - fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_incomplete); + fl_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_incomplete); } else { - fl_color_print(f_type_output, data.context.set.warning, "%s", byte_dump_character_incomplete); + fl_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_incomplete); } } else if (width_utf > 0) { - printf("%c", (uint8_t) output); + fprintf(data.output.stream, "%c", (uint8_t) output); if (width_utf > 1) { output = f_macro_utf_character_t_to_char_2(characters.string[i]); - printf("%c", (uint8_t) output); + fprintf(data.output.stream, "%c", (uint8_t) output); if (width_utf > 2) { output = f_macro_utf_character_t_to_char_3(characters.string[i]); - printf("%c", (uint8_t) output); + fprintf(data.output.stream, "%c", (uint8_t) output); if (width_utf > 3) { output = f_macro_utf_character_t_to_char_4(characters.string[i]); - printf("%c", (uint8_t) output); + fprintf(data.output.stream, "%c", (uint8_t) output); } } } @@ -708,55 +709,55 @@ extern "C" { // print a space for combining characters to combine into, thereby allowing it to be safely and readably displayed. if (width_utf == 2 && characters.string[i] >= 0xdea60000 && characters.string[i] <= 0xdeb00000) { // Thana combining codes: U+07A6 to U+07B0. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 2 && characters.string[i] >= 0xcc800000 && characters.string[i] <= 0xcdaf0000) { - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 3 && characters.string[i] >= 0xe1aab000 && characters.string[i] <= 0xe1abbf00) { - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 3 && characters.string[i] >= 0xe1b78000 && characters.string[i] <= 0xe1b7bf00) { - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 3 && characters.string[i] >= 0xe2839000 && characters.string[i] <= 0xe283bf00) { - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 2 && characters.string[i] >= 0xd8900000 && characters.string[i] <= 0xd89a0000) { - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 2 && characters.string[i] >= 0xd98b0000 && characters.string[i] <= 0xd99f0000) { // Arabic, U+064B to U+065F. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 2 && characters.string[i] >= 0xdb960000 && characters.string[i] <= 0xdb9c0000) { // Arabic, U+06D6 to U+06DC. - printf(" "); + fprintf(data.output.stream, " "); } else if (width_utf == 2 && characters.string[i] >= 0xd6910000 && characters.string[i] <= 0xd6bd0000) { // Hebrew, U+0591 to U+05BD. - printf(" "); + fprintf(data.output.stream, " "); } } else { - printf("%c", output); + fprintf(data.output.stream, "%c", output); } // When using UTF-8 characters, the character columns will not line up, so print placeholders to simulate the bytes that are not printed, if necessary for alignment. if (width_utf > 1 && j + 1 < data.width) { if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { if (invalid[i]) { - fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); } else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - printf("."); + fprintf(data.output.stream, "."); } else { - fl_color_print(f_type_output, data.context.set.warning, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); } } else { - printf(" "); + fprintf(data.output.stream, " "); } j++; @@ -764,17 +765,17 @@ extern "C" { if (width_utf > 2 && j + 1 < data.width) { if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { if (invalid[i]) { - fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); } else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - printf("."); + fprintf(data.output.stream, "."); } else { - fl_color_print(f_type_output, data.context.set.warning, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); } } else { - printf(" "); + fprintf(data.output.stream, " "); } j++; @@ -782,17 +783,17 @@ extern "C" { if (width_utf > 3 && j + 1 < data.width) { if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { if (invalid[i]) { - fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); } else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - printf("."); + fprintf(data.output.stream, "."); } else { - fl_color_print(f_type_output, data.context.set.warning, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); } } else { - printf(" "); + fprintf(data.output.stream, " "); } j++; @@ -804,25 +805,26 @@ extern "C" { // Print placeholder for the remaining parts of the line. if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { for (; j < data.width; j++) { + if (invalid[j]) { - fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.error, "%s", byte_dump_character_placeholder); } else if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { - printf("."); + fprintf(data.output.stream, "."); } else { - fl_color_print(f_type_output, data.context.set.warning, "%s", byte_dump_character_placeholder); + fl_color_print(data.output.stream, data.context.set.warning, "%s", byte_dump_character_placeholder); } } // for } else { for (; j < data.width; j++) { - printf(" "); + fprintf(data.output.stream, " "); } // for } - fl_color_print(f_type_output, data.context.set.notable, " |"); - printf("%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.notable, " |"); + fprintf(data.output.stream, "%c", f_string_eol[0]); } #endif // _di_byte_dump_file_ diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 7a5c766..c03bf2c 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -11,88 +11,88 @@ extern "C" { #endif #ifndef _di_fake_print_help_ - f_return_status fake_print_help(const int id, const f_color_context_t context) { + f_return_status fake_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fake_name_long, fake_version); + fll_program_print_help_header(file, context, fake_name_long, fake_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); - dprintf(id, "%c", f_string_eol[0]); + fprintf(file.stream, "%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fake_short_define, fake_long_define, f_console_symbol_short_enable, f_console_symbol_long_enable, " Override defines from settings file with this define."); - fll_program_print_help_option(id, context, fake_short_fakefile, fake_long_fakefile, f_console_symbol_short_enable, f_console_symbol_long_enable, "Use this fakefile."); - fll_program_print_help_option(id, context, fake_short_mode, fake_long_mode, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use this mode when processing the build settings."); - fll_program_print_help_option(id, context, fake_short_process, fake_long_process, f_console_symbol_short_enable, f_console_symbol_long_enable, " Process name for storing build states."); - fll_program_print_help_option(id, context, fake_short_settings, fake_long_settings, f_console_symbol_short_enable, f_console_symbol_long_enable, "Use this settings file."); + fll_program_print_help_option(file, context, fake_short_define, fake_long_define, f_console_symbol_short_enable, f_console_symbol_long_enable, " Override defines from settings file with this define."); + fll_program_print_help_option(file, context, fake_short_fakefile, fake_long_fakefile, f_console_symbol_short_enable, f_console_symbol_long_enable, "Use this fakefile."); + fll_program_print_help_option(file, context, fake_short_mode, fake_long_mode, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use this mode when processing the build settings."); + fll_program_print_help_option(file, context, fake_short_process, fake_long_process, f_console_symbol_short_enable, f_console_symbol_long_enable, " Process name for storing build states."); + fll_program_print_help_option(file, context, fake_short_settings, fake_long_settings, f_console_symbol_short_enable, f_console_symbol_long_enable, "Use this settings file."); - dprintf(id, "%c", f_string_eol[0]); + fprintf(file.stream, "%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fake_short_path_build, fake_long_path_build, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom build directory."); - fll_program_print_help_option(id, context, fake_short_path_data, fake_long_path_data, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom path to the data files."); - fll_program_print_help_option(id, context, fake_short_path_sources, fake_long_path_sources, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom path to the source files."); - fll_program_print_help_option(id, context, fake_short_path_work, fake_long_path_work, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use includes/libraries/programs from this directory instead of system."); + fll_program_print_help_option(file, context, fake_short_path_build, fake_long_path_build, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom build directory."); + fll_program_print_help_option(file, context, fake_short_path_data, fake_long_path_data, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom path to the data files."); + fll_program_print_help_option(file, context, fake_short_path_sources, fake_long_path_sources, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom path to the source files."); + fll_program_print_help_option(file, context, fake_short_path_work, fake_long_path_work, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use includes/libraries/programs from this directory instead of system."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); - fl_color_print_to(id, context.set.important, " Special Options: "); + fl_color_print(file.stream, context.set.important, " Special Options: "); - fll_program_print_help_option_long(id, context, fake_long_documents_disabled, f_console_symbol_long_enable, " Forcibly do not build documents files."); - fll_program_print_help_option_long(id, context, fake_long_documents_enabled, f_console_symbol_long_enable, " Forcibly do build documents files."); - fll_program_print_help_option_long(id, context, fake_long_shared_disabled, f_console_symbol_long_enable, "Forcibly do not build shared files."); - fll_program_print_help_option_long(id, context, fake_long_shared_enabled, f_console_symbol_long_enable, " Forcibly do build shared files."); - fll_program_print_help_option_long(id, context, fake_long_static_disabled, f_console_symbol_long_enable, "Forcibly do not build static files."); - fll_program_print_help_option_long(id, context, fake_long_static_enabled, f_console_symbol_long_enable, " Forcibly do build static files."); + fll_program_print_help_option_long(file, context, fake_long_documents_disabled, f_console_symbol_long_enable, " Forcibly do not build documents files."); + fll_program_print_help_option_long(file, context, fake_long_documents_enabled, f_console_symbol_long_enable, " Forcibly do build documents files."); + fll_program_print_help_option_long(file, context, fake_long_shared_disabled, f_console_symbol_long_enable, "Forcibly do not build shared files."); + fll_program_print_help_option_long(file, context, fake_long_shared_enabled, f_console_symbol_long_enable, " Forcibly do build shared files."); + fll_program_print_help_option_long(file, context, fake_long_static_disabled, f_console_symbol_long_enable, "Forcibly do not build static files."); + fll_program_print_help_option_long(file, context, fake_long_static_enabled, f_console_symbol_long_enable, " Forcibly do build static files."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); - fl_color_print_to(id, context.set.important, " Operations: "); + fl_color_print(file.stream, context.set.important, " Operations: "); - fll_program_print_help_option_other(id, context, fake_other_operation_build, " Build or compile the code based on build settings file."); - fll_program_print_help_option_other(id, context, fake_other_operation_clean, " Delete all build files."); - fll_program_print_help_option_other(id, context, fake_other_operation_make, " Build or compile the code based on fakefile."); - fll_program_print_help_option_other(id, context, fake_other_operation_skeleton, "Build a skeleton directory structure."); + fll_program_print_help_option_other(file, context, fake_other_operation_build, " Build or compile the code based on build settings file."); + fll_program_print_help_option_other(file, context, fake_other_operation_clean, " Delete all build files."); + fll_program_print_help_option_other(file, context, fake_other_operation_make, " Build or compile the code based on fakefile."); + fll_program_print_help_option_other(file, context, fake_other_operation_skeleton, "Build a skeleton directory structure."); - fll_program_print_help_usage(id, context, fake_name, "operation"); + fll_program_print_help_usage(file, context, fake_name, "operation"); - dprintf(id, " When performing the "); - fl_color_print_to(id, context.set.notable, "%s", fake_other_operation_build); - dprintf(id, " operation, the "); - fl_color_print_to(id, context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); - dprintf(id, " parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global."); - dprintf(id, "%c", f_string_eol[0]); + fprintf(file.stream, " When performing the "); + fl_color_print(file.stream, context.set.notable, "%s", fake_other_operation_build); + fprintf(file.stream, " operation, the "); + fl_color_print(file.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); + fprintf(file.stream, " parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global."); + fprintf(file.stream, "%c", f_string_eol[0]); - dprintf(id, " For example, when a "); - fl_color_print_to(id, context.set.notable, "%s", fake_long_mode); - dprintf(id, " of 'fll_monolithic' is specified, build libaries from both 'build_libraries' and 'build_libraries-fll_monolithic' are used (but not 'build_libraries-fll_level')."); + fprintf(file.stream, " For example, when a "); + fl_color_print(file.stream, context.set.notable, "%s", fake_long_mode); + fprintf(file.stream, " of 'fll_monolithic' is specified, build libaries from both 'build_libraries' and 'build_libraries-fll_monolithic' are used (but not 'build_libraries-fll_level')."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); - dprintf(id, " When specifying the "); - fl_color_print_to(id, context.set.notable, "%s", fake_long_fakefile); - dprintf(id, " or the "); - fl_color_print_to(id, context.set.notable, "%s", fake_long_settings); - dprintf(id, " parameters, the filenames are relative to the data build directory, unless a path is used."); - dprintf(id, "%c", f_string_eol[0]); + fprintf(file.stream, " When specifying the "); + fl_color_print(file.stream, context.set.notable, "%s", fake_long_fakefile); + fprintf(file.stream, " or the "); + fl_color_print(file.stream, context.set.notable, "%s", fake_long_settings); + fprintf(file.stream, " parameters, the filenames are relative to the data build directory, unless a path is used."); + fprintf(file.stream, "%c", f_string_eol[0]); - dprintf(id, " For example, with '"); - fl_color_print_to(id, context.set.notable, "%s%s my_fakefile", f_console_symbol_long_enable, fake_long_fakefile); - dprintf(id, "' the fakefile at '"); - fl_color_print_to(id, context.set.notable, "./%s%smy_fakefile", fake_default_path_data, fake_default_path_build); - dprintf(id, " would be used, however with '"); - fl_color_print_to(id, context.set.notable, "%s%s ./my_fakefile", f_console_symbol_long_enable, fake_long_fakefile); - dprintf(id, "' the fakefile at '"); - fl_color_print_to(id, context.set.notable, "./my_fakefile", fake_default_path_data, fake_default_path_build); - dprintf(id, " would be used."); + fprintf(file.stream, " For example, with '"); + fl_color_print(file.stream, context.set.notable, "%s%s my_fakefile", f_console_symbol_long_enable, fake_long_fakefile); + fprintf(file.stream, "' the fakefile at '"); + fl_color_print(file.stream, context.set.notable, "./%s%smy_fakefile", fake_default_path_data, fake_default_path_build); + fprintf(file.stream, " would be used, however with '"); + fl_color_print(file.stream, context.set.notable, "%s%s ./my_fakefile", f_console_symbol_long_enable, fake_long_fakefile); + fprintf(file.stream, "' the fakefile at '"); + fl_color_print(file.stream, context.set.notable, "./my_fakefile", fake_default_path_data, fake_default_path_build); + fprintf(file.stream, " would be used."); - dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]); + fprintf(file.stream, "%c%c", f_string_eol[0], f_string_eol[0]); return F_none; } @@ -113,7 +113,8 @@ extern "C" { status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); if (F_status_is_error(status)) { - fake_print_error(*data, F_status_set_fine(status), "fll_program_parameter_process", F_true); + fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true); + fake_delete_data(data); return status; } @@ -128,7 +129,8 @@ extern "C" { status = f_console_parameter_prioritize_right(parameters, choices, &choice); if (F_status_is_error(status)) { - fake_print_error(*data, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true); + fake_delete_data(data); return status; } @@ -317,10 +319,10 @@ extern "C" { } else if (F_status_is_error(status)) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The operation '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", operations_name); - fl_color_print_to(data->error.to, data->context.set.error, "' failed.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The operation '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", operations_name); + fl_color_print(data->error.to.stream, data->context.set.error, "' failed.%c", f_string_eol[0]); } break; @@ -330,18 +332,18 @@ extern "C" { // ensure a newline is always put at the end of the program execution, unless in quiet mode. if (data->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status) || status == F_signal) { - dprintf(data->error.to, "%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); } else { - dprintf(data->output, "%cAll operations complete.%c%c", f_string_eol[0], f_string_eol[0], f_string_eol[0]); + fprintf(data->output.stream, "%cAll operations complete.%c%c", f_string_eol[0], f_string_eol[0], f_string_eol[0]); } } } else { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify an operation.%c", f_string_eol[0]); - dprintf(data->error.to, "%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify an operation.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 2c0e15d..12f2e11 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -372,7 +372,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; uint8_t operation; @@ -442,7 +442,7 @@ extern "C" { fake_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ 0, \ 0, \ @@ -496,8 +496,10 @@ extern "C" { #endif // _di_fake_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -505,7 +507,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fake_print_help_ - extern f_return_status fake_print_help(const int id, const f_color_context_t context); + extern f_return_status fake_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fake_print_help_ /** diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index d373029..6304e0c 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -168,14 +168,14 @@ extern "C" { f_string_dynamic_t destination_file = f_string_dynamic_t_initialize; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Copying %s.%c", label, f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Copying %s.%c", label, f_string_eol[0]); } f_macro_string_dynamic_t_new(*status, path_source, source.used); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamic_t_new", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "f_macro_string_dynamic_t_new", F_true); f_macro_string_dynamic_t_delete_simple(path_source); return; @@ -200,14 +200,14 @@ extern "C" { *status = fl_string_dynamic_append_nulless(files.array[i], &path_source); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = fl_string_dynamic_terminate_after(&path_source); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -232,7 +232,7 @@ extern "C" { } // for if (F_status_set_fine(*status) != F_failure) { - fake_print_error(data, F_status_set_fine(*status), "fl_directory_copy_content", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_directory_copy_content", F_true); } break; @@ -250,14 +250,14 @@ extern "C" { *status = fl_string_dynamic_append_nulless(destination, &destination_file); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = f_file_name_base(path_source.string, path_source.used, &destination_file); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_file_name_base", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "f_file_name_base", F_true); break; } @@ -274,11 +274,11 @@ extern "C" { } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Copied file '%s' to '%s'.%c", path_source.string, destination_file.string, f_string_eol[0]); + fprintf(data.output.stream, "Copied file '%s' to '%s'.%c", path_source.string, destination_file.string, f_string_eol[0]); } } else if (F_status_is_error(*status)) { - fake_print_error_file(data, F_status_set_fine(*status), "f_directory_is", path_source.string, "create", F_false, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_is", F_true, path_source.string, "create", fll_error_file_type_file); break; } @@ -346,8 +346,8 @@ extern "C" { }; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Creating base build directories.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Creating base build directories.%c", f_string_eol[0]); } for (uint8_t i = 0; i < 15; i++) { @@ -367,12 +367,12 @@ extern "C" { continue; } - fake_print_error_file(data, F_status_set_fine(*status), "f_directory_create", directorys[i]->string, "create", F_false, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_create", F_true, directorys[i]->string, "create", fll_error_file_type_directory); return; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Created directory '%s'.%c", directorys[i]->string, f_string_eol[0]); + fprintf(data.output.stream, "Created directory '%s'.%c", directorys[i]->string, f_string_eol[0]); } } // for @@ -429,7 +429,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return; @@ -449,7 +449,7 @@ extern "C" { } // for if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_mash", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_mash", F_true); f_macro_string_dynamic_t_delete_simple(defines); f_macro_string_dynamics_t_delete_simple(arguments); @@ -459,7 +459,7 @@ extern "C" { *status = fl_string_dynamic_terminate_after(&defines); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); f_macro_string_dynamic_t_delete_simple(defines); f_macro_string_dynamics_t_delete_simple(arguments); @@ -532,7 +532,7 @@ extern "C" { f_macro_string_dynamic_t_delete_simple(defines); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add_parameter_set", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return; @@ -559,7 +559,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), function, F_true); + fll_error_print(data->error, F_status_set_fine(*status), function, F_true); f_macro_string_dynamic_t_delete_simple(path); f_macro_string_dynamics_t_delete_simple(arguments); @@ -592,14 +592,14 @@ extern "C" { if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_failure) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to execute script: "); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path.string); - fl_color_print_to(data.error.to, data.context.set.error, ".%c", f_string_eol[0]); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: Failed to execute script: "); + fl_color_print(data.error, data.context.set.notable, "%s", path.string); + fl_color_print(data.error, data.context.set.error, ".%c", f_string_eol[0]); } } else { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_path_environment", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_path_environment", F_true); } } else { @@ -621,7 +621,7 @@ extern "C" { f_status_t status = f_file_name_base(path.string, path.used, name); if (F_status_is_error(status)) { - fake_print_error(data, F_status_set_fine(status), "f_file_name_base", F_true); + fll_error_print(data->error, F_status_set_fine(status), "f_file_name_base", F_true); return status; } @@ -637,7 +637,7 @@ extern "C" { status = fl_string_dynamic_terminate_after(name); if (F_status_is_error(status)) { - fake_print_error(data, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true); return status; } @@ -661,8 +661,8 @@ extern "C" { if (!data_build.setting.build_sources_library.used) return; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Compiling shared library.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Compiling shared library.%c", f_string_eol[0]); } f_string_dynamics_t arguments = f_string_dynamics_t_initialize; @@ -698,7 +698,7 @@ extern "C" { } // for if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return; @@ -837,7 +837,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_true, F_true, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return; @@ -884,15 +884,15 @@ extern "C" { *status = f_file_link(parameter_file_name_micro, parameter_file_path); if (F_status_is_error_not(*status) && data.error.verbosity == f_console_verbosity_verbose) { - printf("Linked file '%s' to '%s'.%c", parameter_file_path, parameter_file_name_micro, f_string_eol[0]); + fprintf(data.output.stream, "Linked file '%s' to '%s'.%c", parameter_file_path, parameter_file_name_micro, f_string_eol[0]); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_path, "link", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file); return; } - fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_micro, "link", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, "link", fll_error_file_type_file); return; } } @@ -924,35 +924,35 @@ extern "C" { } if (F_status_is_error_not(*status) && data.error.verbosity == f_console_verbosity_verbose) { - printf("Linked file '%s' to '", parameter_file_path); + fprintf(data.output.stream, "Linked file '%s' to '", parameter_file_path); if (data_build.setting.version_target == fake_build_version_type_major) { - printf("%s", parameter_file_name_major); + fprintf(data.output.stream, "%s", parameter_file_name_major); } else if (data_build.setting.version_target == fake_build_version_type_minor) { - printf("%s", parameter_file_name_minor); + fprintf(data.output.stream, "%s", parameter_file_name_minor); } else if (data_build.setting.version_target == fake_build_version_type_micro) { - printf("%s", parameter_file_name_micro); + fprintf(data.output.stream, "%s", parameter_file_name_micro); } - printf("'.%c", f_string_eol[0]); + fprintf(data.output.stream, "'.%c", f_string_eol[0]); } else if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found) { - fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_path, "link", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_path, "link", fll_error_file_type_file); return; } if (data_build.setting.version_target == fake_build_version_type_major) { - fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_major, "link", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_major, "link", fll_error_file_type_file); } else if (data_build.setting.version_target == fake_build_version_type_minor) { - fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_minor, "link", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_minor, "link", fll_error_file_type_file); } else if (data_build.setting.version_target == fake_build_version_type_micro) { - fake_print_error_file(data, F_status_set_fine(*status), "f_file_link", parameter_file_name_micro, "link", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_link", F_true, parameter_file_name_micro, "link", fll_error_file_type_file); } return; @@ -969,8 +969,8 @@ extern "C" { if (!data_build.setting.build_sources_library.used) return; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Compiling static library.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Compiling static library.%c", f_string_eol[0]); } f_string_dynamic_t file_name = f_string_dynamic_t_initialize; @@ -1013,7 +1013,7 @@ extern "C" { *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); break; } @@ -1025,7 +1025,7 @@ extern "C" { *status = f_file_name_directory(data_build.setting.build_sources_library.array[i].string, data_build.setting.build_sources_library.array[i].used, &source_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_file_name_directory", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "f_file_name_directory", F_true); break; } @@ -1033,21 +1033,21 @@ extern "C" { *status = fl_string_dynamic_prepend(data.path_build_objects, &source_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); break; } *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &source_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(&source_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -1075,7 +1075,7 @@ extern "C" { *status = fll_execute_arguments_add(source, source_length, &arguments); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); break; } } // for @@ -1116,7 +1116,7 @@ extern "C" { f_macro_string_dynamics_new(*status, names, 2); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamics_new", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "f_macro_string_dynamics_new", F_true); f_macro_string_dynamics_t_delete_simple(names); return; @@ -1141,12 +1141,12 @@ extern "C" { if (names.used + data_build.setting.environment.used > names.size) { if (names.used + data_build.setting.environment.used > f_array_length_t_size) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The values for the setting '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_build_setting_name_environment); - fl_color_print_to(data.error.to, data.context.set.error, "' of setting file '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", data.file_data_build_settings.string); - fl_color_print_to(data.error.to, data.context.set.error, "' is too large.%c", f_string_eol[0]); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: The values for the setting '"); + fl_color_print(data.error, data.context.set.notable, "%s", fake_build_setting_name_environment); + fl_color_print(data.error, data.context.set.error, "' of setting file '"); + fl_color_print(data.error, data.context.set.notable, "%s", data.file_data_build_settings.string); + fl_color_print(data.error, data.context.set.error, "' is too large.%c", f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(part); @@ -1158,7 +1158,7 @@ extern "C" { f_macro_string_dynamics_resize(*status, names, names.used + data_build.setting.environment.used); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true); f_macro_string_dynamic_t_delete_simple(part); f_macro_string_dynamics_t_delete_simple(names); @@ -1183,7 +1183,7 @@ extern "C" { f_macro_string_dynamic_t_delete_simple(part); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append", F_true); f_macro_string_dynamics_t_delete_simple(names); return; @@ -1261,7 +1261,7 @@ extern "C" { f_macro_string_dynamic_t_delete_simple(variable_value); if (F_status_is_error(*status) && F_status_set_fine(*status) != F_signal) { - fake_print_error(data, *status, function, F_true); + fll_error_print(data->error, *status, function, F_true); } } #endif // _di_fake_build_load_environment_ @@ -1331,12 +1331,12 @@ extern "C" { for (uint8_t i = 0; i < 1; i++) { if (!settings[i]->used) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The setting '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", names[i]); - fl_color_print_to(data.error.to, data.context.set.error, "' is required but is not specified in the settings file '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", setting_file.used ? path_file : data.file_data_build_settings.string); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: The setting '"); + fl_color_print(data.error, data.context.set.notable, "%s", names[i]); + fl_color_print(data.error, data.context.set.error, "' is required but is not specified in the settings file '"); + fl_color_print(data.error, data.context.set.notable, "%s", setting_file.used ? path_file : data.file_data_build_settings.string); + fl_color_print(data.error, data.context.set.error, "'.%c", f_string_eol[0]); failed = F_true; } @@ -1561,12 +1561,12 @@ extern "C" { if (found == F_false) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The specified mode '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", modes->array[i].string); - fl_color_print_to(data.error.to, data.context.set.error, "' is not a valid mode, according to '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: The specified mode '"); + fl_color_print(data.error, data.context.set.notable, "%s", modes->array[i].string); + fl_color_print(data.error, data.context.set.error, "' is not a valid mode, according to '"); + fl_color_print(data.error, data.context.set.notable, "%s", path_file); + fl_color_print(data.error, data.context.set.error, "'.%c", f_string_eol[0]); } error_printed = F_true; @@ -1616,14 +1616,14 @@ extern "C" { if (*status == F_status_set_error(F_string_too_large)) { if (data.error.verbosity != f_console_verbosity_quiet) { // @todo update FSS functions to return which setting index the problem happened on. - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: A setting in the build setting file '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.error.to, data.context.set.error, "' is too long.%c", f_string_eol[0]); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: A setting in the build setting file '"); + fl_color_print(data.error, data.context.set.notable, "%s", path_file); + fl_color_print(data.error, data.context.set.error, "' is too long.%c", f_string_eol[0]); } } else if (!error_printed) { - fake_print_error(data, F_status_set_fine(*status), function, F_true); + fll_error_print(data->error, F_status_set_fine(*status), function, F_true); } } else if (!fake_signal_received(data)) { @@ -1808,14 +1808,14 @@ extern "C" { if (settings_single_source[i]->used > 1) { if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: the setting '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", settings_single_name[i]); - fl_color_print_to(data.output, data.context.set.warning, "' in the file '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.output, data.context.set.warning, "' may only have a single property, only using the first: '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", settings_single_source[i]->array[0].string); - fl_color_print_to(data.output, data.context.set.warning, "'.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); + fl_color_print(data.output.stream, data.context.set.warning, "' in the file '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.output.stream, data.context.set.warning, "' may only have a single property, only using the first: '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_source[i]->array[0].string); + fl_color_print(data.output.stream, data.context.set.warning, "'.%c", f_string_eol[0]); } } @@ -1830,18 +1830,18 @@ extern "C" { *settings_single_bool[i] = F_true; if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: the setting '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", settings_single_name[i]); - fl_color_print_to(data.output, data.context.set.warning, "' in the file '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.output, data.context.set.warning, "' may be either '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_common_setting_bool_yes); - fl_color_print_to(data.output, data.context.set.warning, "' or '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_common_setting_bool_no); - fl_color_print_to(data.output, data.context.set.warning, "', defaulting to '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_common_setting_bool_yes); - fl_color_print_to(data.output, data.context.set.warning, "'.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); + fl_color_print(data.output.stream, data.context.set.warning, "' in the file '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.output.stream, data.context.set.warning, "' may be either '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_common_setting_bool_yes); + fl_color_print(data.output.stream, data.context.set.warning, "' or '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_common_setting_bool_no); + fl_color_print(data.output.stream, data.context.set.warning, "', defaulting to '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_common_setting_bool_yes); + fl_color_print(data.output.stream, data.context.set.warning, "'.%c", f_string_eol[0]); } } } @@ -1859,20 +1859,20 @@ extern "C" { *settings_single_language[i] = fake_build_language_type_c; if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: the setting '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", settings_single_name[i]); - fl_color_print_to(data.output, data.context.set.warning, "' in the file '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.output, data.context.set.warning, "' may only be one of '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_language_bash); - fl_color_print_to(data.output, data.context.set.warning, "', '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_language_c); - fl_color_print_to(data.output, data.context.set.warning, "', or '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_language_cpp); - fl_color_print_to(data.output, data.context.set.warning, "', defaulting to '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_language_c); - fl_color_print_to(data.output, data.context.set.warning, "'.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); + fl_color_print(data.output.stream, data.context.set.warning, "' in the file '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.output.stream, data.context.set.warning, "' may only be one of '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_bash); + fl_color_print(data.output.stream, data.context.set.warning, "', '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_c); + fl_color_print(data.output.stream, data.context.set.warning, "', or '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_cpp); + fl_color_print(data.output.stream, data.context.set.warning, "', defaulting to '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_language_c); + fl_color_print(data.output.stream, data.context.set.warning, "'.%c", f_string_eol[0]); } } } @@ -1890,20 +1890,20 @@ extern "C" { *settings_single_version[i] = fake_build_version_type_major; if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: the setting '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", settings_single_name[i]); - fl_color_print_to(data.output, data.context.set.warning, "' in the file '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.output, data.context.set.warning, "' may only be one of '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_version_major); - fl_color_print_to(data.output, data.context.set.warning, "', '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_version_minor); - fl_color_print_to(data.output, data.context.set.warning, "', or '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_version_micro); - fl_color_print_to(data.output, data.context.set.warning, "', defaulting to '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", fake_build_version_major); - fl_color_print_to(data.output, data.context.set.warning, "'.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]); + fl_color_print(data.output.stream, data.context.set.warning, "' in the file '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.output.stream, data.context.set.warning, "' may only be one of '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_major); + fl_color_print(data.output.stream, data.context.set.warning, "', '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_minor); + fl_color_print(data.output.stream, data.context.set.warning, "', or '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_micro); + fl_color_print(data.output.stream, data.context.set.warning, "', defaulting to '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", fake_build_version_major); + fl_color_print(data.output.stream, data.context.set.warning, "'.%c", f_string_eol[0]); } } } @@ -1913,21 +1913,21 @@ extern "C" { *status = fl_string_dynamic_append_nulless(settings_single_source[i]->array[0], settings_single_destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } if (settings_single_type[i] == 2) { *status = fl_string_append_assure(f_path_separator, f_path_separator_length, settings_single_destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } } *status = fl_string_dynamic_terminate_after(settings_single_destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } } @@ -1996,13 +1996,13 @@ extern "C" { *status = fl_string_append_assure(sources[i], lengths[i], destinations[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(destinations[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } } // for @@ -2031,13 +2031,13 @@ extern "C" { fl_color_print_TO(data.output, data.context.set.error, "' contradict, defaulting to '"); if (setting->build_shared) { - fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_enabled); + fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_enabled); } else { - fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_disabled); + fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_disabled); } - fl_color_print_to(data.output, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.error, "'.%c", f_string_eol[0]); } } else { @@ -2062,21 +2062,21 @@ extern "C" { } if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.error, "WARNING: the parameters '"); - fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled); - fl_color_print_to(data.output, data.context.set.error, "' and '"); - fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled); - fl_color_print_to(data.output, data.context.set.error, "' contradict, defaulting to '"); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.error, "WARNING: the parameters '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled); + fl_color_print(data.output.stream, data.context.set.error, "' and '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled); + fl_color_print(data.output.stream, data.context.set.error, "' contradict, defaulting to '"); if (setting->build_static) { - fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled); + fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled); } else { - fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled); + fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled); } - fl_color_print_to(data.output, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.error, "'.%c", f_string_eol[0]); } } else { @@ -2092,21 +2092,21 @@ extern "C" { if (setting->build_language == fake_build_language_type_c || setting->build_language == fake_build_language_type_cpp) { if (setting->build_shared == F_false && setting->build_static == F_false) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The build settings '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_build_setting_name_build_shared); - fl_color_print_to(data.error.to, data.context.set.error, "' and '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_build_setting_name_build_static); - fl_color_print_to(data.error.to, data.context.set.error, "' cannot both be false when using the language '"); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: The build settings '"); + fl_color_print(data.error, data.context.set.notable, "%s", fake_build_setting_name_build_shared); + fl_color_print(data.error, data.context.set.error, "' and '"); + fl_color_print(data.error, data.context.set.notable, "%s", fake_build_setting_name_build_static); + fl_color_print(data.error, data.context.set.error, "' cannot both be false when using the language '"); if (setting->build_language == fake_build_language_type_c) { - fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_build_language_c); + fl_color_print(data.error, data.context.set.notable, "%s", fake_build_language_c); } else { - fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_build_language_cpp); + fl_color_print(data.error, data.context.set.notable, "%s", fake_build_language_cpp); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -2187,7 +2187,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_file_name_base", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "f_file_name_base", F_true); return; } @@ -2196,7 +2196,7 @@ extern "C" { *status = fl_string_dynamic_append_nulless(data.path_build_stage, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } @@ -2204,14 +2204,14 @@ extern "C" { *status = fl_string_append(data.process.string, data.process.used, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append", F_true); break; } *status = fl_string_append(fake_build_stage_separate, fake_build_stage_separate_length, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append", F_true); break; } } @@ -2219,35 +2219,35 @@ extern "C" { *status = fl_string_append_nulless(names[i], lengths[i], values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = fl_string_append(fake_build_stage_separate, fake_build_stage_separate_length, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append", F_true); break; } *status = fl_string_dynamic_append(settings_file_base, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); break; } *status = fl_string_append(fake_build_stage_built, fake_build_stage_built_length, values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append", F_true); break; } *status = fl_string_dynamic_terminate_after(values[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } } // for @@ -2262,8 +2262,8 @@ extern "C" { if (!data_build.setting.build_sources_library.used) return; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Compiling static objects.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Compiling static objects.%c", f_string_eol[0]); } f_string_dynamic_t file_name = f_string_dynamic_t_initialize; @@ -2300,7 +2300,7 @@ extern "C" { *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); break; } @@ -2312,7 +2312,7 @@ extern "C" { *status = f_file_name_directory(data_build.setting.build_sources_library.array[i].string, data_build.setting.build_sources_library.array[i].used, &destination_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_file_name_directory", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "f_file_name_directory", F_true); break; } @@ -2320,21 +2320,21 @@ extern "C" { *status = fl_string_dynamic_prepend(data.path_build_objects, &destination_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); break; } *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &destination_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(&destination_path); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -2347,10 +2347,10 @@ extern "C" { if (*status == F_false) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The path '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination_path.string); - fl_color_print_to(data.error.to, data.context.set.error, "' exists but is not a directory.%c", f_string_eol[0]); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: The path '"); + fl_color_print(data.error, data.context.set.notable, "%s", destination_path.string); + fl_color_print(data.error, data.context.set.error, "' exists but is not a directory.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -2361,24 +2361,24 @@ extern "C" { if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found_not) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The path '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination_path.string); - fl_color_print_to(data.error.to, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]); + fprintf(data.error.stream, "%c", f_string_eol[0]); + fl_color_print(data.error, data.context.set.error, "ERROR: The path '"); + fl_color_print(data.error, data.context.set.notable, "%s", destination_path.string); + fl_color_print(data.error, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]); } else { - fake_print_error_file(data, F_status_set_fine(*status), "f_directory_create", destination_path.string, "create", F_false, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_create", F_true, destination_path.string, "create", fll_error_file_type_directory); } break; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Directory '%s' created.%c", destination_path.string, f_string_eol[0]); + fprintf(data.output.stream, "Directory '%s' created.%c", destination_path.string, f_string_eol[0]); } } else if (F_status_is_error(*status)) { - fake_print_error_file(data, F_status_set_fine(*status), "f_directory_exists", destination_path.string, "create", F_false, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_directory_exists", F_true, destination_path.string, "create", fll_error_file_type_directory); break; } @@ -2428,7 +2428,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_false, F_true, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); break; } @@ -2468,8 +2468,8 @@ extern "C" { if (F_status_is_fine(status)) { if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Building project%c", data_build.setting.project_name.used ? ' ' : 0); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Building project%c", data_build.setting.project_name.used ? ' ' : 0); if (data_build.setting.project_name.used) { fl_color_print_code(f_type_output, data.context.notable); @@ -2477,7 +2477,7 @@ extern "C" { fl_color_print_code(f_type_output, data.context.reset); } - fl_color_print(f_type_output, data.context.set.important, ".%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, ".%c", f_string_eol[0]); } } @@ -2592,8 +2592,8 @@ extern "C" { if (!data_build.setting.build_sources_program.used) return; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Compiling shared program.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Compiling shared program.%c", f_string_eol[0]); } f_string_dynamics_t arguments = f_string_dynamics_t_initialize; @@ -2669,7 +2669,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_true, F_false, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return; @@ -2691,8 +2691,8 @@ extern "C" { if (!data_build.setting.build_sources_program.used) return; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Compiling static program.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Compiling static program.%c", f_string_eol[0]); } f_string_dynamics_t arguments = f_string_dynamics_t_initialize; @@ -2784,7 +2784,7 @@ extern "C" { fake_build_arguments_standard_add(data, data_build, F_false, F_false, &arguments, status); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); + fll_error_print(data->error, F_status_set_fine(*status), "fll_execute_arguments_add", F_true); f_macro_string_dynamics_t_delete_simple(arguments); return; @@ -2816,7 +2816,7 @@ extern "C" { *status = f_file_touch(file.string, mode.regular, F_false); if (F_status_is_error(*status)) { - fake_print_error_file(data, F_status_set_fine(*status), "f_file_touch", file.string, "touch", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(*status), "f_file_touch", F_true, file.string, "touch", fll_error_file_type_file); } } #endif // _di_fake_build_touch_ diff --git a/level_3/fake/c/private-clean.c b/level_3/fake/c/private-clean.c index 788288f..6b32445 100644 --- a/level_3/fake/c/private-clean.c +++ b/level_3/fake/c/private-clean.c @@ -14,10 +14,10 @@ extern "C" { f_status_t status = F_none; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Deleting all files within build directory '"); - fl_color_print(f_type_output, data.context.set.notable, "%s", data.path_build.string); - fl_color_print(f_type_output, data.context.set.important, "'.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Deleting all files within build directory '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", data.path_build.string); + fl_color_print(data.output.stream, data.context.set.important, "'.%c", f_string_eol[0]); } if (fake_signal_received(data)) { @@ -33,14 +33,14 @@ extern "C" { if (F_status_set_fine(status) == F_file_found_not) { if (data.error.verbosity == f_console_verbosity_verbose) { - printf("The build directory '%s' does not exist.%c", data.path_build.string, f_string_eol[0]); + fprintf(data.output.stream, "The build directory '%s' does not exist.%c", data.path_build.string, f_string_eol[0]); } status = F_none; } if (F_status_is_error(status)) { - fake_print_error(data, F_status_set_fine(status), "f_directory_remove", F_true); + fll_error_print(data.error, F_status_set_fine(status), "f_directory_remove", F_true); return status; } @@ -55,6 +55,7 @@ extern "C" { const int result = remove(path); if (!result) { + // @todo in order to get this working, the recursive function that calls this needs to be rewritten with more flexibility or provide a higher-level equivalent function. printf("Removed '%s'.%c", path, f_string_eol[0]); } diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index fbafcf4..5b68139 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -13,15 +13,15 @@ extern "C" { if (F_status_is_error(*status)) return 1; if (data.error.verbosity == f_console_verbosity_verbose) { - printf("%s", program.string); + fprintf(data.output.stream, "%s", program.string); for (f_array_length_t i = 0; i < arguments.used; i++) { if (!arguments.array[i].used) continue; - printf(" %s", arguments.array[i].string); + fprintf(data.output.stream, " %s", arguments.array[i].string); } // for - printf("%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); // flush to stdout before executing command. fflush(f_type_output); @@ -60,14 +60,14 @@ extern "C" { if (F_status_set_fine(*status) == F_file_found_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to find program '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", program.used ? program.string : ""); - fl_color_print_to(data.error.to, data.context.set.error, "' for executing.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to find program '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", program.used ? program.string : ""); + fl_color_print(data.error.to.stream, data.context.set.error, "' for executing.%c", f_string_eol[0]); } } else { - fake_print_error(data, F_status_set_fine(*status), "fll_execute_program_environment", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fll_execute_program_environment", F_true); } } @@ -102,7 +102,7 @@ extern "C" { f_macro_string_dynamic_t_new((status), (*buffer), size_file); if (F_status_is_error(status)) { - fake_print_error_file(data, F_status_set_fine(status), name_function, path_file, "allocate buffer size for", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), name_function, F_true, path_file, "allocate buffer size for", fll_error_file_type_file); f_macro_string_dynamic_t_delete_simple((*buffer)); return status; @@ -135,7 +135,7 @@ extern "C" { } if (F_status_is_error(status)) { - fake_print_error_file(data, F_status_set_fine(status), name_function, path_file, "read", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), name_function, F_true, path_file, "read", fll_error_file_type_file); f_macro_string_dynamic_t_delete_simple((*buffer)); } @@ -643,10 +643,10 @@ extern "C" { if (F_status_is_error(status)) { if (fake_print_error(*data, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to process the parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return status; @@ -654,12 +654,12 @@ extern "C" { if (status == F_false) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process); - fl_color_print_to(data->error.to, data->context.set.error, "' parameters value '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", arguments.argv[location]); - fl_color_print_to(data->error.to, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameters value '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.argv[location]); + fl_color_print(data->error.to.stream, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol[0]); } return F_status_set_error(F_parameter); @@ -672,10 +672,10 @@ extern "C" { if (F_status_is_error(status)) { if (status == F_status_set_error(F_string_too_large)) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); - fl_color_print_to(data->error.to, data->context.set.error, "' is too long.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); + fl_color_print(data->error.to.stream, data->context.set.error, "' is too long.%c", f_string_eol[0]); } } else { @@ -691,10 +691,10 @@ extern "C" { if (length == 0 || status == F_data_not) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); - fl_color_print_to(data->error.to, data->context.set.error, "' must not be empty and must not contain only whitespace.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); + fl_color_print(data->error.to.stream, data->context.set.error, "' must not be empty and must not contain only whitespace.%c", f_string_eol[0]); } } } @@ -769,10 +769,10 @@ extern "C" { if (F_status_is_error(status)) { if (fake_print_error(*data, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to process parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return status; @@ -783,10 +783,10 @@ extern "C" { if (F_status_is_error(status)) { if (fake_print_error(*data, F_status_set_fine(status), "f_macro_string_dynamic_t_new", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to load default for the parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to load default for the parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return status; @@ -803,10 +803,10 @@ extern "C" { if (F_status_is_error(status)) { if (fake_print_error(*data, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to process the parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return status; @@ -826,10 +826,10 @@ extern "C" { if (F_status_is_error(status)) { if (fake_print_error(*data, F_status_set_fine(status), "f_utf_is_word", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to process the parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return status; @@ -837,12 +837,12 @@ extern "C" { if (status == F_false) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define); - fl_color_print_to(data->error.to, data->context.set.error, "' parameters value '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", data->define.array[i].string); - fl_color_print_to(data->error.to, data->context.set.error, "' contains non-word characters.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameters value '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", data->define.array[i].string); + fl_color_print(data->error.to.stream, data->context.set.error, "' contains non-word characters.%c", f_string_eol[0]); } return F_status_set_error(F_parameter); @@ -860,10 +860,10 @@ extern "C" { if (F_status_is_error(status)) { if (fake_print_error(*data, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to process the parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return status; @@ -883,10 +883,10 @@ extern "C" { if (F_status_is_error(status)) { if (fake_print_error(*data, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to process the parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return status; @@ -894,12 +894,12 @@ extern "C" { if (status == F_false) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); - fl_color_print_to(data->error.to, data->context.set.error, "' parameters value '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", data->mode.array[i].string); - fl_color_print_to(data->error.to, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameters value '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", data->mode.array[i].string); + fl_color_print(data->error.to.stream, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.%c", f_string_eol[0]); } return F_status_set_error(F_parameter); @@ -936,8 +936,8 @@ extern "C" { case F_signal_termination: if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ALERT: An appropriate exit signal has been received, now aborting.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ALERT: An appropriate exit signal has been received, now aborting.%c", f_string_eol[0]); } return F_true; @@ -1003,16 +1003,17 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) != F_directory_found_not || parameters_required[i]) { - fake_print_error_file(data, F_status_set_fine(status), "f_file_stat", parameters_value[i]->string, "access", F_false, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), "f_file_stat", F_true, parameters_value[i]->string, "access", fll_error_file_type_directory); + return status; } } } else if (parameters_required[i]) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: No valid path for the (required) directory parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); - fl_color_print_to(data.error.to, data.context.set.error, "' was found.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: No valid path for the (required) directory parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]); + fl_color_print(data.error.to.stream, data.context.set.error, "' was found.%c", f_string_eol[0]); return F_status_set_error(F_directory_found_not); } @@ -1023,20 +1024,20 @@ extern "C" { #endif // _di_fake_validate_parameter_directories_ #ifndef _di_fake_verbose_print_clone_ - void fake_verbose_print_clone(const int output, const f_string_t source, const f_string_t destination) { - dprintf(output, "Cloned '%s' to '%s'.%c", source, destination, f_string_eol[0]); + void fake_verbose_print_clone(const f_file_t output, const f_string_t source, const f_string_t destination) { + fprintf(output.stream, "Cloned '%s' to '%s'.%c", source, destination, f_string_eol[0]); } #endif // _di_fake_verbose_print_clone_ #ifndef _di_fake_verbose_print_copy_ - void fake_verbose_print_copy(const int output, const f_string_t source, const f_string_t destination) { - dprintf(output, "Copied '%s' to '%s'.%c", source, destination, f_string_eol[0]); + void fake_verbose_print_copy(const f_file_t output, const f_string_t source, const f_string_t destination) { + fprintf(output.stream, "Copied '%s' to '%s'.%c", source, destination, f_string_eol[0]); } #endif // _di_fake_verbose_print_copy_ #ifndef _di_fake_verbose_print_move_ - void fake_verbose_print_move(const int output, const f_string_t source, const f_string_t destination) { - dprintf(output, "Moved '%s' to '%s'.%c", source, destination, f_string_eol[0]); + void fake_verbose_print_move(const f_file_t output, const f_string_t source, const f_string_t destination) { + fprintf(output.stream, "Moved '%s' to '%s'.%c", source, destination, f_string_eol[0]); } #endif // _di_fake_verbose_print_move_ diff --git a/level_3/fake/c/private-fake.h b/level_3/fake/c/private-fake.h index 2145ef7..857457d 100644 --- a/level_3/fake/c/private-fake.h +++ b/level_3/fake/c/private-fake.h @@ -173,42 +173,42 @@ extern "C" { * Helper function for performing a verbose print for a file clone operation. * * @param output - * A file descriptor to print to, such as f_type_desciptor_output. + * A file to print to. * @param source * The source string. * @param destination * The destination string. */ #ifndef _di_fake_verbose_print_clone_ - extern void fake_verbose_print_clone(const int output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal; + extern void fake_verbose_print_clone(const f_file_t output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal; #endif // _di_fake_verbose_print_clone_ /** * Helper function for performing a verbose print for a file copy operation. * * @param output - * A file descriptor to print to, such as f_type_desciptor_output. + * A file to print to. * @param source * The source string. * @param destination * The destination string. */ #ifndef _di_fake_verbose_print_copy_ - extern void fake_verbose_print_copy(const int output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal; + extern void fake_verbose_print_copy(const f_file_t output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal; #endif // _di_fake_verbose_print_copy_ /** * Helper function for performing a verbose print for a file move operation. * * @param output - * A file descriptor to print to, such as f_type_desciptor_output. + * A file to print to. * @param source * The source string. * @param destination * The destination string. */ #ifndef _di_fake_verbose_print_move_ - extern void fake_verbose_print_move(const int output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal; + extern void fake_verbose_print_move(const f_file_t output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal; #endif // _di_fake_verbose_print_move_ #ifdef __cplusplus diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index a4ff71f..365062a 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -44,7 +44,7 @@ extern "C" { #endif // _di_fake_make_assure_inside_project_ #ifndef _di_fake_make_get_id_group_ - f_return_status fake_make_get_id_group(const fake_data_t data, const f_string_static_t buffer, gid_t *id) { + f_return_status fake_make_get_id_group(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, gid_t *id) { const f_string_range_t range = f_macro_string_range_t_initialize(buffer.used); f_number_unsigned_t number = 0; @@ -58,15 +58,15 @@ extern "C" { status = f_account_id_group_by_name(buffer.string, id); if (F_status_is_error(status)) { - fake_print_message(data, status, "f_account_id_group_by_name", F_true, print); + fake_print_message(data, status, "f_account_id_group_by_name", F_true); return F_status_set_error(status); } else if (status == F_exist_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - fl_color_print_to(print.to, print.context, "%s: The group name '", print.prefix); - fl_color_print_to(print.to, data.context.set.notable, "%s", buffer.string); - fl_color_print_to(print.to, print.context, "' was not found.%c", f_string_eol[0]); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, print.context, "%s: The group name '", data.error.prefix); + fl_color_print(error.to.stream, data.context.set.notable, "%s", buffer.string); + fl_color_print(error.to.stream, print.context, "' was not found.%c", f_string_eol[0]); } return F_status_set_error(F_failure); @@ -75,15 +75,15 @@ extern "C" { return F_none; } - fake_print_message(data, status, "fl_conversion_string_to_number_unsigned", F_true, print); + fake_print_message(data, status, "fl_conversion_string_to_number_unsigned", F_true); return F_status_set_error(status); } else if (number > f_type_size_32_unsigned) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - fl_color_print_to(print.to, print.context, "%s: The number '", print.prefix); - fl_color_print_to(print.to, data.context.set.notable, "%llu", number); - fl_color_print_to(print.to, print.context, "' is too large.%c", f_string_eol[0]); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, print.context, "%s: The number '", data.error.prefix); + fl_color_print(error.to.stream, data.context.set.notable, "%llu", number); + fl_color_print(error.to.stream, print.context, "' is too large.%c", f_string_eol[0]); } } @@ -93,9 +93,9 @@ extern "C" { #endif // _di_fake_make_get_id_group_ #ifndef _di_fake_make_get_id_mode_ - f_return_status fake_make_get_id_mode(const fake_data_t data, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) { + f_return_status fake_make_get_id_mode(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) { if (!buffer.used) { - fake_print_message(data, F_parameter, "fake_make_get_id_mode", F_true, print); + fake_print_message(data, F_parameter, "fake_make_get_id_mode", F_true); return F_status_set_error(F_parameter); } @@ -104,13 +104,13 @@ extern "C" { if (F_status_is_error(status)) { if (data.error.verbosity != f_console_verbosity_quiet) { if (F_status_set_fine(status) == F_syntax) { - dprintf(print.to, "%c", f_string_eol[0]); - fl_color_print_to(print.to, print.context, "%s: The mode '", print.prefix); - fl_color_print_to(print.to, data.context.set.notable, "%s", buffer.string); - fl_color_print_to(print.to, print.context, "' is invalid.%c", f_string_eol[0]); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, print.context, "%s: The mode '", data.error.prefix); + fl_color_print(error.to.stream, data.context.set.notable, "%s", buffer.string); + fl_color_print(error.to.stream, print.context, "' is invalid.%c", f_string_eol[0]); } else { - fake_print_message(data, status, "f_file_mode_from_string", F_true, print); + fake_print_message(data, status, "f_file_mode_from_string", F_true); } } @@ -136,15 +136,15 @@ extern "C" { status = f_account_id_user_by_name(buffer.string, id); if (F_status_is_error(status)) { - fake_print_message(data, status, "f_account_id_user_by_name", F_true, print); + fake_print_message(data, status, "f_account_id_user_by_name", F_true); return F_status_set_error(status); } else if (status == F_exist_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - fl_color_print_to(print.to, print.context, "%s: The user name '", print.prefix); - fl_color_print_to(print.to, data.context.set.notable, "%s", buffer.string); - fl_color_print_to(print.to, print.context, "' was not found.%c", f_string_eol[0]); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, print.context, "%s: The user name '", data.error.prefix); + fl_color_print(error.to.stream, data.context.set.notable, "%s", buffer.string); + fl_color_print(error.to.stream, print.context, "' was not found.%c", f_string_eol[0]); } return F_status_set_error(F_failure); @@ -153,15 +153,15 @@ extern "C" { return F_none; } - fake_print_message(data, status, "fl_conversion_string_to_number_unsigned", F_true, print); + fake_print_message(data, status, "fl_conversion_string_to_number_unsigned", F_true); return F_status_set_error(status); } else if (number > f_type_size_32_unsigned) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(print.to, "%c", f_string_eol[0]); - fl_color_print_to(print.to, print.context, "%s: The number '", print.prefix); - fl_color_print_to(print.to, data.context.set.notable, "%llu", number); - fl_color_print_to(print.to, print.context, "' is too large.%c", f_string_eol[0]); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, print.context, "%s: The number '", data.error.prefix); + fl_color_print(error.to.stream, data.context.set.notable, "%llu", number); + fl_color_print(error.to.stream, print.context, "' is too large.%c", f_string_eol[0]); } } @@ -189,10 +189,10 @@ extern "C" { if (!data_make->buffer.used) { if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: the fakefile '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", data.file_data_build_fakefile.string); - fl_color_print_to(data.output, data.context.set.warning, "' is empty."); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the fakefile '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", data.file_data_build_fakefile.string); + fl_color_print(data.output.stream, data.context.set.warning, "' is empty."); } return; @@ -230,7 +230,7 @@ extern "C" { f_macro_fss_nameds_t_new((*status), data_make->fakefile, list_objects.used); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_macro_fss_nameds_t_new", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "f_macro_fss_nameds_t_new", F_true); f_macro_fss_set_t_delete_simple(settings); f_macro_fss_objects_t_delete_simple(list_objects); @@ -304,12 +304,12 @@ extern "C" { if (missing_main) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The fakefile '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", data.file_data_build_fakefile.string); - fl_color_print_to(data.error.to, data.context.set.error, "' is missing the required '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_make_section_main); - fl_color_print_to(data.error.to, data.context.set.error, "' object.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The fakefile '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", data.file_data_build_fakefile.string); + fl_color_print(data.error.to.stream, data.context.set.error, "' is missing the required '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_make_section_main); + fl_color_print(data.error.to.stream, data.context.set.error, "' object.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -347,7 +347,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), function_name, F_true); + fll_error_print(data.error, F_status_set_fine(*status), function_name, F_true); f_macro_fss_set_t_delete_simple(settings); return; @@ -394,13 +394,13 @@ extern "C" { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, settings.contents.array[i].array[j], &name_define); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true); break; } *status = fl_string_dynamic_terminate_after(&name_define); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -416,7 +416,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->setting_build.environment); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true); break; } } @@ -426,7 +426,7 @@ extern "C" { *status = fl_string_dynamic_append(name_define, &data_make->setting_build.environment.array[data_make->setting_build.environment.used]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); break; } @@ -435,17 +435,17 @@ extern "C" { data_make->setting_build.environment.used++; } else if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: The environment name '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", name_define.string); - fl_color_print_to(data.output, data.context.set.warning, "' is already added.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: The environment name '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", name_define.string); + fl_color_print(data.output.stream, data.context.set.warning, "' is already added.%c", f_string_eol[0]); } } else if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: The environment name '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", name_define.string); - fl_color_print_to(data.output, data.context.set.warning, "' is invalid, ignoring.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: The environment name '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", name_define.string); + fl_color_print(data.output.stream, data.context.set.warning, "' is invalid, ignoring.%c", f_string_eol[0]); } name_define.used = 0; @@ -557,7 +557,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), function_name, F_true); + fll_error_print(data.error, F_status_set_fine(*status), function_name, F_true); break; } } // for @@ -591,7 +591,7 @@ extern "C" { fake_build_load_setting(data, stub, &data_make->setting_build, status); if (F_status_is_error(*status) && *status != F_status_set_error(F_signal)) { - fake_print_error(data, F_status_set_fine(*status), "fake_build_load_setting", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fake_build_load_setting", F_true); } } @@ -612,7 +612,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_partial_append", F_true); f_macro_fss_set_t_delete_simple(settings); return; @@ -646,7 +646,7 @@ extern "C" { *status = fll_fss_snatch_map_apart(data_make->buffer, settings.objects, settings.contents, settings_name, settings_length, 2, settings_value, 0); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fll_fss_snatch_map_apart", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fll_fss_snatch_map_apart", F_true); f_macro_string_map_multis_t_delete_simple(define); f_macro_fss_set_t_delete_simple(settings); @@ -670,7 +670,7 @@ extern "C" { *status = fl_string_dynamic_mash(" ", 1, define.array[i].value.array[j], &combined); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_mash_nulless", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_mash_nulless", F_true); break; } } // for @@ -679,7 +679,7 @@ extern "C" { *status = fl_string_dynamic_terminate_after(&combined); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; } @@ -690,20 +690,20 @@ extern "C" { *status = f_environment_set(define.array[i].name.string, combined.string, F_true); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "f_environment_set", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "f_environment_set", F_true); break; } } else { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Invalid characters in the define setting name '"); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Invalid characters in the define setting name '"); - fl_color_print_code(f_type_error, data.context.notable); - f_print_dynamic(f_type_error, define.array[i].name); - fl_color_print_code(f_type_error, data.context.reset); + fl_color_print_code(data.error.to.stream, data.context.notable); + f_print_dynamic(data.error.to.stream, define.array[i].name); + fl_color_print_code(data.error.to.stream, data.context.reset); - fl_color_print_to(data.error.to, data.context.set.error, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is %c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is %c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -733,7 +733,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->parameter.color); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); return; } } @@ -776,7 +776,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append", F_true); return; } else { @@ -789,7 +789,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->parameter.verbosity); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); return; } } @@ -832,7 +832,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append", F_true); return; } else { @@ -872,7 +872,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); return; } } @@ -889,7 +889,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append", F_true); return; } else { @@ -900,7 +900,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); return; } } @@ -908,7 +908,7 @@ extern "C" { *status = fl_string_dynamic_append(source[i]->array[j], &destination[i]->array[destination[i]->used]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); return; } else { @@ -965,7 +965,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); return; } } @@ -982,7 +982,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_append", F_true); return; } else { @@ -993,7 +993,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, destination[i]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true); return; } } @@ -1001,7 +1001,7 @@ extern "C" { *status = fl_string_dynamic_append(*source[i], &destination[i]->array[destination[i]->used]); if (F_status_is_error(*status)) { - fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); + fll_error_print(data.error, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); return; } else { @@ -1015,13 +1015,13 @@ extern "C" { #ifndef _di_fake_make_operate_ f_return_status fake_make_operate(const fake_data_t data) { - if (fake_signal_received(data)) { + if (fake_signal_received(*data)) { return F_signal; } - if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Making project.%c", f_string_eol[0]); + if (data->error.verbosity != f_console_verbosity_quiet) { + fprintf(data->output.stream, "%c", f_string_eol[0]); + fl_color_print(data->output.stream, data->context.set.important, "Making project.%c", f_string_eol[0]); } f_status_t status = F_none; @@ -1033,11 +1033,11 @@ extern "C" { f_macro_string_dynamics_new(status, data_make.path.stack, f_memory_default_allocation_step); if (F_status_is_error(status)) { - fake_print_error(data, F_status_set_fine(status), "f_macro_string_dynamics_new", F_true); + fll_error_print(data->error, F_status_set_fine(status), "f_macro_string_dynamics_new", F_true); return status; } - if (fake_signal_received(data)) { + if (fake_signal_received(*data)) { fake_macro_make_data_t_delete_simple(data_make); return F_signal; } @@ -1045,7 +1045,7 @@ extern "C" { status = f_path_current(F_true, &data_make.path.stack.array[0]); if (F_status_is_error(status)) { - fake_print_error(data, F_status_set_fine(status), "f_path_current", F_true); + fll_error_print(data->error, F_status_set_fine(status), "f_path_current", F_true); fake_macro_make_data_t_delete_simple(data_make); return status; @@ -1054,7 +1054,7 @@ extern "C" { status = f_directory_open(data_make.path.stack.array[0].string, F_false, &data_make.path.top); if (F_status_is_error(status)) { - fake_print_error(data, F_status_set_fine(status), "f_directory_open", F_true); + fll_error_print(data->error, F_status_set_fine(status), "f_directory_open", F_true); fake_macro_make_data_t_delete_simple(data_make); return status; @@ -1062,11 +1062,11 @@ extern "C" { data_make.path.stack.used = 1; - f_macro_mode_t_set_default_umask(mode, data.umask); + f_macro_mode_t_set_default_umask(mode, data->umask); - fake_make_load_parameters(data, &data_make, &status); + fake_make_load_parameters(*data, &data_make, &status); - fake_make_load_fakefile(data, &data_make, &status); + fake_make_load_fakefile(*data, &data_make, &status); if (F_status_is_error(status)) { fake_macro_make_data_t_delete_simple(data_make); @@ -1080,20 +1080,23 @@ extern "C" { } if (data_make.setting_make.fail == fake_make_operation_fail_type_exit) { - data_make.print.prefix = fake_make_print_error; - data_make.print.context = data.context.set.error; - data_make.print.to = f_type_error; + data_make.error.prefix = fake_make_print_error; + data_make.error.context = data_make.context.set.error; + data_make.error.to.stream = f_type_error; + data_make.error.to.id = f_type_descriptor_error; } else if (data_make.setting_make.fail == fake_make_operation_fail_type_warn) { - data_make.print.prefix = fake_make_print_warning; - data_make.print.context = data.context.set.warning; - data_make.print.to = f_type_warning; + data_make.error.prefix = fake_make_print_warning; + data_make.error.context = data_make.context.set.warning; + data_make.error.to.stream = f_type_warning; + data_make.error.to.id = f_type_descriptor_warning; } else { - data_make.print.to = 0; + data_make.error.to.stream = 0; + data_make.error.to.id = -1; } - fake_make_operate_section(data, data_make.main, &data_make, §ion_stack, &status); + fake_make_operate_section(*data, data_make.main, &data_make, §ion_stack, &status); if (data_make.path.current > 0) { f_file_close(&data_make.path.current); @@ -1102,13 +1105,13 @@ extern "C" { { f_status_t status_path = f_path_change_at(data_make.path.top); - if (F_status_is_error(status_path) && data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: Failed change back to orignal path '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", data_make.path.stack.array[0].string); - fl_color_print_to(data.output, data.context.set.warning, "', status code = "); - fl_color_print_to(data.output, data.context.set.notable, "%llu", F_status_set_fine(status_path)); - fl_color_print_to(data.output, data.context.set.warning, ".%c", f_string_eol[0]); + if (F_status_is_error(status_path) && data->error.verbosity == f_console_verbosity_verbose) { + fprintf(data->output.stream, "%c", f_string_eol[0]); + fl_color_print(data->output.stream, data->context.set.warning, "WARNING: Failed change back to orignal path '"); + fl_color_print(data->output.stream, data->context.set.notable, "%s", data_make.path.stack.array[0].string); + fl_color_print(data->output.stream, data->context.set.warning, "', status code = "); + fl_color_print(data->output.stream, data->context.set.notable, "%llu", F_status_set_fine(status_path)); + fl_color_print(data->output.stream, data->context.set.warning, ".%c", f_string_eol[0]); } } @@ -1136,7 +1139,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(content.used, arguments); if (F_status_is_error(*status) || *status == F_string_too_large) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true, data_make->error); return; } } @@ -1222,7 +1225,7 @@ extern "C" { *status = fl_iki_read(&data_make->buffer, &range, &iki_variable, &iki_vocabulary, &iki_content); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_iki_read", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_iki_read", F_true, data_make->error); break; } @@ -1230,7 +1233,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true, data_make->error); return; } } @@ -1243,7 +1246,7 @@ extern "C" { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, range, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true, data_make->error); break; } } @@ -1259,7 +1262,7 @@ extern "C" { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, range, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true, data_make->error); break; } } @@ -1278,7 +1281,7 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_compare", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_compare", F_true, data_make->error); break; } @@ -1292,7 +1295,7 @@ extern "C" { *status = fl_string_dynamic_append(data_make->setting_make.parameter.array[0].value.array[0], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true, data_make->error); break; } } @@ -1300,7 +1303,7 @@ extern "C" { *status = fl_string_append("0", 1, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->error); break; } } @@ -1316,7 +1319,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true, data_make->error); return; } } @@ -1327,7 +1330,7 @@ extern "C" { *status = fl_string_append(" ", 1, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->error); break; } } @@ -1335,7 +1338,7 @@ extern "C" { *status = fl_string_dynamic_append(reserved_value[k]->array[l], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true, data_make->error); break; } } // for @@ -1368,7 +1371,7 @@ extern "C" { *status = fl_string_append(" ", 1, &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->error); break; } } @@ -1376,7 +1379,7 @@ extern "C" { *status = fl_string_dynamic_append_nulless(parameter->array[k].value.array[l], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true, data_make->error); break; } } // for @@ -1386,7 +1389,7 @@ extern "C" { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamics_size_increase", F_true, data_make->error); break; } } @@ -1396,14 +1399,14 @@ extern "C" { *status = fl_string_dynamic_append_nulless(parameter->array[k].value.array[l], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true, data_make->error); break; } *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true, data_make->error); break; } @@ -1415,7 +1418,7 @@ extern "C" { break; } else if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_compare", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_compare", F_true, data_make->error); break; } } // for @@ -1427,7 +1430,7 @@ extern "C" { *status = fake_make_operate_expand_build(data, quoteds.array[i], iki_content.array[j], data_make, arguments); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fake_make_operate_expand_build", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fake_make_operate_expand_build", F_true, data_make->error); break; } } @@ -1436,7 +1439,7 @@ extern "C" { *status = fake_make_operate_expand_environment(data, quoteds.array[i], iki_content.array[j], data_make, arguments); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fake_make_operate_expand_environment", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fake_make_operate_expand_environment", F_true, data_make->error); break; } } @@ -1460,14 +1463,14 @@ extern "C" { if (F_status_is_error_not(*status)) { *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used - 1]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true, data_make->error); break; } } } if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true, data_make->error); break; } } @@ -1476,7 +1479,7 @@ extern "C" { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, content.array[i], &arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_append_nulless", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_append_nulless", F_true, data_make->error); break; } } @@ -1486,7 +1489,7 @@ extern "C" { *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true, data_make->error); break; } @@ -1847,7 +1850,7 @@ extern "C" { if (id_section > data_make->fakefile.used) { *status = F_status_set_error(F_parameter); - fake_print_message(data, F_parameter, "fake_make_operate_section", F_true, data_make->print); + fake_print_message(data, F_parameter, "fake_make_operate_section", F_true, data_make->error); return; } @@ -1856,7 +1859,7 @@ extern "C" { *status = fl_string_lengths_size_increase(f_memory_default_allocation_step, section_stack); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true, data_make->error); return; } } @@ -1868,15 +1871,15 @@ extern "C" { const f_fss_named_t *section = &data_make->fakefile.array[id_section]; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Processing Section '"); + fl_color_print(data.output.stream, data.context.set.important, "Processing Section '"); fl_color_print_code(f_type_output, data.context.notable); f_print_dynamic_partial(f_type_output, data_make->buffer, section->name); fl_color_print_code(f_type_output, data.context.reset); - fl_color_print(f_type_output, data.context.set.important, "'.%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "'.%c", f_string_eol[0]); } if (!section->objects.used) { @@ -2021,13 +2024,13 @@ extern "C" { } // for if (!operation) { - fake_print_message_section_operation_unknown(data, data_make->buffer, section->name, section->objects.array[i], data_make->print); + fake_print_message_section_operation_unknown(data, data_make->buffer, section->name, section->objects.array[i], data_make->error); *status = F_status_set_error(F_invalid); } else if (operation == fake_make_operation_type_operate) { if (section_stack->used == fake_make_section_stack_max) { - fake_print_message_section_operation_stack_max(data, data_make->buffer, section->name, section->objects.array[i], fake_make_section_stack_max, data_make->print); + fake_print_message_section_operation_stack_max(data, data_make->buffer, section->name, section->objects.array[i], fake_make_section_stack_max, data_make->error); *status = F_status_set_error(F_recurse); } @@ -2125,12 +2128,12 @@ extern "C" { // break acts identical to fail when at the top of the stack. if (F_status_set_fine(*status) == F_signal_abort && !section_stack->used) { data_make->setting_make.fail = fake_make_operation_fail_type_exit; - data_make->print.prefix = fake_make_print_error; - data_make->print.context = data.context.set.error; - data_make->print.to = f_type_error; + data_make->error.prefix = fake_make_print_error; + data_make->error.context = data.context.set.error; + data_make->error.to = f_type_error; } - fake_print_message_section_operation_failed(data, data_make->buffer, section->name, section->objects.array[i], data_make->print); + fake_print_message_section_operation_failed(data, data_make->buffer, section->name, section->objects.array[i], data_make->error); // F_signal_abort is used by the break section operation. if (F_status_set_fine(*status) == F_signal_abort) { @@ -2182,7 +2185,7 @@ extern "C" { if (i == section->objects.used && (operation_if == fake_make_operation_if_type_true_next || operation_if == fake_make_operation_if_type_false_next || operation_if == fake_make_operation_if_type_else_true || operation_if == fake_make_operation_if_type_else_false)) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { const char *type_name = 0; if (operation_if == fake_make_operation_if_type_true_next || operation_if == fake_make_operation_if_type_false_next) { @@ -2192,13 +2195,13 @@ extern "C" { type_name = fake_make_operation_else; } - fprintf(data_make->print.to, "%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Incomplete '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", type_name); - fl_color_print(data_make->print.to, data_make->print.context, "' at end of section.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Incomplete '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", type_name); + fl_color_print(data.error.to.stream, data_make->error.context, "' at end of section.%c", f_string_eol[0]); } - fake_print_message_section_operation_failed(data, data_make->buffer, section->name, section->objects.array[section->objects.used - 1], data_make->print); + fake_print_message_section_operation_failed(data, data_make->buffer, section->name, section->objects.array[section->objects.used - 1], data_make->error); *status = F_status_set_error(F_failure); } @@ -2223,7 +2226,7 @@ extern "C" { int return_code = fake_execute(data, data_make->environment, data_make->setting_build.build_indexer, arguments, status); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fake_execute", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fake_execute", F_true, data_make->error); } fake_make_operate_process_return(data, return_code, data_make, status); @@ -2244,7 +2247,7 @@ extern "C" { } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Breaking as '%s'.", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); + fprintf(data.output.stream, "Breaking as '%s'.", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); } return; @@ -2308,7 +2311,7 @@ extern "C" { status_file = f_directory_is(arguments.array[total].string); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[1].string, "identify", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[1].string, "identify", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); return; } @@ -2342,7 +2345,7 @@ extern "C" { status_file = fl_directory_clone(arguments.array[i].string, destination, arguments.array[i].used, destination_length, F_true, recurse); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "fl_directory_clone", arguments.array[i].string, "clone", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "fl_directory_clone", arguments.array[i].string, "clone", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } } @@ -2350,15 +2353,15 @@ extern "C" { status_file = f_file_clone(arguments.array[i].string, destination, F_true, recurse.size_block, recurse.exclusive); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_file_clone", arguments.array[i].string, "clone", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_file_clone", arguments.array[i].string, "clone", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Cloned '%s' to '%s'.%c", arguments.array[i].string, destination, f_string_eol[0]); + fprintf(data.output.stream, "Cloned '%s' to '%s'.%c", arguments.array[i].string, destination, f_string_eol[0]); } } else if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[i].string, "identify", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[i].string, "identify", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); break; } @@ -2371,7 +2374,7 @@ extern "C" { int return_code = fake_execute(data, data_make->environment, data_make->setting_build.build_compiler, arguments, status); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fake_execute", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fake_execute", F_true, data_make->error); } fake_make_operate_process_return(data, return_code, data_make, status); @@ -2403,7 +2406,7 @@ extern "C" { status_file = f_directory_is(arguments.array[total].string); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[1].string, "identify", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[1].string, "identify", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); return; } @@ -2437,7 +2440,7 @@ extern "C" { status_file = fl_directory_copy(arguments.array[i].string, destination, arguments.array[i].used, destination_length, mode, recurse); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "fl_directory_copy", arguments.array[i].string, "copy", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "fl_directory_copy", arguments.array[i].string, "copy", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } } @@ -2445,15 +2448,15 @@ extern "C" { status_file = f_file_copy(arguments.array[i].string, destination, mode, recurse.size_block, recurse.exclusive); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_file_copy", arguments.array[i].string, "copy", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_file_copy", arguments.array[i].string, "copy", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Copied '%s' to '%s'.%c", arguments.array[i].string, destination, f_string_eol[0]); + fprintf(data.output.stream, "Copied '%s' to '%s'.%c", arguments.array[i].string, destination, f_string_eol[0]); } } else if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[i].string, "identify", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[i].string, "identify", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); break; } @@ -2472,10 +2475,10 @@ extern "C" { } if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "f_environment_set", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "f_environment_set", F_true, data_make->error); } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Defined environment variable '%s'.%c", arguments.array[0].string, f_string_eol[0]); + fprintf(data.output.stream, "Defined environment variable '%s'.%c", arguments.array[0].string, f_string_eol[0]); } return; @@ -2493,16 +2496,16 @@ extern "C" { if (F_status_is_error(*status)) { if (F_status_set_fine(*status) == F_file_found_not) { if (data.error.verbosity == f_console_verbosity_verbose) { - dprintf(data.output, "%c", f_string_eol[0]); - fl_color_print_to(data.output, data.context.set.warning, "WARNING: the file '"); - fl_color_print_to(data.output, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print_to(data.output, data.context.set.warning, "' was not found.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the file '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.output.stream, data.context.set.warning, "' was not found.%c", f_string_eol[0]); } *status = F_none; } else { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_stat", arguments.array[i].string, "delete", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_stat", arguments.array[i].string, "delete", F_true, F_true, data_make->error); return; } } @@ -2516,29 +2519,29 @@ extern "C" { if (F_status_set_fine(*status) == F_file_found_not) { if (data.error.verbosity == f_console_verbosity_verbose) { - printf("The directory '%s' does not exist.%c", arguments.array[i].string, f_string_eol[0]); + fprintf(data.output.stream, "The directory '%s' does not exist.%c", arguments.array[i].string, f_string_eol[0]); } *status = F_none; } if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "f_directory_remove", arguments.array[i].string, "delete", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_directory_remove", arguments.array[i].string, "delete", F_false, F_true, data_make->error); return; } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Removed '%s'.%c", arguments.array[i].string, f_string_eol[0]); + fprintf(data.output.stream, "Removed '%s'.%c", arguments.array[i].string, f_string_eol[0]); } } else { *status = f_file_remove(arguments.array[i].string); if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_remove", arguments.array[i].string, "delete", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_remove", arguments.array[i].string, "delete", F_true, F_true, data_make->error); return; } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Removed '%s'.%c", arguments.array[i].string, f_string_eol[0]); + fprintf(data.output.stream, "Removed '%s'.%c", arguments.array[i].string, f_string_eol[0]); } } } // for @@ -2568,16 +2571,16 @@ extern "C" { // forcing exit forces fail mode. data_make->setting_make.fail = fake_make_operation_fail_type_exit; - data_make->print.prefix = fake_make_print_error; - data_make->print.context = data.context.set.error; - data_make->print.to = f_type_error; + data_make->error.prefix = fake_make_print_error; + data_make->error.context = data.context.set.error; + data_make->error.to = f_type_error; } else { return; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Exiting as '%s'.", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); + fprintf(data.output.stream, "Exiting as '%s'.", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success); } return; @@ -2587,23 +2590,23 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_exit, arguments.array[0], fake_make_operation_argument_exit_length) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_exit; - data_make->print.prefix = fake_make_print_error; - data_make->print.context = data.context.set.error; - data_make->print.to = f_type_error; + data_make->error.prefix = fake_make_print_error; + data_make->error.context = data.context.set.error; + data_make->error.to = f_type_error; } else if (fl_string_dynamic_compare_string(fake_make_operation_argument_warn, arguments.array[0], fake_make_operation_argument_warn_length) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_warn; - data_make->print.prefix = fake_make_print_warning; - data_make->print.context = data.context.set.warning; - data_make->print.to = f_type_warning; + data_make->error.prefix = fake_make_print_warning; + data_make->error.context = data.context.set.warning; + data_make->error.to = f_type_warning; } else if (fl_string_dynamic_compare_string(fake_make_operation_argument_ignore, arguments.array[0], fake_make_operation_argument_ignore_length) == F_equal_to) { data_make->setting_make.fail = fake_make_operation_fail_type_ignore; - data_make->print.to = 0; + data_make->error.to = 0; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Set failure state to '"); + fprintf(data.output.stream, "Set failure state to '"); if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) { printf(fake_make_operation_argument_exit); @@ -2615,7 +2618,7 @@ extern "C" { printf(fake_make_operation_argument_ignore); } - printf("'.%c", f_string_eol[0]); + fprintf(data.output.stream, "'.%c", f_string_eol[0]); } return; @@ -2624,7 +2627,7 @@ extern "C" { if (operation == fake_make_operation_type_group) { gid_t id = 0; - *status = fake_make_get_id_group(data, data_make->print, arguments.array[0], &id); + *status = fake_make_get_id_group(data, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return; f_status_t status_file = F_none; @@ -2635,7 +2638,7 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); continue; } @@ -2645,10 +2648,10 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_file(data, *status, "f_file_role_change", arguments.array[i].string, "change group of", F_true, F_true, data_make->print); + fake_print_message_file(data, *status, "f_file_role_change", arguments.array[i].string, "change group of", F_true, F_true, data_make->error); } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Changed group of '%s' to %llu.%c", arguments.array[i].string, id, f_string_eol[0]); + fprintf(data.output.stream, "Changed group of '%s' to %llu.%c", arguments.array[i].string, id, f_string_eol[0]); } } // for @@ -2658,7 +2661,7 @@ extern "C" { if (operation == fake_make_operation_type_groups) { gid_t id = 0; - *status = fake_make_get_id_group(data, data_make->print, arguments.array[0], &id); + *status = fake_make_get_id_group(data, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return; f_status_t status_file = F_none; @@ -2670,7 +2673,7 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); continue; } @@ -2680,10 +2683,10 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_file(data, F_status_set_fine(*status), "fll_file_role_change_all", arguments.array[i].string, "change group of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "fll_file_role_change_all", arguments.array[i].string, "change group of", F_true, F_true, data_make->error); } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Changed group of '%s' to %llu.%c", arguments.array[i].string, id, f_string_eol[0]); + fprintf(data.output.stream, "Changed group of '%s' to %llu.%c", arguments.array[i].string, id, f_string_eol[0]); } } // for @@ -2717,7 +2720,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_group) { uid_t id = 0; - *status = fake_make_get_id_group(data, data_make->print, arguments.array[1], &id); + *status = fake_make_get_id_group(data, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return; uid_t id_file = 0; @@ -2729,7 +2732,7 @@ extern "C" { *status = f_file_group_read(arguments.array[i].string, &id_file); if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; - fake_print_message_file(data, F_status_set_fine(*status), "f_file_group_read", arguments.array[i].string, "get group of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_group_read", arguments.array[i].string, "get group of", F_true, F_true, data_make->error); break; } @@ -2755,7 +2758,7 @@ extern "C" { { uint8_t mode_replace = 0; - *status = fake_make_get_id_mode(data, data_make->print, arguments.array[2], &mode_rule, &mode_replace); + *status = fake_make_get_id_mode(data, data_make->error, arguments.array[2], &mode_rule, &mode_replace); if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; @@ -2766,7 +2769,7 @@ extern "C" { if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; - fake_print_message(data, F_status_set_fine(*status), "f_file_mode_to_mode", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "f_file_mode_to_mode", F_true, data_make->error); return; } } @@ -2781,7 +2784,7 @@ extern "C" { if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; - fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "get mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "get mode of", F_true, F_true, data_make->error); break; } @@ -2805,7 +2808,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_owner) { uid_t id = 0; - *status = fake_make_get_id_owner(data, data_make->print, arguments.array[1], &id); + *status = fake_make_get_id_owner(data, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return; uid_t id_file = 0; @@ -2817,7 +2820,7 @@ extern "C" { *status = f_file_owner_read(arguments.array[i].string, &id_file); if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; - fake_print_message_file(data, F_status_set_fine(*status), "f_file_owner_read", arguments.array[i].string, "get owner of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_owner_read", arguments.array[i].string, "get owner of", F_true, F_true, data_make->error); break; } @@ -2880,7 +2883,7 @@ extern "C" { *status = f_file_mode_read(arguments.array[i].string, &mode_file); if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; - fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "get mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "get mode of", F_true, F_true, data_make->error); break; } @@ -2923,7 +2926,7 @@ extern "C" { *status = f_file_exists(arguments.array[i].string); if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; - fake_print_message_file(data, F_status_set_fine(*status), "f_file_exists", arguments.array[i].string, "find", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_exists", arguments.array[i].string, "find", F_true, F_true, data_make->error); break; } @@ -3143,18 +3146,18 @@ extern "C" { *status = F_status_set_error(F_failure); *operation_if = fake_make_operation_if_type_false_always_next; - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); if ((i == 1 && number_left > f_number_t_size_unsigned) || (i > 1 && number_right > f_number_t_size_unsigned)) { - fl_color_print(data_make->print.to, data_make->print.context, "%s: The number '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%c%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "' may only be between the ranges -%llu to %llu.%c", f_number_t_size_unsigned, f_number_t_size_unsigned, f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The number '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%c%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' may only be between the ranges -%llu to %llu.%c", f_number_t_size_unsigned, f_number_t_size_unsigned, f_string_eol[0]); } else { - fl_color_print(data_make->print.to, data_make->print.context, "%s: Invalid or unsupported number provided '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Invalid or unsupported number provided '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } } } @@ -3169,10 +3172,10 @@ extern "C" { *status = f_file_link(arguments.array[0].string, arguments.array[1].string); if (F_status_is_error(*status)) { - fake_print_message_file(data, *status, "f_file_link", arguments.array[1].string, "create link", F_true, F_true, data_make->print); + fake_print_message_file(data, *status, "f_file_link", arguments.array[1].string, "create link", F_true, F_true, data_make->error); } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Created symbolic link from '%s' to '%s'.%c", arguments.array[1].string, arguments.array[0].string, f_string_eol[0]); + fprintf(data.output.stream, "Created symbolic link from '%s' to '%s'.%c", arguments.array[1].string, arguments.array[0].string, f_string_eol[0]); } return; @@ -3182,7 +3185,7 @@ extern "C" { f_file_mode_t mode_rule = 0; uint8_t replace = 0; - *status = fake_make_get_id_mode(data, data_make->print, arguments.array[0], &mode_rule, &replace); + *status = fake_make_get_id_mode(data, data_make->error, arguments.array[0], &mode_rule, &replace); if (F_status_is_error(*status)) return; mode_t mode = 0; @@ -3194,26 +3197,26 @@ extern "C" { *status = f_file_mode_read(arguments.array[i].string, &mode_file); if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "change mode of", F_true, F_true, data_make->error); break; } *status = f_file_mode_determine(mode_file, mode_rule, replace, f_macro_file_type_is_directory(mode_file), &mode); if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_determine", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_determine", arguments.array[i].string, "change mode of", F_true, F_true, data_make->error); break; } *status = f_file_mode_set(arguments.array[i].string, mode); if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_set", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_set", arguments.array[i].string, "change mode of", F_true, F_true, data_make->error); break; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Changed mode of '%s' to %#o.%c", arguments.array[i].string, mode, f_string_eol[0]); + fprintf(data.output.stream, "Changed mode of '%s' to %#o.%c", arguments.array[i].string, mode, f_string_eol[0]); } } // for @@ -3224,7 +3227,7 @@ extern "C" { f_file_mode_t mode_rule = 0; uint8_t replace = 0; - *status = fake_make_get_id_mode(data, data_make->print, arguments.array[0], &mode_rule, &replace); + *status = fake_make_get_id_mode(data, data_make->error, arguments.array[0], &mode_rule, &replace); if (F_status_is_error(*status)) return; mode_t mode = 0; @@ -3236,26 +3239,26 @@ extern "C" { *status = f_file_mode_read(arguments.array[i].string, &mode_file); if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "change mode of", F_true, F_true, data_make->error); break; } *status = f_file_mode_determine(mode_file, mode_rule, replace, f_macro_file_type_is_directory(mode_file), &mode); if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_determine", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_determine", arguments.array[i].string, "change mode of", F_true, F_true, data_make->error); break; } *status = fll_file_mode_set_all(arguments.array[i].string, mode, fake_make_operation_recursion_depth_max); if (F_status_is_error(*status)) { - fake_print_message_file(data, F_status_set_fine(*status), "fll_file_mode_set_all", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "fll_file_mode_set_all", arguments.array[i].string, "change mode of", F_true, F_true, data_make->error); break; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Changed mode of '%s' to %#o.%c", arguments.array[i].string, mode, f_string_eol[0]); + fprintf(data.output.stream, "Changed mode of '%s' to %#o.%c", arguments.array[i].string, mode, f_string_eol[0]); } } // for @@ -3282,7 +3285,7 @@ extern "C" { status_file = f_directory_is(arguments.array[total].string); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[1].string, "identify", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[1].string, "identify", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); return; } @@ -3313,7 +3316,7 @@ extern "C" { status_file = fll_file_move(arguments.array[i].string, destination, arguments.array[i].used, destination_length, recurse); if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "fll_file_move", arguments.array[i].string, "move", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "fll_file_move", arguments.array[i].string, "move", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } } // for @@ -3350,7 +3353,7 @@ extern "C" { if (operation == fake_make_operation_type_owner) { uid_t id = 0; - *status = fake_make_get_id_owner(data, data_make->print, arguments.array[0], &id); + *status = fake_make_get_id_owner(data, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return; f_status_t status_file = F_none; @@ -3362,7 +3365,7 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); continue; } @@ -3372,11 +3375,11 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_file(data, F_status_set_fine(*status), "f_file_role_change", arguments.array[i].string, "change owner of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_role_change", arguments.array[i].string, "change owner of", F_true, F_true, data_make->error); break; } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Changed owner of '%s' to %d.%c", arguments.array[i].string, id, f_string_eol[0]); + fprintf(data.output.stream, "Changed owner of '%s' to %d.%c", arguments.array[i].string, id, f_string_eol[0]); } } // for @@ -3386,7 +3389,7 @@ extern "C" { if (operation == fake_make_operation_type_owners) { uid_t id = 0; - *status = fake_make_get_id_owner(data, data_make->print, arguments.array[0], &id); + *status = fake_make_get_id_owner(data, data_make->error, arguments.array[0], &id); if (F_status_is_error(*status)) return; f_status_t status_file = F_none; @@ -3398,7 +3401,7 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); continue; } @@ -3408,10 +3411,10 @@ extern "C" { if (F_status_is_error(status_file)) { *status = status_file; - fake_print_message_file(data, F_status_set_fine(*status), "fll_file_role_change_all", arguments.array[i].string, "change owner of", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "fll_file_role_change_all", arguments.array[i].string, "change owner of", F_true, F_true, data_make->error); } else if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Changed owner of '%s' to %o.%c", arguments.array[i].string, id, f_string_eol[0]); + fprintf(data.output.stream, "Changed owner of '%s' to %o.%c", arguments.array[i].string, id, f_string_eol[0]); } } // for @@ -3426,20 +3429,20 @@ extern "C" { *status = f_path_change(data_make->path.stack.array[data_make->path.stack.used - 1].string); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", data_make->path.stack.array[data_make->path.stack.used - 1].string, data_make->print); + fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", data_make->path.stack.array[data_make->path.stack.used - 1].string, data_make->error); return; } if (data.error.verbosity == f_console_verbosity_verbose) { *status = fake_make_path_relative(data, data_make->path.stack.array[data_make->path.stack.used - 1], data_make); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fake_make_path_relative", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fake_make_path_relative", F_true, data_make->error); return; } - printf("Changed to project path '"); + fprintf(data.output.stream, "Changed to project path '"); f_print_dynamic(f_type_output, data_make->path_cache); - printf("'.%c", f_string_eol[0]); + fprintf(data.output.stream, "'.%c", f_string_eol[0]); } return; @@ -3450,11 +3453,11 @@ extern "C" { f_print_dynamic(f_type_output, arguments.array[i]); if (i + 1 < arguments.used) { - printf(" "); + fprintf(data.output.stream, " "); } } // for - printf("%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); return; } @@ -3491,7 +3494,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[0], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -3503,18 +3506,18 @@ extern "C" { *status = f_path_change(arguments.array[0].string); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", arguments.array[0].string, data_make->print); + fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", arguments.array[0].string, data_make->error); } else { if (data_make->path.stack.used == data_make->path.stack.size) { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->path.stack); if (F_status_set_fine(*status) == F_buffer_too_large) { - fake_print_message_section_operation_path_stack_max(data, F_buffer_too_large, "fl_string_lengths_size_increase", "path stack", data_make->print); + fake_print_message_section_operation_path_stack_max(data, F_buffer_too_large, "fl_string_lengths_size_increase", "path stack", data_make->error); return; } else if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "f_macro_string_dynamics_resize", F_true, data_make->error); return; } } @@ -3525,7 +3528,7 @@ extern "C" { fl_string_dynamic_append(data_make->path_cache, &data_make->path.stack.array[data_make->path.stack.used]); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true, data_make->error); return; } @@ -3533,13 +3536,13 @@ extern "C" { *status = fake_make_path_relative(data, data_make->path.stack.array[data_make->path.stack.used], data_make); if (F_status_is_error(*status)) { - fake_print_message(data, F_status_set_fine(*status), "fake_make_path_relative", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fake_make_path_relative", F_true, data_make->error); return; } - printf("Changed to project path '"); + fprintf(data.output.stream, "Changed to project path '"); f_print_dynamic(f_type_output, data_make->path_cache); - printf("'.%c", f_string_eol[0]); + fprintf(data.output.stream, "'.%c", f_string_eol[0]); } data_make->path.stack.used++; @@ -3553,12 +3556,12 @@ extern "C" { *status = f_path_change_at(data_make->path.top); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", arguments.array[0].string, data_make->print); + fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", arguments.array[0].string, data_make->error); return; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Changed to project path ''.%c", f_string_eol[0]); + fprintf(data.output.stream, "Changed to project path ''.%c", f_string_eol[0]); } // clear stack, except for the project root. @@ -3582,10 +3585,10 @@ extern "C" { if (F_status_is_error(*status)) { if (F_status_is_error_not(fll_path_canonical(arguments.array[i].string, &data_make->path_cache))) { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_touch", data_make->path_cache.string, "touch", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_touch", data_make->path_cache.string, "touch", F_true, F_true, data_make->error); } else { - fake_print_message_file(data, F_status_set_fine(*status), "f_file_touch", arguments.array[i].string, "touch", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_file_touch", arguments.array[i].string, "touch", F_true, F_true, data_make->error); } break; @@ -3596,10 +3599,10 @@ extern "C" { if (F_status_is_error(*status)) { if (F_status_is_error_not(fll_path_canonical(arguments.array[i].string, &data_make->path_cache))) { - fake_print_message_file(data, F_status_set_fine(*status), "f_directory_touch", data_make->path_cache.string, "touch", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_directory_touch", data_make->path_cache.string, "touch", F_false, F_true, data_make->error); } else { - fake_print_message_file(data, F_status_set_fine(*status), "f_directory_touch", arguments.array[i].string, "touch", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(*status), "f_directory_touch", arguments.array[i].string, "touch", F_false, F_true, data_make->error); } break; @@ -3607,9 +3610,9 @@ extern "C" { } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Touched %s '", arguments.array[0].string); + fprintf(data.output.stream, "Touched %s '", arguments.array[0].string); f_print_dynamic(f_type_output, arguments.array[i]); - printf("'.%c", f_string_eol[0]); + fprintf(data.output.stream, "'.%c", f_string_eol[0]); } } // for @@ -3649,7 +3652,7 @@ extern "C" { } if (F_status_is_error(status)) { - fake_print_message(data, F_status_set_fine(status), "f_macro_string_dynamics_resize", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(status), "f_macro_string_dynamics_resize", F_true, data_make->error); return status; } } @@ -3657,7 +3660,7 @@ extern "C" { status = f_environment_get(data_make->setting_build.environment.array[i].string, &data_make->environment.values.array[data_make->environment.values.used]); if (F_status_is_error(status)) { - fake_print_message(data, F_status_set_fine(status), "f_environment_get", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(status), "f_environment_get", F_true, data_make->error); return status; } @@ -3666,7 +3669,7 @@ extern "C" { fl_string_dynamic_append(data_make->setting_build.environment.array[i], &data_make->environment.names.array[data_make->environment.names.used]); if (F_status_is_error(status)) { - fake_print_message(data, F_status_set_fine(status), "f_environment_get", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(status), "f_environment_get", F_true, data_make->error); return status; } @@ -3675,15 +3678,15 @@ extern "C" { } // for if (data.error.verbosity == f_console_verbosity_verbose) { - printf("%s", program.string); + fprintf(data.output.stream, "%s", program.string); for (f_array_length_t i = 0; i < arguments.used; i++) { if (!arguments.array[i].used) continue; - printf(" %s", arguments.array[i].string); + fprintf(data.output.stream, " %s", arguments.array[i].string); } // for - printf("%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); // flush to stdout before executing command. fflush(f_type_output); @@ -3709,15 +3712,15 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - fprintf(data_make->print.to, "%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed to find program '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", program.string); - fl_color_print(data_make->print.to, data_make->print.context, "' for executing.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed to find program '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", program.string); + fl_color_print(data.error.to.stream, data_make->error.context, "' for executing.%c", f_string_eol[0]); } } else if (F_status_set_fine(status) != F_failure) { - fake_print_message(data, F_status_set_fine(status), "fll_execute_program_environment", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(status), "fll_execute_program_environment", F_true, data_make->error); } } @@ -3752,7 +3755,7 @@ extern "C" { if (F_status_is_error(status2)) { *status = status2; - fake_print_message(data, F_status_set_fine(*status), "f_conversion_number_signed_to_string", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "f_conversion_number_signed_to_string", F_true, data_make->error); f_macro_string_dynamic_t_delete_simple(number); return; @@ -3770,7 +3773,7 @@ extern "C" { if (F_status_is_error(status2)) { *status = status2; - fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_append", F_true, data_make->error); return; } @@ -3779,15 +3782,15 @@ extern "C" { if (F_status_is_error(status2)) { *status = status2; - fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true, data_make->error); return; } - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - fprintf(data_make->print.to, "%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed with return code '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", data_make->setting_make.parameter.array[0].value.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed with return code '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", data_make->setting_make.parameter.array[0].value.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) { @@ -3810,7 +3813,7 @@ extern "C" { f_macro_string_dynamics_new(status, args, arguments.used - 1); if (F_status_is_error(status)) { - fake_print_message(data, F_status_set_fine(status), "f_macro_string_dynamics_new", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(status), "f_macro_string_dynamics_new", F_true, data_make->error); return status; } @@ -3819,7 +3822,7 @@ extern "C" { status = fl_string_dynamic_append(arguments.array[i + 1], &args.array[i]); if (F_status_is_error(status)) { - fake_print_message(data, F_status_set_fine(status), "fl_string_dynamic_append", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(status), "fl_string_dynamic_append", F_true, data_make->error); f_macro_string_dynamics_t_delete_simple(args); return status; @@ -3828,7 +3831,7 @@ extern "C" { status = fl_string_dynamic_terminate(&args.array[i]); if (F_status_is_error(status)) { - fake_print_message(data, F_status_set_fine(status), "fl_string_dynamic_terminate", F_true, data_make->print); + fake_print_message(data, F_status_set_fine(status), "fl_string_dynamic_terminate", F_true, data_make->error); f_macro_string_dynamics_t_delete_simple(args); return status; @@ -3851,9 +3854,9 @@ extern "C" { if (operation == fake_make_operation_type_index || operation == fake_make_operation_type_run || operation == fake_make_operation_type_shell) { if (!arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3861,11 +3864,11 @@ extern "C" { else if (operation == fake_make_operation_type_index) { if (!data_make->setting_build.build_indexer.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - fprintf(data_make->print.to, "%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: No indexer has been specified, cannot perform '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, fake_make_operation_index); - fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: No indexer has been specified, cannot perform '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, fake_make_operation_index); + fl_color_print(data.error.to.stream, data_make->error.context, "' section operation.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3877,9 +3880,9 @@ extern "C" { if (operation == fake_make_operation_type_break) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3888,11 +3891,11 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_success, arguments.array[0], fake_make_operation_argument_success_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure, arguments.array[0], fake_make_operation_argument_failure_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported break type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported break type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3905,9 +3908,9 @@ extern "C" { if (operation == fake_make_operation_type_build) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3924,34 +3927,34 @@ extern "C" { f_status_t status_file = f_file_is(path_file, f_file_type_regular, F_false); if (status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed to find file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", path_file); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed to find file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(status_file); } else if (F_status_is_error(status_file)) { - fake_print_message_file(data, *status, "f_file_is", path_file, "find", F_true, F_true, data_make->print); + fake_print_message_file(data, *status, "f_file_is", path_file, "find", F_true, F_true, data_make->error); *status = status_file; } else if (!status_file) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", path_file); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a regular file.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a regular file.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Filename argument must not be an empty string.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Filename argument must not be an empty string.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3963,9 +3966,9 @@ extern "C" { if (operation == fake_make_operation_type_clean || operation == fake_make_operation_type_pop || operation == fake_make_operation_type_top || operation == fake_make_operation_type_skeleton) { if (arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3973,9 +3976,9 @@ extern "C" { else if (operation == fake_make_operation_type_pop) { if (data_make->path.stack.used == 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Must not attempt to pop project root off of path stack.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Must not attempt to pop project root off of path stack.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -3992,7 +3995,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4003,11 +4006,11 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; i++) { if (f_file_exists(arguments.array[i].string) != F_true) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed to find file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed to find file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4019,17 +4022,17 @@ extern "C" { f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The last file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The last file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a valid directory.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); } else if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[arguments.used - 1].string, "find", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[arguments.used - 1].string, "find", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } } @@ -4041,11 +4044,11 @@ extern "C" { status_file = f_directory_is(arguments.array[1].string); if (status_file == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The last file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The last file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a valid directory.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4054,9 +4057,9 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4067,19 +4070,19 @@ extern "C" { if (operation == fake_make_operation_type_compile) { if (!arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); } else if (data_make->setting_build.build_compiler.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - fprintf(data_make->print.to, "%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: No compiler has been specified, cannot perform '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, fake_make_operation_compile); - fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: No compiler has been specified, cannot perform '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, fake_make_operation_compile); + fl_color_print(data.error.to.stream, data_make->error.context, "' section operation.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4095,7 +4098,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4106,11 +4109,11 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; i++) { if (f_file_exists(arguments.array[i].string) != F_true) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed to find file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed to find file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4122,17 +4125,17 @@ extern "C" { f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The last file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The last file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a valid directory.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); } else if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[arguments.used - 1].string, "find", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[arguments.used - 1].string, "find", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } } @@ -4144,11 +4147,11 @@ extern "C" { status_file = f_directory_is(arguments.array[1].string); if (status_file == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The last file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The last file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a valid directory.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4157,9 +4160,9 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4175,7 +4178,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4184,9 +4187,9 @@ extern "C" { } // for } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4200,32 +4203,32 @@ extern "C" { *status = fake_make_operate_validate_define_name(arguments.array[0]); if (*status == F_none) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Define name must not be an empty string.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Define name must not be an empty string.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); } else if (*status == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - fprintf(data_make->print.to, "%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Invalid characters in the define setting name '", data_make->print.prefix); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Invalid characters in the define setting name '", data_make->error.prefix); - fl_color_print_code(data_make->print.to, data.context.notable); - f_print_dynamic(data_make->print.to, arguments.array[0]); - fl_color_print_code(data_make->print.to, data.context.reset); + fl_color_print_code(data.error.to.stream, data.context.notable); + f_print_dynamic(data.error.to.stream, arguments.array[0]); + fl_color_print_code(data.error.to.stream, data.context.reset); - fl_color_print(data_make->print.to, data_make->print.context, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is allowed.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is allowed.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4236,11 +4239,11 @@ extern "C" { if (operation == fake_make_operation_type_else) { if (*operation_if == fake_make_operation_if_type_else_true || *operation_if == fake_make_operation_if_type_else_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Must not be used after another '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "else"); - fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Must not be used after another '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "else"); + fl_color_print(data.error.to.stream, data_make->error.context, "' section operation.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4250,11 +4253,11 @@ extern "C" { } if (*operation_if == fake_make_operation_if_type_true || *operation_if == fake_make_operation_if_type_false || *operation_if == fake_make_operation_if_type_false_always) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Must not be used inside an ", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "if"); - fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Must not be used inside an ", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "if"); + fl_color_print(data.error.to.stream, data_make->error.context, "' section operation.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4264,9 +4267,9 @@ extern "C" { } if (*operation_if != fake_make_operation_if_type_else_true_next && *operation_if != fake_make_operation_if_type_else_false_next && *operation_if != fake_make_operation_if_type_else_false_next_always) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has no preceding if condition.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has no preceding if condition.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4276,9 +4279,9 @@ extern "C" { } if (arguments.used) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4290,9 +4293,9 @@ extern "C" { if (operation == fake_make_operation_type_exit) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4301,11 +4304,11 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_success, arguments.array[0], fake_make_operation_argument_success_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_failure, arguments.array[0], fake_make_operation_argument_failure_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported exit type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported exit type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4322,11 +4325,11 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_warn, arguments.array[0], fake_make_operation_argument_warn_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_ignore, arguments.array[0], fake_make_operation_argument_ignore_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported fail type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported fail type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4335,9 +4338,9 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4354,18 +4357,18 @@ extern "C" { status_file = f_file_is(arguments.array[i].string, f_file_type_regular, F_false); if (status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed to find file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed to find file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(status_file); } else if (F_status_is_error(status_file)) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - fake_print_message_file(data, *status, "f_file_is", arguments.array[i].string, "find", F_true, F_true, data_make->print); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fake_print_message_file(data, *status, "f_file_is", arguments.array[i].string, "find", F_true, F_true, data_make->error); } *status = status_file; @@ -4375,9 +4378,9 @@ extern "C" { return; } - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4387,11 +4390,11 @@ extern "C" { if (operation == fake_make_operation_type_if) { if (*operation_if == fake_make_operation_if_type_true || *operation_if == fake_make_operation_if_type_false || *operation_if == fake_make_operation_if_type_false_always) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Must not be used after another '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "if"); - fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Must not be used after another '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "if"); + fl_color_print(data.error.to.stream, data_make->error.context, "' section operation.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4480,11 +4483,11 @@ extern "C" { } // for if (i == 14) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported if type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported if type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4496,9 +4499,9 @@ extern "C" { if (arguments.used >= if_type_minimum[i]) { if (*operation_if == fake_make_operation_if_type_if_success || *operation_if == fake_make_operation_if_type_if_failure) { if (arguments.used > if_type_minimum[i]) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4513,11 +4516,11 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_mode) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_is, arguments.array[1], fake_make_operation_argument_is_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_has, arguments.array[1], fake_make_operation_argument_has_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported mode type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[1].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported mode type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4528,7 +4531,7 @@ extern "C" { f_file_mode_t mode_rule = 0; uint8_t replace = 0; - *status = fake_make_get_id_mode(data, data_make->print, arguments.array[2], &mode_rule, &replace); + *status = fake_make_get_id_mode(data, data_make->error, arguments.array[2], &mode_rule, &replace); if (F_status_is_error(*status)) return; i = 3; @@ -4537,7 +4540,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_owner) { uid_t id = 0; - *status = fake_make_get_id_owner(data, data_make->print, arguments.array[1], &id); + *status = fake_make_get_id_owner(data, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return; i = 2; @@ -4546,7 +4549,7 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_group) { gid_t id = 0; - *status = fake_make_get_id_group(data, data_make->print, arguments.array[1], &id); + *status = fake_make_get_id_group(data, data_make->error, arguments.array[1], &id); if (F_status_is_error(*status)) return; i = 2; @@ -4588,11 +4591,11 @@ extern "C" { type_file |= 0x40; } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported file type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported file type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } type_file |= 0x80; @@ -4617,7 +4620,7 @@ extern "C" { status_file = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(status_file)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(status_file), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(status_file), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); *operation_if = fake_make_operation_if_type_false_always_next; @@ -4640,7 +4643,7 @@ extern "C" { } if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_file_exists", arguments.array[i].string, "find", F_true, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_file_exists", arguments.array[i].string, "find", F_true, F_true, data_make->error); *operation_if = fake_make_operation_if_type_false_always_next; @@ -4659,11 +4662,11 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_environment, arguments.array[1], fake_make_operation_argument_environment_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_parameter, arguments.array[1], fake_make_operation_argument_parameter_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported define type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[1].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported define type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4675,9 +4678,9 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_equal || *operation_if == fake_make_operation_if_type_if_equal_not) { if (arguments.used < 3) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4688,9 +4691,9 @@ extern "C" { if (*operation_if == fake_make_operation_if_type_if_greater || *operation_if == fake_make_operation_if_type_if_greater_equal || *operation_if == fake_make_operation_if_type_if_less || *operation_if == fake_make_operation_if_type_if_less_equal) { if (arguments.used < 3) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4731,18 +4734,18 @@ extern "C" { if (F_status_is_error(status_number)) { *status = F_status_set_error(F_failure); - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); if (number > f_number_t_size_unsigned) { - fl_color_print(data_make->print.to, data_make->print.context, "%s: The number '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%c%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "' may only be between the ranges -%llu to %llu.%c", f_number_t_size_unsigned, f_number_t_size_unsigned, f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The number '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%c%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' may only be between the ranges -%llu to %llu.%c", f_number_t_size_unsigned, f_number_t_size_unsigned, f_string_eol[0]); } else { - fl_color_print(data_make->print.to, data_make->print.context, "%s: Invalid or unsupported number provided '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Invalid or unsupported number provided '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } } } @@ -4753,9 +4756,9 @@ extern "C" { } } - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4766,9 +4769,9 @@ extern "C" { if (operation == fake_make_operation_type_link) { if (arguments.used > 2) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4777,7 +4780,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[0], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[0].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4787,7 +4790,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[1], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[1].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[1].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4795,9 +4798,9 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4813,7 +4816,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -4824,11 +4827,11 @@ extern "C" { for (f_array_length_t i = 0; i < arguments.used - 1; i++) { if (f_file_exists(arguments.array[i].string) != F_true) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed to find file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[i].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed to find file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[i].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4840,17 +4843,17 @@ extern "C" { f_status_t status_file = f_directory_is(arguments.array[arguments.used - 1].string); if (status_file == F_false || status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The last file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The last file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a valid directory.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); } else if (F_status_is_error(status_file)) { - fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[arguments.used - 1].string, "find", F_false, F_true, data_make->print); + fake_print_message_file(data, F_status_set_fine(status_file), "f_directory_is", arguments.array[arguments.used - 1].string, "find", F_false, F_true, data_make->error); *status = F_status_set_error(F_failure); } } @@ -4862,11 +4865,11 @@ extern "C" { status_file = f_directory_is(arguments.array[1].string); if (status_file == F_false) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The last file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The last file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[arguments.used - 1].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a valid directory.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4875,9 +4878,9 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4888,9 +4891,9 @@ extern "C" { if (operation == fake_make_operation_type_operate) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4906,23 +4909,23 @@ extern "C" { } // for if (id_section == data_make->fakefile.used) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: No operation section named '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "' was found.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: No operation section named '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' was found.%c", f_string_eol[0]); } else { for (f_array_length_t i = 0; i < section_stack->used; i++) { if (section_stack->array[i] == id_section) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The section operation '", data_make->print.prefix); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The section operation '", data_make->error.prefix); - fl_color_print_code(data_make->print.to, data.context.notable); - f_print_dynamic_partial(data_make->print.to, data_make->buffer, data_make->fakefile.array[id_section].name); - fl_color_print_code(data_make->print.to, data.context.reset); + fl_color_print_code(data.error.to.stream, data.context.notable); + f_print_dynamic_partial(data.error.to.stream, data_make->buffer, data_make->fakefile.array[id_section].name); + fl_color_print_code(data.error.to.stream, data.context.reset); - fl_color_print(data_make->print.to, data_make->print.context, "' is already in the operation stack, recursion is not allowed.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "' is already in the operation stack, recursion is not allowed.%c", f_string_eol[0]); *status = F_status_set_error(F_failure); break; @@ -4931,9 +4934,9 @@ extern "C" { } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4943,9 +4946,9 @@ extern "C" { if (operation == fake_make_operation_type_to) { if (arguments.used > 1) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Has too many arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Has too many arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -4955,44 +4958,44 @@ extern "C" { f_status_t status_file = f_file_is(arguments.array[0].string, f_file_type_directory, F_false); if (status_file == F_file_found_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Failed to find file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Failed to find file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(status_file); } else if (F_status_is_error(status_file)) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - fake_print_message_file(data, *status, "f_file_is", data.file_data_build_fakefile.string, "find", F_true, F_true, data_make->print); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fake_print_message_file(data, *status, "f_file_is", data.file_data_build_fakefile.string, "find", F_true, F_true, data_make->error); } *status = status_file; } else if (!status_file) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: The file '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "' must be a directory file.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: The file '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "' must be a directory file.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Filename argument must not be an empty string.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Filename argument must not be an empty string.%c", data_make->error.prefix, f_string_eol[0]); } } } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -5006,11 +5009,11 @@ extern "C" { if (fl_string_dynamic_compare_string(fake_make_operation_argument_file, arguments.array[0], fake_make_operation_argument_file_length) == F_equal_to_not) { if (fl_string_dynamic_compare_string(fake_make_operation_argument_directory, arguments.array[0], fake_make_operation_argument_directory_length) == F_equal_to_not) { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Unsupported file type '", data_make->print.prefix); - fl_color_print(data_make->print.to, data.context.set.notable, "%s", arguments.array[0].string); - fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Unsupported file type '", data_make->error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", arguments.array[0].string); + fl_color_print(data.error.to.stream, data_make->error.context, "'.%c", f_string_eol[0]); } *status = F_status_set_error(F_failure); @@ -5022,7 +5025,7 @@ extern "C" { *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { - fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->print); + fake_print_message_section_operation_path_outside(data, F_status_set_fine(*status), "fake_make_assure_inside_project", data_make->path_cache.used ? data_make->path_cache.string : arguments.array[i].string, data_make->error); if (F_status_set_fine(*status) == F_false) { *status = F_status_set_error(F_failure); @@ -5031,9 +5034,9 @@ extern "C" { } // for } else { - if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) { - printf("%c", f_string_eol[0]); - fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]); + if (data.error.verbosity != f_console_verbosity_quiet && data_make->error.to.stream) { + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data_make->error.context, "%s: Requires more arguments.%c", data_make->error.prefix, f_string_eol[0]); } *status = F_status_set_error(F_failure); diff --git a/level_3/fake/c/private-make.h b/level_3/fake/c/private-make.h index 6d65573..2c0ad40 100644 --- a/level_3/fake/c/private-make.h +++ b/level_3/fake/c/private-make.h @@ -358,6 +358,8 @@ extern "C" { fake_make_parameter_t parameter; fake_make_path_t path; + fll_error_print_t error; + f_fss_nameds_t fakefile; f_string_dynamic_t buffer; @@ -372,6 +374,7 @@ extern "C" { fake_environment_t_initialize, \ fake_make_parameter_t_initialize, \ fake_make_path_t_initialize, \ + fll_error_print_t_initialize, \ f_fss_nameds_t_initialize, \ f_string_dynamic_t_initialize, \ f_string_dynamic_t_initialize, \ @@ -415,6 +418,8 @@ extern "C" { * * @param data * The program data. + * @param error + * The error/warning print data. * @param buffer * The string containing the name or number. * @param id @@ -427,7 +432,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_get_id_group_ - f_return_status fake_make_get_id_group(const fake_data_t data, const f_string_static_t buffer, gid_t *id) f_gcc_attribute_visibility_internal; + f_return_status fake_make_get_id_group(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, gid_t *id) f_gcc_attribute_visibility_internal; #endif // _di_fake_make_get_id_group_ /** @@ -435,6 +440,8 @@ extern "C" { * * @param data * The program data. + * @param error + * The error/warning print data. * @param buffer * The string containing the name or number. * @param mode @@ -451,7 +458,7 @@ extern "C" { * Status codes (with error bit) are returned on any problem. */ #ifndef _di_fake_make_get_id_mode_ - f_return_status fake_make_get_id_mode(const fake_data_t data, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) f_gcc_attribute_visibility_internal; + f_return_status fake_make_get_id_mode(const fake_data_t data, const fll_error_print_t error, const f_string_static_t buffer, f_file_mode_t *mode, uint8_t *replace) f_gcc_attribute_visibility_internal; #endif // _di_fake_make_get_id_mode_ /** diff --git a/level_3/fake/c/private-print.c b/level_3/fake/c/private-print.c index 37883d6..2e1300a 100644 --- a/level_3/fake/c/private-print.c +++ b/level_3/fake/c/private-print.c @@ -9,38 +9,30 @@ extern "C" { #endif -#ifndef _di_fake_print_error_ - f_return_status fake_print_error(const fake_data_t data, const f_status_t status, const f_string_t function, const bool fallback) { - const fake_make_print_t print = fake_macro_make_print_t_initialize(fake_make_print_error, data.context.set.error, f_type_error); - - return fake_print_message(data, status, function, fallback); - } -#endif // _di_fake_print_error_ - #ifndef _di_fake_print_error_build_operation_file_ bool fake_print_error_build_operation_file(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t operation, const f_string_t how, const f_string_t source, const f_string_t destination, const bool fallback) { if (status == F_file_found_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to find '"); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to find '"); if (f_file_exists(source) == F_true) { - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } else { - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); } - fl_color_print_to(data.error.to, data.context.set.error, "' while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fl_color_print(data.error.to.stream, data.context.set.error, "' while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -48,18 +40,18 @@ extern "C" { if (status == F_parameter) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", function); - fl_color_print_to(data.error.to, data.context.set.error, "() to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, data.context.set.error, "() to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -67,16 +59,16 @@ extern "C" { if (status == F_name) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Invalid name for '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Invalid name for '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' or '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' or '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -84,16 +76,16 @@ extern "C" { if (status == F_memory_out) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -102,16 +94,16 @@ extern "C" { if (status == F_number_overflow) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Overflow while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Overflow while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -119,16 +111,16 @@ extern "C" { if (status == F_directory) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Invalid directory while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Invalid directory while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -136,16 +128,16 @@ extern "C" { if (status == F_access_denied) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Access denied while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Access denied while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -153,16 +145,16 @@ extern "C" { if (status == F_loop) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Loop while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Loop while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -170,16 +162,16 @@ extern "C" { if (status == F_prohibited) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Prohibited by system while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Prohibited by system while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -187,16 +179,16 @@ extern "C" { if (status == F_directory_found_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); } return F_false; @@ -204,59 +196,51 @@ extern "C" { if (status == F_failure) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_false; } - if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "UNKNOWN ERROR: ("); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, data.context.set.error, ") occurred while trying to %s '", operation); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", source); + if (fll_error_print(data.error, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN ERROR: ("); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, data.context.set.error, ") occurred while trying to %s '", operation); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source); if (destination) { - fl_color_print_to(data.error.to, data.context.set.error, "' %s '", how); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination); + fl_color_print(data.error.to.stream, data.context.set.error, "' %s '", how); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination); } - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); } return F_true; } #endif // _di_fake_print_error_build_operation_file_ -#ifndef _di_fake_print_error_file_ - bool fake_print_error_file(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t name, const f_string_t operation, const bool is_file, const bool fallback) { - const fake_make_print_t print = fake_macro_make_print_t_initialize(fake_make_print_error, data.context.set.error, f_type_error); - - return fake_print_message_file(data, status, function, name, operation, is_file, fallback, print); - } -#endif // _di_fake_print_error_file_ - #ifndef _di_fake_print_error_fss bool fake_print_error_fss(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path_file, const f_string_range_t range, const bool fallback) { if (status == F_file_found_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at stop position (at "); - fl_color_print_to(data.error.to, data.context.set.notable, "%d", range.start); - fl_color_print_to(data.error.to, data.context.set.error, " of setting file '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.error.to, data.context.set.error, "').%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at stop position (at "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%d", range.start); + fl_color_print(data.error.to.stream, data.context.set.error, " of setting file '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.error.to.stream, data.context.set.error, "').%c", f_string_eol[0]); } return F_false; @@ -264,24 +248,24 @@ extern "C" { if (status == F_status_set_error(F_incomplete_utf_stop)) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at end of string (at "); - fl_color_print_to(data.error.to, data.context.set.notable, "%d", range.start); - fl_color_print_to(data.error.to, data.context.set.error, " of setting file '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path_file); - fl_color_print_to(data.error.to, data.context.set.error, "').%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at end of string (at "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%d", range.start); + fl_color_print(data.error.to.stream, data.context.set.error, " of setting file '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.error.to.stream, data.context.set.error, "').%c", f_string_eol[0]); } return F_false; } - if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "UNKNOWN ERROR: ("); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, data.context.set.error, ") in function "); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", function); - fl_color_print_to(data.error.to, data.context.set.error, "().%c", f_string_eol[0]); + if (fll_error_print(data.error, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN ERROR: ("); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, data.context.set.error, ") in function "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, data.context.set.error, "().%c", f_string_eol[0]); } return F_true; @@ -292,12 +276,12 @@ extern "C" { void fake_print_error_parameter_missing_value(const fake_data_t data, const f_string_t parameter) { if (data.error.verbosity == f_console_verbosity_quiet) return; - dprintf(data.error.to, "%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); } #endif // _di_fake_print_error_parameter_missing_value_ @@ -305,12 +289,12 @@ extern "C" { void fake_print_error_parameter_too_many(const fake_data_t data, const f_string_t parameter) { if (data.error.verbosity == f_console_verbosity_quiet) return; - dprintf(data.error.to, "%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, data.context.set.error, "' specified too many times.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "' specified too many times.%c", f_string_eol[0]); } #endif // _di_fake_print_error_parameter_too_many_ @@ -319,16 +303,16 @@ extern "C" { if (status == F_parameter) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Invalid parameter", print.prefix); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Invalid parameter", data.error.prefix); if (function) { - fl_color_print(print.to, print.context, " when calling function "); - fl_color_print(print.to, data.context.set.notable, "%s", function); - fl_color_print(print.to, print.context, "().%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, " when calling function "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, data.error.context, "().%c", f_string_eol[0]); } else { - fl_color_print(print.to, print.context, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, ".%c", f_string_eol[0]); } } @@ -337,16 +321,16 @@ extern "C" { if (status == F_memory_allocation || status == F_memory_reallocation) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Unable to allocate memory", print.prefix); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Unable to allocate memory", data.error.prefix); if (function) { - fl_color_print(print.to, print.context, " in function "); - fl_color_print(print.to, data.context.set.notable, "%s", function); - fl_color_print(print.to, print.context, "().%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, " in function "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, data.error.context, "().%c", f_string_eol[0]); } else { - fl_color_print(print.to, print.context, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, ".%c", f_string_eol[0]); } } @@ -354,18 +338,18 @@ extern "C" { } if (fallback && data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "UNKNOWN %s: (", print.prefix); - fl_color_print(print.to, data.context.set.notable, "%llu", status); - fl_color_print(print.to, print.context, ")"); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "UNKNOWN %s: (", data.error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, data.error.context, ")"); if (function) { - fl_color_print(print.to, print.context, " in function "); - fl_color_print(print.to, data.context.set.notable, "%s", function); - fl_color_print(print.to, print.context, "().%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, " in function "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, data.error.context, "().%c", f_string_eol[0]); } else { - fl_color_print(print.to, print.context, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, ".%c", f_string_eol[0]); } } @@ -379,10 +363,10 @@ extern "C" { if (status == F_file_found_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Failed to find %s '", print.prefix, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Failed to find %s '", data.error.prefix, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -390,10 +374,10 @@ extern "C" { if (status == F_file_found) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: The %s '", print.prefix, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "' already exists.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: The %s '", data.error.prefix, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "' already exists.%c", f_string_eol[0]); } return F_false; @@ -401,10 +385,10 @@ extern "C" { if (status == F_directory_empty_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: The %s '", print.prefix, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "' is not empty.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: The %s '", data.error.prefix, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "' is not empty.%c", f_string_eol[0]); } return F_false; @@ -412,12 +396,12 @@ extern "C" { if (status == F_parameter) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "INTERNAL %s: Invalid parameter when calling ", print.prefix); - fl_color_print(print.to, data.context.set.notable, "%s", function); - fl_color_print(print.to, print.context, "() for the %s '", file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "INTERNAL %s: Invalid parameter when calling ", data.error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, data.error.context, "() for the %s '", file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -425,10 +409,10 @@ extern "C" { if (status == F_name) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Invalid %s name '", print.prefix, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Invalid %s name '", data.error.prefix, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -436,10 +420,10 @@ extern "C" { if (status == F_memory_out) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "CRITICAL %s: Unable to allocate memory, while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "CRITICAL %s: Unable to allocate memory, while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -447,10 +431,10 @@ extern "C" { if (status == F_number_overflow) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Overflow while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Overflow while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -458,10 +442,10 @@ extern "C" { if (status == F_directory) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Invalid directory while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Invalid directory while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -469,10 +453,10 @@ extern "C" { if (status == F_access_denied) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Access denied while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Access denied while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -480,10 +464,10 @@ extern "C" { if (status == F_loop) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Loop while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Loop while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -491,10 +475,10 @@ extern "C" { if (status == F_prohibited) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Prohibited by system while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Prohibited by system while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -502,10 +486,10 @@ extern "C" { if (status == F_access_owner) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Currrent user is not allowed to use the given owner while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Currrent user is not allowed to use the given owner while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -513,10 +497,10 @@ extern "C" { if (status == F_access_group) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Currrent user is not allowed to use the given group while trying to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Currrent user is not allowed to use the given group while trying to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; @@ -525,10 +509,10 @@ extern "C" { if (is_file) { if (status == F_directory_found_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Failed to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "' due to an invalid directory in the path.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Failed to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "' due to an invalid directory in the path.%c", f_string_eol[0]); } return F_false; @@ -537,10 +521,10 @@ extern "C" { else { if (status == F_directory_found_not) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Failed to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "' due to an invalid directory in the path.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Failed to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "' due to an invalid directory in the path.%c", f_string_eol[0]); } return F_false; @@ -548,23 +532,23 @@ extern "C" { if (status == F_failure) { if (data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Failed to %s %s '", print.prefix, operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "%s: Failed to %s %s '", data.error.prefix, operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_false; } } - if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "UNKNOWN %s: (", print.prefix); - fl_color_print(print.to, data.context.set.notable, "%llu", status); - fl_color_print(print.to, print.context, ") occurred while trying to %s %s '", operation, file_or_directory); - fl_color_print(print.to, data.context.set.notable, "%s", name); - fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]); + if (fll_error_print(data.error, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) { + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.error.context, "UNKNOWN %s: (", data.error.prefix); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, data.error.context, ") occurred while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, data.error.context, "'.%c", f_string_eol[0]); } return F_true; @@ -572,125 +556,125 @@ extern "C" { #endif // _di_fake_print_message_file_ #ifndef _di_fake_print_message_section_operation_failed_ - void fake_print_message_section_operation_failed(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const fake_make_print_t print) { - if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return; + void fake_print_message_section_operation_failed(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, fll_error_print_t error) { + if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; f_string_length_t line = 1; f_fss_count_lines(buffer, operation_name.start, &line); - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: The section operation '", print.prefix); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "%s: The section operation '", data.error.prefix); - fl_color_print_code(print.to, data.context.notable); - f_print_dynamic_partial(print.to, buffer, operation_name); - fl_color_print_code(print.to, data.context.reset); + fl_color_print_code(error.to.stream, data.context.notable); + f_print_dynamic_partial(error.to.stream, buffer, operation_name); + fl_color_print_code(error.to.stream, data.context.reset); - fl_color_print(print.to, print.context, "' from section '"); + fl_color_print(error.to.stream, data.error.context, "' from section '"); - fl_color_print_code(print.to, data.context.notable); - f_print_dynamic_partial(print.to, buffer, section_name); - fl_color_print_code(print.to, data.context.reset); + fl_color_print_code(error.to.stream, data.context.notable); + f_print_dynamic_partial(error.to.stream, buffer, section_name); + fl_color_print_code(error.to.stream, data.context.reset); - fl_color_print(print.to, print.context, "' on line "); - fl_color_print(print.to, data.context.set.notable, "%llu", line); - fl_color_print(print.to, print.context, " failed.%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "' on line "); + fl_color_print(error.to.stream, data.context.set.notable, "%llu", line); + fl_color_print(error.to.stream, data.error.context, " failed.%c", f_string_eol[0]); } #endif // _di_fake_print_message_section_operation_failed_ #ifndef _di_fake_print_message_section_operation_path_outside_ - void fake_print_message_section_operation_path_outside(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, const fake_make_print_t print) { - if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return; + void fake_print_message_section_operation_path_outside(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, fll_error_print_t error) { + if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; if (F_status_set_fine(status) == F_false) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: The path '", print.prefix); - fl_color_print(print.to, data.context.set.notable, "%s", path); - fl_color_print(print.to, print.context, "' is outside the project root.%c", f_string_eol[0]); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "%s: The path '", data.error.prefix); + fl_color_print(error.to.stream, data.context.set.notable, "%s", path); + fl_color_print(error.to.stream, data.error.context, "' is outside the project root.%c", f_string_eol[0]); } else { - fake_print_error_file(data, status, function, path, "determine real path of", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), function, F_true, path, "determine real path of", fll_error_file_type_file); } } #endif // _di_fake_print_message_section_operation_path_outside_ #ifndef _di_fake_print_message_section_operation_path_stack_max_ - void fake_print_message_section_operation_path_stack_max(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, const fake_make_print_t print) { - if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return; + void fake_print_message_section_operation_path_stack_max(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, fll_error_print_t error) { + if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; if (status == F_buffer_too_large) { - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: Maximum stack size reached while processing path '", print.prefix); - fl_color_print(print.to, data.context.set.notable, "%s", path); - fl_color_print(print.to, print.context, "'"); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "%s: Maximum stack size reached while processing path '", data.error.prefix); + fl_color_print(error.to.stream, data.context.set.notable, "%s", path); + fl_color_print(error.to.stream, data.error.context, "'"); if (function) { - fl_color_print(print.to, print.context, " while calling "); - fl_color_print(print.to, data.context.set.notable, "%s", function); - fl_color_print(print.to, print.context, "()"); + fl_color_print(error.to.stream, data.error.context, " while calling "); + fl_color_print(error.to.stream, data.context.set.notable, "%s", function); + fl_color_print(error.to.stream, data.error.context, "()"); } - fl_color_print(print.to, print.context, ".%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, ".%c", f_string_eol[0]); } else { - fake_print_message_file(data, status, function, path, "change path to", F_false, F_true, print); + fll_error_file_print(error, status, function, F_true, path, "change path to", fll_error_file_type_directory); } } #endif // _di_fake_print_message_section_operation_path_stack_max_ #ifndef _di_fake_print_message_section_operation_stack_max_ - void fake_print_message_section_operation_stack_max(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max, const fake_make_print_t print) { - if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return; + void fake_print_message_section_operation_stack_max(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max, fll_error_print_t error) { + if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; f_string_length_t line = 1; f_fss_count_lines(buffer, operation_name.start, &line); - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: The section operation '", print.prefix); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "%s: The section operation '", data.error.prefix); - fl_color_print_code(print.to, data.context.notable); - f_print_dynamic_partial(print.to, buffer, operation_name); - fl_color_print_code(print.to, data.context.reset); + fl_color_print_code(error.to.stream, data.context.notable); + f_print_dynamic_partial(error.to.stream, buffer, operation_name); + fl_color_print_code(error.to.stream, data.context.reset); - fl_color_print(print.to, print.context, "' from section '"); + fl_color_print(error.to.stream, data.error.context, "' from section '"); - fl_color_print_code(print.to, data.context.notable); - f_print_dynamic_partial(print.to, buffer, section_name); - fl_color_print_code(print.to, data.context.reset); + fl_color_print_code(error.to.stream, data.context.notable); + f_print_dynamic_partial(error.to.stream, buffer, section_name); + fl_color_print_code(error.to.stream, data.context.reset); - fl_color_print(print.to, print.context, "' on line "); - fl_color_print(print.to, data.context.set.notable, "%llu", line); - fl_color_print(print.to, print.context, " cannot be processed because the max stack depth of "); - fl_color_print(print.to, data.context.set.notable, "%llu", stack_max); - fl_color_print(print.to, print.context, " has been reached.%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "' on line "); + fl_color_print(error.to.stream, data.context.set.notable, "%llu", line); + fl_color_print(error.to.stream, data.error.context, " cannot be processed because the max stack depth of "); + fl_color_print(error.to.stream, data.context.set.notable, "%llu", stack_max); + fl_color_print(error.to.stream, data.error.context, " has been reached.%c", f_string_eol[0]); } #endif // _di_fake_print_message_section_operation_stack_max_ #ifndef _di_fake_print_message_section_operation_unknown_ - void fake_print_message_section_operation_unknown(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const fake_make_print_t print) { - if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return; + void fake_print_message_section_operation_unknown(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, fll_error_print_t error) { + if (data.error.verbosity == f_console_verbosity_quiet || !error.to.stream) return; f_string_length_t line = 1; f_fss_count_lines(buffer, operation_name.start, &line); - fprintf(print.to, "%c", f_string_eol[0]); - fl_color_print(print.to, print.context, "%s: The section operation '", print.prefix); + fprintf(error.to.stream, "%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "%s: The section operation '", data.error.prefix); - fl_color_print_code(print.to, data.context.notable); - f_print_dynamic_partial(print.to, buffer, operation_name); - fl_color_print_code(print.to, data.context.reset); + fl_color_print_code(error.to.stream, data.context.notable); + f_print_dynamic_partial(error.to.stream, buffer, operation_name); + fl_color_print_code(error.to.stream, data.context.reset); - fl_color_print(print.to, print.context, "' from section '"); + fl_color_print(error.to.stream, data.error.context, "' from section '"); - fl_color_print_code(print.to, data.context.notable); - f_print_dynamic_partial(print.to, buffer, section_name); - fl_color_print_code(print.to, data.context.reset); + fl_color_print_code(error.to.stream, data.context.notable); + f_print_dynamic_partial(error.to.stream, buffer, section_name); + fl_color_print_code(error.to.stream, data.context.reset); - fl_color_print(print.to, print.context, "' on line "); - fl_color_print(print.to, data.context.set.notable, "%llu", line); - fl_color_print(print.to, print.context, " is not a known operation name.%c", f_string_eol[0]); + fl_color_print(error.to.stream, data.error.context, "' on line "); + fl_color_print(error.to.stream, data.context.set.notable, "%llu", line); + fl_color_print(error.to.stream, data.error.context, " is not a known operation name.%c", f_string_eol[0]); } #endif // _di_fake_print_message_section_operation_unknown_ @@ -698,7 +682,7 @@ extern "C" { void fake_print_warning_settings_content_empty(const fake_data_t data, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_t settings_name) { if (data.error.verbosity == f_console_verbosity_quiet) return; - dprintf(data.error.to, "%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the fakefile '"); fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file); @@ -718,25 +702,25 @@ extern "C" { void fake_print_warning_settings_content_invalid(const fake_data_t data, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) { if (data.error.verbosity == f_console_verbosity_quiet) return; - dprintf(data.error.to, "%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); - fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the fakefile '"); - fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file); - fl_color_print(f_type_warning, data.context.set.warning, "' has an invalid content '"); + fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the fakefile '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file); + fl_color_print(data.output.stream, data.context.set.warning, "' has an invalid content '"); - fl_color_print_code(f_type_warning, data.context.notable); - f_print_dynamic_partial(f_type_warning, buffer, range_content); - fl_color_print_code(f_type_warning, data.context.reset); + fl_color_print_code(data.output.stream, data.context.notable); + f_print_dynamic_partial(data.output.stream, buffer, range_content); + fl_color_print_code(data.output.stream, data.context.reset); - fl_color_print(f_type_warning, data.context.set.warning, "' for the '"); - fl_color_print(f_type_warning, data.context.set.notable, "%s", settings_name); - fl_color_print(f_type_warning, data.context.set.warning, "' object '"); + fl_color_print(data.output.stream, data.context.set.warning, "' for the '"); + fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_name); + fl_color_print(data.output.stream, data.context.set.warning, "' object '"); - fl_color_print_code(f_type_warning, data.context.notable); - f_print_dynamic_partial(f_type_warning, buffer, range_object); - fl_color_print_code(f_type_warning, data.context.reset); + fl_color_print_code(data.output.stream, data.context.notable); + f_print_dynamic_partial(data.output.stream, buffer, range_object); + fl_color_print_code(data.output.stream, data.context.reset); - fl_color_print(f_type_warning, data.context.set.warning, "'.%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.warning, "'.%c", f_string_eol[0]); } #endif // _di_fake_print_warning_settings_content_invalid_ @@ -744,7 +728,7 @@ extern "C" { void fake_print_warning_settings_content_multiple(const fake_data_t data, const f_string_t path_file, const f_string_t name_object) { if (data.error.verbosity != f_console_verbosity_verbose) return; - dprintf(data.error.to, "%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the setting '"); fl_color_print(f_type_warning, data.context.set.notable, "%s", name_object); @@ -759,7 +743,7 @@ extern "C" { void fake_print_warning_settings_object_multiple(const fake_data_t data, const f_string_t path_file, const f_string_t label, const f_string_t name_object) { if (data.error.verbosity != f_console_verbosity_verbose) return; - dprintf(data.error.to, "%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the %s object '", label); fl_color_print(f_type_warning, data.context.set.notable, "%s", name_object); diff --git a/level_3/fake/c/private-print.h b/level_3/fake/c/private-print.h index adc644c..0c172a7 100644 --- a/level_3/fake/c/private-print.h +++ b/level_3/fake/c/private-print.h @@ -13,27 +13,6 @@ extern "C" { #endif /** - * Print generic error messages. - * - * @param data - * The program data. - * @param status - * The status code representing an error. - * @param function - * The name of the function where the error happened. - * Set to 0 to disable. - * @param fallback - * Set to F_true to print the fallback error message for unknown errors. - * - * @return - * F_none is returned on successful print of known errors. - * F_unknown is returned if the status code has no print message. - */ -#ifndef _di_fake_print_error_ - extern f_return_status fake_print_error(const fake_data_t data, const f_status_t status, const f_string_t function, const bool fallback) f_gcc_attribute_visibility_internal; -#endif // _di_fake_print_error_ - -/** * Print build operation file error messages. * * @param data @@ -66,34 +45,6 @@ extern "C" { #endif // _di_fake_print_error_operation_file_ /** - * Print file/directory error messages. - * - * @todo the fll_file_error_print() needs to be reviewed and possibly changed. - * - * @param data - * The program data. - * @param status - * The error status code to report on. - * @param function - * The function call that returned the error. - * @param name - * The name of the file or directory. - * @param operation - * The operation that fails, such as 'create' or 'access'. - * @param is_file - * Set to TRUE if this is a file and FALSE if this is a directory. - * @param fallback - * Set to F_true to print the fallback error message for unknown errors. - * - * @return - * F_true is returned if the status code has no print message. - * F_false is returned on successful print of known errors. - */ -#ifndef _di_fake_print_error_file_ - extern bool fake_print_error_file(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t name, const f_string_t operation, const bool is_file, const bool fallback) f_gcc_attribute_visibility_internal; -#endif // _di_fake_print_error_file_ - -/** * Print FSS error messages. * * @param data @@ -181,8 +132,6 @@ extern "C" { * Set to TRUE if this is a file and FALSE if this is a directory. * @param fallback * Set to F_true to print the fallback error message for unknown errors. - * @param print - * Designates how the section error/warning should be printed. * * @return * F_true is returned if the status code has no print message. @@ -203,11 +152,11 @@ extern "C" { * The range within the buffer representing the section name. * @param operation_name * The range within the buffer representing the operation name within the section. - * @param print + * @param error * Designates how the section error/warning should be printed. */ #ifndef _di_fake_print_message_section_operation_failed_ - extern void fake_print_message_section_operation_failed(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const fake_make_print_t print) f_gcc_attribute_visibility_internal; + extern void fake_print_message_section_operation_failed(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, fll_error_print_t error) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_message_section_operation_failed_ /** @@ -221,11 +170,11 @@ extern "C" { * The name of the function where the error happened. * @param path * The path that is outside of the project path. - * @param print + * @param error * Designates how the section error/warning should be printed. */ #ifndef _di_fake_print_message_section_operation_path_outside_ - extern void fake_print_message_section_operation_path_outside(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, const fake_make_print_t print) f_gcc_attribute_visibility_internal; + extern void fake_print_message_section_operation_path_outside(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, fll_error_print_t error) f_gcc_attribute_visibility_internal; #endif // _fake_print_message_section_operation_path_outside_ /** @@ -240,11 +189,11 @@ extern "C" { * Set to 0 to disable. * @param path * The path to the directory. - * @param print + * @param error * Designates how the section error/warning should be printed. */ #ifndef _di_fake_print_message_section_operation_path_stack_max_ - extern void fake_print_message_section_operation_path_stack_max(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, const fake_make_print_t print) f_gcc_attribute_visibility_internal; + extern void fake_print_message_section_operation_path_stack_max(const fake_data_t data, const f_status_t status, const f_string_t function, const f_string_t path, fll_error_print_t error) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_message_section_operation_path_stack_max_ /** @@ -260,11 +209,11 @@ extern "C" { * The range within the buffer representing the operation name within the section. * @param stack_max * The max stack depth. - * @param print + * @param error * Designates how the section error/warning should be printed. */ #ifndef _di_fake_print_message_section_operation_stack_max_ - extern void fake_print_message_section_operation_stack_max(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max, const fake_make_print_t print) f_gcc_attribute_visibility_internal; + extern void fake_print_message_section_operation_stack_max(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const f_array_length_t stack_max, fll_error_print_t error) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_message_section_operation_stack_max_ /** @@ -278,11 +227,11 @@ extern "C" { * The range within the buffer representing the section name. * @param operation_name * The range within the buffer representing the operation name within the section. - * @param print + * @param error * Designates how the section error/warning should be printed. */ #ifndef _di_fake_print_message_section_operation_unknown_ - extern void fake_print_message_section_operation_unknown(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, const fake_make_print_t print) f_gcc_attribute_visibility_internal; + extern void fake_print_message_section_operation_unknown(const fake_data_t data, const f_string_static_t buffer, const f_string_range_t section_name, const f_string_range_t operation_name, fll_error_print_t error) f_gcc_attribute_visibility_internal; #endif // _di_fake_print_message_section_operation_unknown_ /** @@ -318,8 +267,6 @@ extern "C" { * The range within the buffer representing the content. * @param settings_name * The name of the setting that has an invalid value. - * @param print - * Designates how the section error/warning should be printed. */ #ifndef _di_fake_print_warning_settings_content_invalid_ extern void fake_print_warning_settings_content_invalid(const fake_data_t data, const f_string_t path_file, const f_string_dynamic_t buffer, const f_string_range_t range_object, const f_string_range_t range_content, const f_string_t settings_name) f_gcc_attribute_visibility_internal; diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index dcf7b88..ae5a495 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -19,8 +19,8 @@ extern "C" { f_status_t status = F_none; if (data.error.verbosity != f_console_verbosity_quiet) { - printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.set.important, "Generating skeleton structure.%c", f_string_eol[0]); + fprintf(data.output.stream, "%c", f_string_eol[0]); + fl_color_print(data.output.stream, data.context.set.important, "Generating skeleton structure.%c", f_string_eol[0]); } { @@ -56,7 +56,7 @@ extern "C" { status = fake_skeleton_operate_directory_create(data, *parameters_value[i]); if (F_status_is_error(status)) { - fake_print_error(data, F_status_set_fine(status), "fake_skeleton_operate_directory_create", F_true); + fll_error_print(data.error, F_status_set_fine(status), "fake_skeleton_operate_directory_create", F_true); return status; } } // for @@ -166,7 +166,7 @@ extern "C" { if (status == F_true) { if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Directory '%s' already exists.%c", path.string, f_string_eol[0]); + fprintf(data.output.stream, "Directory '%s' already exists.%c", path.string, f_string_eol[0]); } return F_none; @@ -174,10 +174,10 @@ extern "C" { if (status == F_false) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The path '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path.string); - fl_color_print_to(data.error.to, data.context.set.error, "' exists but is not a directory.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The path '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string); + fl_color_print(data.error.to.stream, data.context.set.error, "' exists but is not a directory.%c", f_string_eol[0]); } return F_status_set_warning(F_failure); @@ -187,24 +187,24 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The path '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path.string); - fl_color_print_to(data.error.to, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The path '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string); + fl_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]); } else { - fake_print_error_file(data, F_status_set_fine(status), "f_directory_create", path.string, "create", F_false, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), "f_directory_create", F_true, path.string, "create", fll_error_file_type_directory); } return status; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("Directory '%s' created.%c", path.string, f_string_eol[0]); + fprintf(data.output.stream, "Directory '%s' created.%c", path.string, f_string_eol[0]); } } else if (F_status_is_error(status)) { - fake_print_error_file(data, F_status_set_fine(status), "f_directory_exists", path.string, "create", F_false, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), "f_directory_exists", F_true, path.string, "create", fll_error_file_type_directory); return status; } @@ -222,7 +222,7 @@ extern "C" { if (status == F_true) { if (data.error.verbosity == f_console_verbosity_verbose) { - printf("File '%s' already exists.%c", path.string, f_string_eol[0]); + fprintf(data.output.stream, "File '%s' already exists.%c", path.string, f_string_eol[0]); } return F_none; @@ -234,7 +234,7 @@ extern "C" { if (status == F_true) { if (data.error.verbosity == f_console_verbosity_verbose) { - printf("File '%s' already exists (as a symbolic link).%c", path.string, f_string_eol[0]); + fprintf(data.output.stream, "File '%s' already exists (as a symbolic link).%c", path.string, f_string_eol[0]); } return F_none; @@ -243,7 +243,7 @@ extern "C" { if (status == F_false) { if (data.error.verbosity == f_console_verbosity_verbose) { - printf("File '%s' already exists but is not a regular file (or symbolic link).%c", path.string, f_string_eol[0]); + fprintf(data.output.stream, "File '%s' already exists but is not a regular file (or symbolic link).%c", path.string, f_string_eol[0]); } return F_status_set_warning(F_none); @@ -259,20 +259,20 @@ extern "C" { if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_file_found_not) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The file '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s", path.string); - fl_color_print_to(data.error.to, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The file '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string); + fl_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]); } else { - fake_print_error_file(data, F_status_set_fine(status), "f_file_create", path.string, "create", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), "f_file_create", F_true, path.string, "create", fll_error_file_type_file); } return status; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("File '%s' created.%c", path.string, f_string_eol[0]); + fprintf(data.output.stream, "File '%s' created.%c", path.string, f_string_eol[0]); } if (content.used) { @@ -284,7 +284,7 @@ extern "C" { status = f_file_open(path.string, 0, &file); if (F_status_is_error(status)) { - fake_print_error_file(data, F_status_set_fine(status), "f_file_open", path.string, "pre-populate", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), "f_file_open", F_true, path.string, "pre-populate", fll_error_file_type_file); return status; } @@ -292,21 +292,22 @@ extern "C" { status = f_file_write(file, content, 0); if (F_status_is_error(status)) { - fake_print_error_file(data, F_status_set_fine(status), "f_file_write", path.string, "pre-populate", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), "f_file_write", F_true, path.string, "pre-populate", fll_error_file_type_file); f_file_close(&file.id); return status; } if (data.error.verbosity == f_console_verbosity_verbose) { - printf("File '%s' pre-populated.%c", path.string, f_string_eol[0]); + fprintf(data.output.stream, "File '%s' pre-populated.%c", path.string, f_string_eol[0]); } f_file_close(&file.id); } } else if (F_status_is_error(status)) { - fake_print_error_file(data, F_status_set_fine(status), "f_file_is", path.string, "create", F_true, F_true); + fll_error_file_print(data.error, F_status_set_fine(status), "f_file_is", F_true, path.string, "create", fll_error_file_type_file); + return status; } diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index efe110c..ef18996 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -12,26 +12,26 @@ extern "C" { #endif #ifndef _di_firewall_print_help_ - f_return_status firewall_print_help(const int id, const f_color_context_t context) { + f_return_status firewall_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, firewall_name_long, firewall_version); + fll_program_print_help_header(file, context, firewall_name_long, firewall_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); #ifdef _en_firewall_debug_ - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); #endif // _en_firewall_debug_ - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); #ifdef _en_firewall_debug_ - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging."); #endif // _en_firewall_debug_ printf("%c%c", f_string_eol[0], f_string_eol[0]); @@ -57,7 +57,7 @@ extern "C" { fl_color_print(f_type_output, context.set.standout, firewall_command_show); printf(" Show active firewall settings"); - fll_program_print_help_usage(id, context, firewall_name, "command"); + fll_program_print_help_usage(file, context, firewall_name, "command"); return F_none; } @@ -228,7 +228,7 @@ extern "C" { f_macro_string_dynamics_resize(status, parameters, 7); if (F_status_is_error(status)) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); firewall_delete_local_data(&local); firewall_delete_data(data); return status; @@ -318,10 +318,10 @@ extern "C" { status = F_status_set_fine(status); if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_iptables, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_iptables, f_string_eol[0]); fprintf(f_type_error, " "); f_string_length_t i = 0; @@ -368,13 +368,13 @@ extern "C" { status = F_status_set_fine(status); if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status == F_data_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Could not find any network devices%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Could not find any network devices%c", f_string_eol[0]); } else if (status == F_failure) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to read the device directory '%s'%c", network_devices, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to read the device directory '%s'%c", network_devices, f_string_eol[0]); } firewall_delete_local_data(&local); @@ -457,7 +457,7 @@ extern "C" { return status; } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to perform lock request because the lock instructions are missing from: %s.%c", network_path firewall_file_other, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform lock request because the lock instructions are missing from: %s.%c", network_path firewall_file_other, f_string_eol[0]); firewall_delete_local_data(&local); firewall_delete_data(data); @@ -497,7 +497,7 @@ extern "C" { } } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to perform stop request because the lock instructions are missing from: %s.", network_path firewall_file_other, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform stop request because the lock instructions are missing from: %s.", network_path firewall_file_other, f_string_eol[0]); firewall_delete_local_data(&local); firewall_delete_data(data); @@ -575,7 +575,7 @@ extern "C" { f_macro_string_dynamic_t_resize(status, file_path, network_path_length + data->devices.array[i].used + firewall_file_suffix_length + 1); if (F_status_is_error(status)) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); firewall_delete_local_data(&local); firewall_delete_data(data); return status; @@ -689,7 +689,7 @@ extern "C" { firewall_delete_local_data(&local); } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You did not pass a command%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You did not pass a command%c", f_string_eol[0]); status = F_status_set_error(F_parameter); } diff --git a/level_3/firewall/c/firewall.h b/level_3/firewall/c/firewall.h index 41a963b..2922ceb 100644 --- a/level_3/firewall/c/firewall.h +++ b/level_3/firewall/c/firewall.h @@ -293,7 +293,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_string_dynamics_t chains; @@ -307,7 +307,7 @@ extern "C" { firewall_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_string_dynamics_t_initialize, \ f_string_dynamics_t_initialize, \ @@ -316,8 +316,10 @@ extern "C" { #endif // _di_firewall_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -325,7 +327,7 @@ extern "C" { * F_none on success. */ #ifndef _di_firewall_print_help_ - extern f_return_status firewall_print_help(const int id, const f_color_context_t context); + extern f_return_status firewall_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_firewall_print_help_ /** diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index e3bf0f7..57526d5 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -587,7 +587,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); } else if (status == F_file_found_not) { // the file does not have to exist @@ -595,16 +595,16 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con status = F_none; } else if (status == F_file_open) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Unable to open the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to open the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); } if (status != F_file_found_not) { @@ -622,25 +622,25 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read()%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read()%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); } else if (status == F_file_closed) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: The file '%.*s' is no longer open%c", file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: The file '%.*s' is no longer open%c", file_path.used, file_path.string, f_string_eol[0]); } else if (status == F_file_seek) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); } else if (status == F_file_read) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: A read error occurred while accessing the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A read error occurred while accessing the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read()%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read()%c", status, f_string_eol[0]); } status = F_status_set_error(status); @@ -658,16 +658,16 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_read() for the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_read() for the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { // empty files are to be silently ignored } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_read() for the file '%.*s'%c", status, file_path.used, file_path.string, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_read() for the file '%.*s'%c", status, file_path.used, file_path.string, f_string_eol[0]); } status = F_status_set_error(status); @@ -700,7 +700,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con } if (F_status_is_error(status)) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); f_macro_string_dynamic_t_delete_simple(ip_list_action); } @@ -721,7 +721,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con f_macro_string_dynamic_t_new(status, ip_argument, ip_length); if (F_status_is_error(status)) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); break; } @@ -749,7 +749,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con status = fll_execute_program((f_string_t) current_tool, arguments, 0, &return_code); if (status == F_failure) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", current_tool, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", current_tool, f_string_eol[0]); fprintf(f_type_error, " "); fl_color_print_code(f_type_error, data.context.error); @@ -769,7 +769,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con break; } else if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); // remove ip_argument from arguments string. f_macro_string_dynamic_t_delete_simple(arguments.array[arguments.used]); @@ -819,7 +819,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con status = fll_execute_program(current_tool, arguments, 0, &return_code); if (status == F_failure) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", current_tool, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", current_tool, f_string_eol[0]); fprintf(f_type_error, " "); fl_color_print_code(f_type_error, data.context.error); @@ -834,7 +834,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con break; } else if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); break; } } @@ -1085,10 +1085,10 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains_t *reserv if (status == F_failure) { if (tool == firewall_program_iptables) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_iptables, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_iptables, f_string_eol[0]); } else if (tool == firewall_program_ip6tables) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_ip6tables, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_ip6tables, f_string_eol[0]); } fprintf(f_type_error, " "); @@ -1109,10 +1109,10 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains_t *reserv fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); } f_macro_string_dynamics_t_delete_simple(arguments); @@ -1169,7 +1169,7 @@ f_return_status firewall_delete_chains(const firewall_data_t data) { status = F_status_set_fine(status); if (status == F_failure) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[i], f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[i], f_string_eol[0]); fprintf(f_type_error, " "); fl_color_print_code(f_type_error, data.context.error); @@ -1183,10 +1183,10 @@ f_return_status firewall_delete_chains(const firewall_data_t data) { fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); } return status; @@ -1227,7 +1227,7 @@ f_return_status firewall_delete_chains(const firewall_data_t data) { status = F_status_set_fine(status); if (status == F_failure) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[i], f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[i], f_string_eol[0]); fprintf(f_type_error, " "); fl_color_print_code(f_type_error, data.context.error); @@ -1241,10 +1241,10 @@ f_return_status firewall_delete_chains(const firewall_data_t data) { fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); } return status; @@ -1306,7 +1306,7 @@ f_return_status firewall_default_lock(const firewall_data_t data) { status = F_status_set_fine(status); if (status == F_failure) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[j], f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[j], f_string_eol[0]); fprintf(f_type_error, " "); fl_color_print_code(f_type_error, data.context.error); @@ -1320,10 +1320,10 @@ f_return_status firewall_default_lock(const firewall_data_t data) { fprintf(f_type_error, "\n"); } else if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]); } return status; @@ -1345,26 +1345,26 @@ f_return_status firewall_buffer_rules(const f_string_t filename, const bool opti if (optional) { if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); } else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); } } else { if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to find the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to open the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.%c", filename, f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); } } @@ -1379,25 +1379,25 @@ f_return_status firewall_buffer_rules(const f_string_t filename, const bool opti status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read().%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read().%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_closed) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.%c", filename, f_string_eol[0]); } else if (status == F_file_seek) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_read) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: A read error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: A read error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read().%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read().%c", status, f_string_eol[0]); } return status; @@ -1414,16 +1414,16 @@ f_return_status firewall_buffer_rules(const f_string_t filename, const bool opti status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: No relevant data was found within the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: No relevant data was found within the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", status, filename, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", status, filename, f_string_eol[0]); } return status; @@ -1444,13 +1444,13 @@ f_return_status firewall_process_rules(f_string_range_t *range, firewall_local_d status = F_status_set_fine(status); if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status == F_failure) { // the error message has already been displayed. } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().%c", status, f_string_eol[0]); } f_macro_fss_objects_t_delete_simple(local->rule_objects); diff --git a/level_3/firewall/c/private-firewall.h b/level_3/firewall/c/private-firewall.h index 7c7980d..a432a5a 100644 --- a/level_3/firewall/c/private-firewall.h +++ b/level_3/firewall/c/private-firewall.h @@ -85,7 +85,7 @@ typedef struct { (structure.array[index].stop - structure.array[index].start) + 1 // TODO: temporarily added, convert this to a function below. -// TODO: also report: fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); +// TODO: also report: fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); #define firewall_macro_append_argument_to_arguments(status, arguments, argument) \ if (arguments.used == arguments.size) { \ f_macro_string_dynamics_resize(status, arguments, arguments.used + firewall_default_allocation_step); \ diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index 2e5ec42..e0c83a3 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -6,33 +6,33 @@ extern "C" { #endif #ifndef _di_fss_basic_list_read_print_help_ - f_return_status fss_basic_list_read_print_help(const int id, const f_color_context_t context) { + f_return_status fss_basic_list_read_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_basic_list_read_name_long, fss_basic_list_read_version); + fll_program_print_help_header(file, context, fss_basic_list_read_name_long, fss_basic_list_read_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_basic_list_read_short_at, fss_basic_list_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_depth, fss_basic_list_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_empty, fss_basic_list_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_line, fss_basic_list_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_name, fss_basic_list_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_object, fss_basic_list_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_select, fss_basic_list_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_total, fss_basic_list_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); - fll_program_print_help_option(id, context, fss_basic_list_read_short_trim, fss_basic_list_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_at, fss_basic_list_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_depth, fss_basic_list_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_empty, fss_basic_list_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_line, fss_basic_list_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_name, fss_basic_list_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_object, fss_basic_list_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_select, fss_basic_list_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_total, fss_basic_list_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_basic_list_read_short_trim, fss_basic_list_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); - fll_program_print_help_usage(id, context, fss_basic_list_read_name, "filename(s)"); + fll_program_print_help_usage(file, context, fss_basic_list_read_name, "filename(s)"); fl_color_print(f_type_output, context.set.important, " Notes:"); @@ -191,45 +191,45 @@ extern "C" { if (data->remaining.used > 0 || data->process_pipe) { if (data->parameters[fss_basic_list_read_parameter_at].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_at); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_at); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_list_read_parameter_depth].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_list_read_parameter_name].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a string.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); @@ -237,22 +237,22 @@ extern "C" { if (data->parameters[fss_basic_list_read_parameter_object].result == f_console_result_found) { if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); @@ -261,11 +261,11 @@ extern "C" { if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) { if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_basic_list_read_delete_data(data); return F_status_set_error(F_parameter); @@ -300,9 +300,9 @@ extern "C" { } if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); macro_fss_basic_list_read_depths_t_delete_simple(depths); fss_basic_list_read_delete_data(data); @@ -399,7 +399,7 @@ extern "C" { macro_fss_basic_list_read_depths_t_delete_simple(depths); } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.h b/level_3/fss_basic_list_read/c/fss_basic_list_read.h index 4d1dd3b..ce8525e 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.h +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.h @@ -136,7 +136,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_string_dynamic_t buffer; @@ -152,7 +152,7 @@ extern "C" { fss_basic_list_read_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_string_dynamic_t_initialize, \ f_fss_objects_t_initialize, \ @@ -163,8 +163,10 @@ extern "C" { #endif // _di_fss_basic_list_read_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -172,7 +174,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_read_print_help_ - extern f_return_status fss_basic_list_read_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_basic_list_read_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_basic_list_read_print_help_ /** diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index 9d4f0c1..569891c 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -9,11 +9,11 @@ extern "C" { void fss_basic_list_read_print_file_error(const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status) { if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } } #endif // _di_fss_basic_list_read_print_file_error_ @@ -22,62 +22,62 @@ extern "C" { void fss_basic_list_read_print_number_argument_error(const f_color_context_t context, const f_string_t function_name, const f_string_t parameter_name, const f_string_t argument, const f_status_t status) { if (status == F_parameter) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } else if (status == F_number) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is not a valid number for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_underflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too small for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too large for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_negative) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is negative, which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_positive) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' contains a '"); - fl_color_print_to(data.error.to, context.set.notable, "+"); - fl_color_print_to(data.error.to, context.set.error, "', which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' contains a '"); + fl_color_print(data.error.to.stream, context.set.notable, "+"); + fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_data_not) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, "' for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' with the value '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' with the value '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } } #endif // _di_fss_basic_list_read_print_number_argument_error_ @@ -95,7 +95,7 @@ extern "C" { macro_fss_basic_list_read_depths_t_new(status, (*depths), depth_size); if (F_status_is_error(status)) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); return status; } @@ -177,12 +177,12 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_allocation || status_code == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status_code == f_string_length_t_size) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Unable to process '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_trim); - fl_color_print_to(data.error.to, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_trim); + fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); } else { f_string_t function = "fl_string_append"; @@ -191,20 +191,20 @@ extern "C" { function = "fl_string_rip"; } - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, data.context.set.notable, "%u", status_code); - fl_color_print_to(data.error.to, data.context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, data.context.set.notable, "%s()", function); - fl_color_print_to(data.error.to, data.context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); + fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); + fl_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol[0]); } return status; } if (!depths->array[i].value_name.used) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name); - fl_color_print_to(data.error.to, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name); + fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -217,22 +217,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may only be specified once for the parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may not have the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' before the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[j].depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -259,33 +259,33 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_basic_list_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status == F_incomplete_utf_stop) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else if (status == F_incomplete_utf_eos) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data->error.to, data->context.set.notable, "%u", status); - fl_color_print_to(data->error.to, data->context.set.error, ") has occurred while calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_basic_list_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status); + fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return F_status_set_error(status); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index b8aac94..f3bcc6d 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -5,30 +5,30 @@ extern "C" { #endif #ifndef _di_fss_basic_list_write_print_help_ - f_return_status fss_basic_list_write_print_help(const int id, const f_color_context_t context) { + f_return_status fss_basic_list_write_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_basic_list_write_name_long, fss_basic_list_write_version); + fll_program_print_help_header(file, context, fss_basic_list_write_name_long, fss_basic_list_write_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_basic_list_write_short_content, fss_basic_list_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, " The content to output."); - fll_program_print_help_option(id, context, fss_basic_list_write_short_double, fss_basic_list_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); - fll_program_print_help_option(id, context, fss_basic_list_write_short_file, fss_basic_list_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); - fll_program_print_help_option(id, context, fss_basic_list_write_short_object, fss_basic_list_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); - fll_program_print_help_option(id, context, fss_basic_list_write_short_partial, fss_basic_list_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of object/content character."); - fll_program_print_help_option(id, context, fss_basic_list_write_short_single, fss_basic_list_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_content, fss_basic_list_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, " The content to output."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_double, fss_basic_list_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_file, fss_basic_list_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_object, fss_basic_list_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_partial, fss_basic_list_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of object/content character."); + fll_program_print_help_option(file, context, fss_basic_list_write_short_single, fss_basic_list_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); - fll_program_print_help_usage(id, context, fss_basic_list_write_name, ""); + fll_program_print_help_usage(file, context, fss_basic_list_write_name, ""); return F_none; } @@ -115,19 +115,19 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(buffer); @@ -228,19 +228,19 @@ extern "C" { f_file_close(&output.id); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(buffer); @@ -255,13 +255,13 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]); } else if (status == F_file_write) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(buffer); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.h b/level_3/fss_basic_list_write/c/fss_basic_list_write.h index d73b087..f59b6e2 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.h +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.h @@ -116,7 +116,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_color_context_t context; @@ -127,15 +127,17 @@ extern "C" { fss_basic_list_write_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } #endif // _di_fss_basic_list_write_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -143,7 +145,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_list_write_print_help_ - extern f_return_status fss_basic_list_write_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_basic_list_write_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_basic_list_write_print_help_ /** diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index c5ae37f..106d93e 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -6,33 +6,33 @@ extern "C" { #endif #ifndef _di_fss_basic_read_print_help_ - f_return_status fss_basic_read_print_help(const int id, const f_color_context_t context) { + f_return_status fss_basic_read_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_basic_read_name_long, fss_basic_read_version); + fll_program_print_help_header(file, context, fss_basic_read_name_long, fss_basic_read_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_basic_read_short_at, fss_basic_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); - fll_program_print_help_option(id, context, fss_basic_read_short_depth, fss_basic_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); - fll_program_print_help_option(id, context, fss_basic_read_short_empty, fss_basic_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); - fll_program_print_help_option(id, context, fss_basic_read_short_line, fss_basic_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); - fll_program_print_help_option(id, context, fss_basic_read_short_name, fss_basic_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); - fll_program_print_help_option(id, context, fss_basic_read_short_object, fss_basic_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); - fll_program_print_help_option(id, context, fss_basic_read_short_select, fss_basic_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); - fll_program_print_help_option(id, context, fss_basic_read_short_total, fss_basic_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); - fll_program_print_help_option(id, context, fss_basic_read_short_trim, fss_basic_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); + fll_program_print_help_option(file, context, fss_basic_read_short_at, fss_basic_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); + fll_program_print_help_option(file, context, fss_basic_read_short_depth, fss_basic_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); + fll_program_print_help_option(file, context, fss_basic_read_short_empty, fss_basic_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); + fll_program_print_help_option(file, context, fss_basic_read_short_line, fss_basic_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); + fll_program_print_help_option(file, context, fss_basic_read_short_name, fss_basic_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); + fll_program_print_help_option(file, context, fss_basic_read_short_object, fss_basic_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); + fll_program_print_help_option(file, context, fss_basic_read_short_select, fss_basic_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); + fll_program_print_help_option(file, context, fss_basic_read_short_total, fss_basic_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_basic_read_short_trim, fss_basic_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); - fll_program_print_help_usage(id, context, fss_basic_read_name, "filename(s)"); + fll_program_print_help_usage(file, context, fss_basic_read_name, "filename(s)"); fl_color_print(f_type_output, context.set.important, " Notes:"); @@ -191,45 +191,45 @@ extern "C" { if (data->remaining.used > 0 || data->process_pipe) { if (data->parameters[fss_basic_read_parameter_at].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_at); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_at); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_read_parameter_depth].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_read_parameter_name].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a string.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); @@ -237,22 +237,22 @@ extern "C" { if (data->parameters[fss_basic_read_parameter_object].result == f_console_result_found) { if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter."); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter."); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); @@ -261,11 +261,11 @@ extern "C" { if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) { if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_basic_read_delete_data(data); return F_status_set_error(F_parameter); @@ -300,9 +300,9 @@ extern "C" { } if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); macro_fss_basic_read_depths_t_delete_simple(depths); fss_basic_read_delete_data(data); @@ -404,7 +404,7 @@ extern "C" { macro_fss_basic_read_depths_t_delete_simple(depths); } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_basic_read/c/fss_basic_read.h b/level_3/fss_basic_read/c/fss_basic_read.h index c6dcefb..ba6af6e 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.h +++ b/level_3/fss_basic_read/c/fss_basic_read.h @@ -136,7 +136,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_string_dynamic_t buffer; @@ -152,7 +152,7 @@ extern "C" { fss_basic_read_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_string_dynamic_t_initialize, \ f_fss_objects_t_initialize, \ @@ -163,8 +163,10 @@ extern "C" { #endif // _di_fss_basic_read_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -172,7 +174,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_read_print_help_ - extern f_return_status fss_basic_read_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_basic_read_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_basic_read_print_help_ /** diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index 5884619..9549d80 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -9,11 +9,11 @@ extern "C" { void fss_basic_read_print_file_error(const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status) { if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } } #endif // _di_fss_basic_read_print_file_error_ @@ -22,62 +22,62 @@ extern "C" { void fss_basic_read_print_number_argument_error(const f_color_context_t context, const f_string_t function_name, const f_string_t parameter_name, const f_string_t argument, const f_status_t status) { if (status == F_parameter) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } else if (status == F_number) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is not a valid number for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_underflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too small for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too large for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_negative) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is negative, which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_positive) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' contains a '"); - fl_color_print_to(data.error.to, context.set.notable, "+"); - fl_color_print_to(data.error.to, context.set.error, "', which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' contains a '"); + fl_color_print(data.error.to.stream, context.set.notable, "+"); + fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_data_not) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, "' for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' with the value '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' with the value '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } } #endif // _di_fss_basic_read_print_number_argument_error_ @@ -96,7 +96,7 @@ extern "C" { macro_fss_basic_read_depths_t_new(status, (*depths), depth_size); if (F_status_is_error(status)) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); return status; } @@ -180,12 +180,12 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_allocation || status_code == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status_code == f_string_length_t_size) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Unable to process '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_trim); - fl_color_print_to(data.error.to, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_trim); + fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); } else { f_string_t function = "fl_string_append"; @@ -194,20 +194,20 @@ extern "C" { function = "fl_string_rip"; } - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, data.context.set.notable, "%u", status_code); - fl_color_print_to(data.error.to, data.context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, data.context.set.notable, "%s()", function); - fl_color_print_to(data.error.to, data.context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); + fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); + fl_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol[0]); } return status; } if (!depths->array[i].value_name.used) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name); - fl_color_print_to(data.error.to, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name); + fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -220,22 +220,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may only be specified once for the parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may not have the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' before the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[j].depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -262,33 +262,33 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_basic_list_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status == F_incomplete_utf_stop) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else if (status == F_incomplete_utf_eos) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data->error.to, data->context.set.notable, "%u", status); - fl_color_print_to(data->error.to, data->context.set.error, ") has occurred while calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_basic_list_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status); + fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return F_status_set_error(status); diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index b90e231..21f9e63 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -5,30 +5,30 @@ extern "C" { #endif #ifndef _di_fss_basic_write_print_help_ - f_return_status fss_basic_write_print_help(const int id, const f_color_context_t context) { + f_return_status fss_basic_write_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_basic_write_name_long, fss_basic_write_version); + fll_program_print_help_header(file, context, fss_basic_write_name_long, fss_basic_write_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_basic_write_short_content, fss_basic_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, " The content to output."); - fll_program_print_help_option(id, context, fss_basic_write_short_double, fss_basic_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); - fll_program_print_help_option(id, context, fss_basic_write_short_file, fss_basic_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); - fll_program_print_help_option(id, context, fss_basic_write_short_object, fss_basic_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); - fll_program_print_help_option(id, context, fss_basic_write_short_partial, fss_basic_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of object/content character."); - fll_program_print_help_option(id, context, fss_basic_write_short_single, fss_basic_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); + fll_program_print_help_option(file, context, fss_basic_write_short_content, fss_basic_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, " The content to output."); + fll_program_print_help_option(file, context, fss_basic_write_short_double, fss_basic_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_basic_write_short_file, fss_basic_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); + fll_program_print_help_option(file, context, fss_basic_write_short_object, fss_basic_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); + fll_program_print_help_option(file, context, fss_basic_write_short_partial, fss_basic_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of object/content character."); + fll_program_print_help_option(file, context, fss_basic_write_short_single, fss_basic_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); - fll_program_print_help_usage(id, context, fss_basic_write_name, ""); + fll_program_print_help_usage(file, context, fss_basic_write_name, ""); return F_none; } @@ -115,19 +115,19 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(input); @@ -217,19 +217,19 @@ extern "C" { f_file_close(&output.id); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(buffer); @@ -244,13 +244,13 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]); } else if (status == F_file_write) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(buffer); diff --git a/level_3/fss_basic_write/c/fss_basic_write.h b/level_3/fss_basic_write/c/fss_basic_write.h index 46e3ae6..b7a0968 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.h +++ b/level_3/fss_basic_write/c/fss_basic_write.h @@ -115,7 +115,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_color_context_t context; @@ -126,15 +126,17 @@ extern "C" { fss_basic_write_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } #endif // _di_fss_basic_write_data_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -142,7 +144,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_basic_write_print_help_ - extern f_return_status fss_basic_write_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_basic_write_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_basic_write_print_help_ /** diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index 2612c0f..83398a1 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -6,33 +6,33 @@ extern "C" { #endif #ifndef _di_fss_extended_list_read_print_help_ - f_return_status fss_extended_list_read_print_help(const int id, const f_color_context_t context) { + f_return_status fss_extended_list_read_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_extended_list_read_name_long, fss_extended_list_read_version); + fll_program_print_help_header(file, context, fss_extended_list_read_name_long, fss_extended_list_read_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_extended_list_read_short_at, fss_extended_list_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_depth, fss_extended_list_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_empty, fss_extended_list_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_line, fss_extended_list_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_name, fss_extended_list_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_object, fss_extended_list_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_select, fss_extended_list_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_total, fss_extended_list_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); - fll_program_print_help_option(id, context, fss_extended_list_read_short_trim, fss_extended_list_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_at, fss_extended_list_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_depth, fss_extended_list_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_empty, fss_extended_list_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_line, fss_extended_list_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_name, fss_extended_list_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_object, fss_extended_list_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_select, fss_extended_list_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_total, fss_extended_list_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_extended_list_read_short_trim, fss_extended_list_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); - fll_program_print_help_usage(id, context, fss_extended_list_read_name, "filename(s)"); + fll_program_print_help_usage(file, context, fss_extended_list_read_name, "filename(s)"); fl_color_print(f_type_output, context.set.important, " Notes:"); @@ -191,45 +191,45 @@ extern "C" { if (data->remaining.used > 0 || data->process_pipe) { if (data->parameters[fss_extended_list_read_parameter_at].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_at); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_at); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_list_read_parameter_depth].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_list_read_parameter_name].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a string.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); @@ -237,22 +237,22 @@ extern "C" { if (data->parameters[fss_extended_list_read_parameter_object].result == f_console_result_found) { if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); @@ -261,11 +261,11 @@ extern "C" { if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) { if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_extended_list_read_delete_data(data); return F_status_set_error(F_parameter); @@ -286,9 +286,9 @@ extern "C" { } if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); macro_fss_extended_list_read_depths_t_delete_simple(depths); fss_extended_list_read_delete_data(data); @@ -387,7 +387,7 @@ extern "C" { macro_fss_extended_list_read_depths_t_delete_simple(depths); } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.h b/level_3/fss_extended_list_read/c/fss_extended_list_read.h index 72109a8..eeb4d51 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.h +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.h @@ -136,7 +136,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_string_dynamic_t buffer; @@ -151,7 +151,7 @@ extern "C" { fss_extended_list_read_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_string_dynamic_t_initialize, \ f_fss_nest_t_initialize, \ @@ -161,8 +161,10 @@ extern "C" { #endif // _di_fss_extended_list_read_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -170,7 +172,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_list_read_print_help_ - extern f_return_status fss_extended_list_read_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_extended_list_read_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_extended_list_read_print_help_ /** diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 2f04be0..558e798 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -9,11 +9,11 @@ extern "C" { void fss_extended_list_read_print_file_error(const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status) { if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } } #endif // _di_fss_extended_list_read_print_file_error_ @@ -22,62 +22,62 @@ extern "C" { void fss_extended_list_read_print_number_argument_error(const f_color_context_t context, const f_string_t function_name, const f_string_t parameter_name, const f_string_t argument, const f_status_t status) { if (status == F_parameter) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } else if (status == F_number) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is not a valid number for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_underflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too small for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too large for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_negative) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is negative, which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_positive) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' contains a '"); - fl_color_print_to(data.error.to, context.set.notable, "+"); - fl_color_print_to(data.error.to, context.set.error, "', which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' contains a '"); + fl_color_print(data.error.to.stream, context.set.notable, "+"); + fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_data_not) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, "' for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' with the value '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' with the value '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } } #endif // _di_fss_extended_list_read_print_number_argument_error_ @@ -96,7 +96,7 @@ extern "C" { macro_fss_extended_list_read_depths_t_new(status, (*depths), depth_size); if (F_status_is_error(status)) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); return status; } @@ -180,12 +180,12 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_allocation || status_code == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status_code == f_string_length_t_size) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Unable to process '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_trim); - fl_color_print_to(data.error.to, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_trim); + fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); } else { f_string_t function = "fl_string_append"; @@ -194,20 +194,20 @@ extern "C" { function = "fl_string_rip"; } - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, data.context.set.notable, "%u", status_code); - fl_color_print_to(data.error.to, data.context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, data.context.set.notable, "%s()", function); - fl_color_print_to(data.error.to, data.context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); + fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); + fl_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol[0]); } return status; } if (!depths->array[i].value_name.used) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name); - fl_color_print_to(data.error.to, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name); + fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -220,22 +220,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may only be specified once for the parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may not have the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' before the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[j].depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -262,33 +262,33 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_extended_list_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_list_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status == F_incomplete_utf_stop) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else if (status == F_incomplete_utf_eos) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data->error.to, data->context.set.notable, "%u", status); - fl_color_print_to(data->error.to, data->context.set.error, ") has occurred while calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_extended_list_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status); + fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_list_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return F_status_set_error(status); diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 51e7488..a9aa912 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -6,33 +6,33 @@ extern "C" { #endif #ifndef _di_fss_extended_read_print_help_ - f_return_status fss_extended_read_print_help(const int id, const f_color_context_t context) { + f_return_status fss_extended_read_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_extended_read_name_long, fss_extended_read_version); + fll_program_print_help_header(file, context, fss_extended_read_name_long, fss_extended_read_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_extended_read_short_at, fss_extended_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); - fll_program_print_help_option(id, context, fss_extended_read_short_depth, fss_extended_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); - fll_program_print_help_option(id, context, fss_extended_read_short_empty, fss_extended_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); - fll_program_print_help_option(id, context, fss_extended_read_short_line, fss_extended_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); - fll_program_print_help_option(id, context, fss_extended_read_short_name, fss_extended_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); - fll_program_print_help_option(id, context, fss_extended_read_short_object, fss_extended_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); - fll_program_print_help_option(id, context, fss_extended_read_short_select, fss_extended_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); - fll_program_print_help_option(id, context, fss_extended_read_short_total, fss_extended_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); - fll_program_print_help_option(id, context, fss_extended_read_short_trim, fss_extended_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); + fll_program_print_help_option(file, context, fss_extended_read_short_at, fss_extended_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric index."); + fll_program_print_help_option(file, context, fss_extended_read_short_depth, fss_extended_read_long_depth, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object at this numeric depth."); + fll_program_print_help_option(file, context, fss_extended_read_short_empty, fss_extended_read_long_empty, f_console_symbol_short_enable, f_console_symbol_long_enable, " Include empty content when processing."); + fll_program_print_help_option(file, context, fss_extended_read_short_line, fss_extended_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the content at the given line."); + fll_program_print_help_option(file, context, fss_extended_read_short_name, fss_extended_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select object with this name."); + fll_program_print_help_option(file, context, fss_extended_read_short_object, fss_extended_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the object instead of the content."); + fll_program_print_help_option(file, context, fss_extended_read_short_select, fss_extended_read_long_select, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select sub-content at this index."); + fll_program_print_help_option(file, context, fss_extended_read_short_total, fss_extended_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of lines."); + fll_program_print_help_option(file, context, fss_extended_read_short_trim, fss_extended_read_long_trim, f_console_symbol_short_enable, f_console_symbol_long_enable, " Trim object names on select or print."); - fll_program_print_help_usage(id, context, fss_extended_read_name, "filename(s)"); + fll_program_print_help_usage(file, context, fss_extended_read_name, "filename(s)"); fl_color_print(f_type_output, context.set.important, " Notes:"); @@ -191,45 +191,45 @@ extern "C" { if (data->remaining.used > 0 || data->process_pipe) { if (data->parameters[fss_extended_read_parameter_at].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_at); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_at); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_read_parameter_depth].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_read_parameter_name].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a string.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); @@ -237,22 +237,22 @@ extern "C" { if (data->parameters[fss_extended_read_parameter_object].result == f_console_result_found) { if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); } if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); @@ -261,11 +261,11 @@ extern "C" { if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) { if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); fss_extended_read_delete_data(data); return F_status_set_error(F_parameter); @@ -301,9 +301,9 @@ extern "C" { } if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]); macro_fss_extended_read_depths_t_delete_simple(depths); fss_extended_read_delete_data(data); @@ -405,7 +405,7 @@ extern "C" { macro_fss_extended_read_depths_t_delete_simple(depths); } else { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]); status = F_status_set_error(F_parameter); } diff --git a/level_3/fss_extended_read/c/fss_extended_read.h b/level_3/fss_extended_read/c/fss_extended_read.h index 87b37a1..b1413cc 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.h +++ b/level_3/fss_extended_read/c/fss_extended_read.h @@ -136,7 +136,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_string_dynamic_t buffer; @@ -152,7 +152,7 @@ extern "C" { fss_extended_read_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_string_dynamic_t_initialize, \ f_fss_objects_t_initialize, \ @@ -163,8 +163,10 @@ extern "C" { #endif // _di_fss_extended_read_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -172,7 +174,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_read_print_help_ - extern f_return_status fss_extended_read_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_extended_read_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_extended_read_print_help_ /** diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index 937272e..ff1a3d4 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -9,11 +9,11 @@ extern "C" { void fss_extended_read_print_file_error(const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status) { if (fll_file_error_print(f_type_error, context, function_name, file_name, status) == F_false) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } } #endif // _di_fss_extended_read_print_file_error_ @@ -22,62 +22,62 @@ extern "C" { void fss_extended_read_print_number_argument_error(const f_color_context_t context, const f_string_t function_name, const f_string_t parameter_name, const f_string_t argument, const f_status_t status) { if (status == F_parameter) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } else if (status == F_number) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is not a valid number for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_underflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too small for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too large for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_negative) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is negative, which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_positive) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' contains a '"); - fl_color_print_to(data.error.to, context.set.notable, "+"); - fl_color_print_to(data.error.to, context.set.error, "', which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' contains a '"); + fl_color_print(data.error.to.stream, context.set.notable, "+"); + fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_data_not) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function_name); - fl_color_print_to(data.error.to, context.set.error, "' for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); - fl_color_print_to(data.error.to, context.set.error, "' with the value '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name); + fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name); + fl_color_print(data.error.to.stream, context.set.error, "' with the value '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } } #endif // _di_fss_extended_read_print_number_argument_error_ @@ -95,7 +95,7 @@ extern "C" { macro_fss_extended_read_depths_t_new(status, (*depths), depth_size); if (F_status_is_error(status)) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); return status; } @@ -179,12 +179,12 @@ extern "C" { // @todo: move error printing into common function. if (status_code == F_memory_allocation || status_code == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status_code == f_string_length_t_size) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Unable to process '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_trim); - fl_color_print_to(data.error.to, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_trim); + fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]); } else { f_string_t function = "fl_string_append"; @@ -193,20 +193,20 @@ extern "C" { function = "fl_string_rip"; } - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data.error.to, data.context.set.notable, "%u", status_code); - fl_color_print_to(data.error.to, data.context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, data.context.set.notable, "%s()", function); - fl_color_print_to(data.error.to, data.context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code); + fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function); + fl_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol[0]); } return status; } if (!depths->array[i].value_name.used) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name); - fl_color_print_to(data.error.to, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name); + fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -219,22 +219,22 @@ extern "C" { for (f_array_length_t j = i + 1; j < depths->used; j++) { if (depths->array[i].depth == depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may only be specified once for the parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } else if (depths->array[i].depth > depths->array[j].depth) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth); - fl_color_print_to(data.error.to, data.context.set.error, "' may not have the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[i].depth); - fl_color_print_to(data.error.to, data.context.set.error, "' before the value '"); - fl_color_print_to(data.error.to, data.context.set.notable, "%llu", depths->array[j].depth); - fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "' before the value '"); + fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[j].depth); + fl_color_print(data.error.to.stream, data.context.set.error, "'.%c", f_string_eol[0]); return F_status_set_error(F_parameter); } @@ -261,33 +261,33 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_extended_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else if (status == F_incomplete_utf_stop) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else if (status == F_incomplete_utf_eos) { - fl_color_print_to(data->error.to, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); - fl_color_print_to(data->error.to, data->context.set.notable, "%d", input.start); - fl_color_print_to(data->error.to, data->context.set.error, ").%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start); + fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); - fl_color_print_to(data->error.to, data->context.set.notable, "%u", status); - fl_color_print_to(data->error.to, data->context.set.error, ") has occurred while calling "); - fl_color_print_to(data->error.to, data->context.set.notable, "fll_fss_extended_read()"); - fl_color_print_to(data->error.to, data->context.set.error, " for the file '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s", filename); - fl_color_print_to(data->error.to, data->context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error ("); + fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status); + fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling "); + fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_read()"); + fl_color_print(data->error.to.stream, data->context.set.error, " for the file '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename); + fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]); } return F_status_set_error(status); diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 1948414..804e1c6 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -5,30 +5,30 @@ extern "C" { #endif #ifndef _di_fss_extended_write_print_help_ - f_return_status fss_extended_write_print_help(const int id, const f_color_context_t context) { + f_return_status fss_extended_write_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_extended_write_name_long, fss_extended_write_version); + fll_program_print_help_header(file, context, fss_extended_write_name_long, fss_extended_write_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_extended_write_short_content, fss_extended_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, " The content to output."); - fll_program_print_help_option(id, context, fss_extended_write_short_double, fss_extended_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); - fll_program_print_help_option(id, context, fss_extended_write_short_file, fss_extended_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); - fll_program_print_help_option(id, context, fss_extended_write_short_object, fss_extended_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); - fll_program_print_help_option(id, context, fss_extended_write_short_partial, fss_extended_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of object/content character."); - fll_program_print_help_option(id, context, fss_extended_write_short_single, fss_extended_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); + fll_program_print_help_option(file, context, fss_extended_write_short_content, fss_extended_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, " The content to output."); + fll_program_print_help_option(file, context, fss_extended_write_short_double, fss_extended_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); + fll_program_print_help_option(file, context, fss_extended_write_short_file, fss_extended_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); + fll_program_print_help_option(file, context, fss_extended_write_short_object, fss_extended_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); + fll_program_print_help_option(file, context, fss_extended_write_short_partial, fss_extended_write_long_partial, f_console_symbol_short_enable, f_console_symbol_long_enable, "Do not output end of object/content character."); + fll_program_print_help_option(file, context, fss_extended_write_short_single, fss_extended_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); - fll_program_print_help_usage(id, context, fss_extended_write_name, ""); + fll_program_print_help_usage(file, context, fss_extended_write_name, ""); return F_none; } @@ -115,19 +115,19 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(input); @@ -269,19 +269,19 @@ extern "C" { f_file_close(&output.id); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(buffer); @@ -296,13 +296,13 @@ extern "C" { status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]); } else if (status == F_file_write) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]); } else { - fl_color_print_to(data->error.to, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]); } f_macro_string_dynamic_t_delete_simple(buffer); diff --git a/level_3/fss_extended_write/c/fss_extended_write.h b/level_3/fss_extended_write/c/fss_extended_write.h index 69b43f9..92486e6 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.h +++ b/level_3/fss_extended_write/c/fss_extended_write.h @@ -115,7 +115,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_color_context_t context; @@ -126,15 +126,17 @@ extern "C" { fss_extended_write_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } #endif // _di_fss_extended_write_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -142,7 +144,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_extended_write_print_help_ - extern f_return_status fss_extended_write_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_extended_write_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_extended_write_print_help_ /** diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index ef0e7c6..feb1f35 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -6,28 +6,28 @@ extern "C" { #endif #ifndef _di_fss_status_code_print_help_ - f_return_status fss_status_code_print_help(const int id, const f_color_context_t context) { + f_return_status fss_status_code_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, fss_status_code_name_long, fss_status_code_version); + fll_program_print_help_header(file, context, fss_status_code_name_long, fss_status_code_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, fss_status_code_short_is_fine, fss_status_code_long_is_fine, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is not an error, F_false otherwise."); - fll_program_print_help_option(id, context, fss_status_code_short_is_warning, fss_status_code_long_is_warning, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print F_true if the error code is a warning, F_false otherwise."); - fll_program_print_help_option(id, context, fss_status_code_short_is_error, fss_status_code_long_is_error, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is an error, F_false otherwise."); - fll_program_print_help_option(id, context, fss_status_code_short_number, fss_status_code_long_number, f_console_symbol_short_enable, f_console_symbol_long_enable, " Convert status code name to number."); + fll_program_print_help_option(file, context, fss_status_code_short_is_fine, fss_status_code_long_is_fine, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is not an error, F_false otherwise."); + fll_program_print_help_option(file, context, fss_status_code_short_is_warning, fss_status_code_long_is_warning, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print F_true if the error code is a warning, F_false otherwise."); + fll_program_print_help_option(file, context, fss_status_code_short_is_error, fss_status_code_long_is_error, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is an error, F_false otherwise."); + fll_program_print_help_option(file, context, fss_status_code_short_number, fss_status_code_long_number, f_console_symbol_short_enable, f_console_symbol_long_enable, " Convert status code name to number."); - fll_program_print_help_usage(id, context, fss_status_code_name, "status code(s)"); + fll_program_print_help_usage(file, context, fss_status_code_name, "status code(s)"); return F_none; } @@ -98,39 +98,39 @@ extern "C" { if (data->parameters[fss_status_code_parameter_is_error].result == f_console_result_found) { if (data->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error); - fl_color_print_to(data->error.to, data->context.set.error, "' cannot be used with the parameter "); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error); + fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); fss_status_code_delete_data(data); return F_status_set_error(status); } else if (data->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error); - fl_color_print_to(data->error.to, data->context.set.error, "' cannot be used with the parameter "); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error); + fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); fss_status_code_delete_data(data); return F_status_set_error(status); } } else if (data->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found && data->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning); - fl_color_print_to(data->error.to, data->context.set.error, "' cannot be used with the parameter "); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning); + fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); fss_status_code_delete_data(data); return F_status_set_error(status); } if (data->remaining.used == 0 && !data->process_pipe) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify an error code.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify an error code.%c", f_string_eol[0]); fss_status_code_delete_data(data); return F_status_set_error(F_parameter); diff --git a/level_3/fss_status_code/c/fss_status_code.h b/level_3/fss_status_code/c/fss_status_code.h index cd87eb2..8b522ab 100644 --- a/level_3/fss_status_code/c/fss_status_code.h +++ b/level_3/fss_status_code/c/fss_status_code.h @@ -109,7 +109,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_color_context_t context; @@ -120,15 +120,17 @@ extern "C" { fss_status_code_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } #endif // _di_fss_status_code_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -136,7 +138,7 @@ extern "C" { * F_none on success. */ #ifndef _di_fss_status_code_print_help_ - extern f_return_status fss_status_code_print_help(const int id, const f_color_context_t context); + extern f_return_status fss_status_code_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_fss_status_code_print_help_ /** diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index e2e0e77..ae1c857 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -6,39 +6,39 @@ extern "C" { #endif #ifndef _di_iki_read_print_help_ - f_return_status iki_read_print_help(const int id, const f_color_context_t context) { + f_return_status iki_read_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, iki_read_name_long, iki_read_version); + fll_program_print_help_header(file, context, iki_read_name_long, iki_read_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, iki_read_short_at, iki_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select variable at this numeric index."); - fll_program_print_help_option(id, context, iki_read_short_line, iki_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the variables at the given line."); - fll_program_print_help_option(id, context, iki_read_short_name, iki_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select variables with this name."); - fll_program_print_help_option(id, context, iki_read_short_whole, iki_read_long_whole, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print all of the data instead of just the variable data."); + fll_program_print_help_option(file, context, iki_read_short_at, iki_read_long_at, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select variable at this numeric index."); + fll_program_print_help_option(file, context, iki_read_short_line, iki_read_long_line, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print only the variables at the given line."); + fll_program_print_help_option(file, context, iki_read_short_name, iki_read_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Select variables with this name."); + fll_program_print_help_option(file, context, iki_read_short_whole, iki_read_long_whole, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print all of the data instead of just the variable data."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, iki_read_short_content, iki_read_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print the variable content (default)."); - fll_program_print_help_option(id, context, iki_read_short_literal, iki_read_long_literal, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print the entire variable (aka: object, content, and syntax)."); - fll_program_print_help_option(id, context, iki_read_short_object, iki_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the variable name (aka: object)."); - fll_program_print_help_option(id, context, iki_read_short_total, iki_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of variables."); + fll_program_print_help_option(file, context, iki_read_short_content, iki_read_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print the variable content (default)."); + fll_program_print_help_option(file, context, iki_read_short_literal, iki_read_long_literal, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print the entire variable (aka: object, content, and syntax)."); + fll_program_print_help_option(file, context, iki_read_short_object, iki_read_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the variable name (aka: object)."); + fll_program_print_help_option(file, context, iki_read_short_total, iki_read_long_total, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print the total number of variables."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, iki_read_short_substitute, iki_read_long_substitute, f_console_symbol_short_enable, f_console_symbol_long_enable, "Substitute the entire variable for the given name and content value with the given string."); + fll_program_print_help_option(file, context, iki_read_short_substitute, iki_read_long_substitute, f_console_symbol_short_enable, f_console_symbol_long_enable, "Substitute the entire variable for the given name and content value with the given string."); - fll_program_print_help_usage(id, context, iki_read_name, "filename(s)"); + fll_program_print_help_usage(file, context, iki_read_name, "filename(s)"); fl_color_print(f_type_output, context.set.important, " Notes:"); @@ -105,7 +105,7 @@ extern "C" { iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true); if (data->error.verbosity == f_console_verbosity_verbose) { - dprintf(data->error.to, "%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); } iki_read_delete_data(data); @@ -162,10 +162,10 @@ extern "C" { if (data->remaining.used > 0 || data->process_pipe) { if (data->parameters[iki_read_parameter_at].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -188,12 +188,12 @@ extern "C" { if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter."); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter."); } status = F_status_set_error(F_parameter); @@ -202,10 +202,10 @@ extern "C" { if (data->parameters[iki_read_parameter_line].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_line); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_line); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -229,10 +229,10 @@ extern "C" { if (data->parameters[iki_read_parameter_name].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_name); - fl_color_print_to(data->error.to, data->context.set.error, "' requires a string.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_name); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -241,10 +241,10 @@ extern "C" { if (data->parameters[iki_read_parameter_substitute].result != f_console_result_none) { if (data->parameters[iki_read_parameter_substitute].result == f_console_result_found || data->parameters[iki_read_parameter_substitute].additional.used % 3 != 0) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute); - fl_color_print_to(data->error.to, data->context.set.error, "' requires 3 strings.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute); + fl_color_print(data->error.to.stream, data->context.set.error, "' requires 3 strings.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -252,12 +252,12 @@ extern "C" { if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -267,12 +267,12 @@ extern "C" { if (data->parameters[iki_read_parameter_literal].result == f_console_result_found) { if (data->parameters[iki_read_parameter_object].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -280,12 +280,12 @@ extern "C" { if (data->parameters[iki_read_parameter_content].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -293,12 +293,12 @@ extern "C" { if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -309,12 +309,12 @@ extern "C" { else if (data->parameters[iki_read_parameter_object].result == f_console_result_found) { if (data->parameters[iki_read_parameter_content].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -322,12 +322,12 @@ extern "C" { if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -346,12 +346,12 @@ extern "C" { if (data->parameters[iki_read_parameter_whole].result == f_console_result_found) { if (data->parameters[iki_read_parameter_total].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Cannot specify the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_whole); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter with the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); - fl_color_print_to(data->error.to, data->context.set.error, "' parameter.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_whole); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameter.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -360,7 +360,7 @@ extern "C" { if (F_status_is_error(status)) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); } iki_read_delete_data(data); @@ -435,8 +435,8 @@ extern "C" { } else { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: you failed to specify one or more files.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: you failed to specify one or more files.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -445,7 +445,7 @@ extern "C" { // ensure a newline is always put at the end of the program execution, unless in quiet mode. if (data->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status) || !data->mode) { - dprintf(data->error.to, "%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); } } diff --git a/level_3/iki_read/c/iki_read.h b/level_3/iki_read/c/iki_read.h index f2205da..642d0b2 100644 --- a/level_3/iki_read/c/iki_read.h +++ b/level_3/iki_read/c/iki_read.h @@ -235,7 +235,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; uint8_t mode; @@ -255,7 +255,7 @@ extern "C" { iki_read_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ 0, \ 0, \ @@ -267,8 +267,10 @@ extern "C" { #endif // _di_iki_read_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -276,7 +278,7 @@ extern "C" { * F_none on success. */ #ifndef _di_iki_read_print_help_ - extern f_return_status iki_read_print_help(const int id, const f_color_context_t context); + extern f_return_status iki_read_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_iki_read_print_help_ /** diff --git a/level_3/iki_read/c/private-iki_read.c b/level_3/iki_read/c/private-iki_read.c index 20ae402..fd02230 100644 --- a/level_3/iki_read/c/private-iki_read.c +++ b/level_3/iki_read/c/private-iki_read.c @@ -10,10 +10,10 @@ extern "C" { if (status == F_parameter) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Invalid parameter when calling function "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid parameter when calling function "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; @@ -21,10 +21,10 @@ extern "C" { if (status == F_memory_allocation || status == F_memory_reallocation) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Unable to allocate memory in function "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Unable to allocate memory in function "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; @@ -32,10 +32,10 @@ extern "C" { if (status == F_buffer_too_large) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Maximum buffer limit reached while processing "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum buffer limit reached while processing "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; @@ -43,22 +43,22 @@ extern "C" { if (status == F_string_too_large) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Maximum string limit reached while processing "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum string limit reached while processing "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; } if (fallback && verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "UNKNOWN ERROR: ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") in function "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") in function "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_unknown; @@ -71,10 +71,10 @@ extern "C" { if (status == F_file_found_not) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to find %s '", file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to find %s '", file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -82,10 +82,10 @@ extern "C" { if (status == F_file_found) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: The %s '", file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "' already exists.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The %s '", file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "' already exists.%c", f_string_eol[0]); } return F_false; @@ -93,12 +93,12 @@ extern "C" { if (status == F_parameter) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "() for the %s '", file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "() for the %s '", file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -106,10 +106,10 @@ extern "C" { if (status == F_name) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Invalid %s name '", file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid %s name '", file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -117,10 +117,10 @@ extern "C" { if (status == F_memory_out) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -128,10 +128,10 @@ extern "C" { if (status == F_number_overflow) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -139,10 +139,10 @@ extern "C" { if (status == F_directory) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -150,10 +150,10 @@ extern "C" { if (status == F_access_denied) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -161,10 +161,10 @@ extern "C" { if (status == F_loop) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Loop while trying to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Loop while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -172,10 +172,10 @@ extern "C" { if (status == F_prohibited) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -184,10 +184,10 @@ extern "C" { if (is_file) { if (status == F_directory_found_not) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); } return F_false; @@ -196,10 +196,10 @@ extern "C" { else { if (status == F_directory_found_not) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); } return F_false; @@ -207,10 +207,10 @@ extern "C" { if (status == F_failure) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -218,12 +218,12 @@ extern "C" { } if (iki_read_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "UNKNOWN ERROR: ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") occurred while trying to %s %s '", operation, file_or_directory); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") occurred while trying to %s %s '", operation, file_or_directory); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_true; @@ -234,65 +234,65 @@ extern "C" { void iki_read_print_error_number_argument(const f_color_context_t context, const uint8_t verbosity, const f_status_t status, const f_string_t function, const f_string_t parameter, const f_string_t argument) { if (verbosity == f_console_verbosity_quiet) return; - dprintf(data.error.to, "%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); if (status == F_parameter) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function); - fl_color_print_to(data.error.to, context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function); + fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]); } else if (status == F_number) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is not a valid number for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_underflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too small for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is too large for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_negative) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' is negative, which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_number_positive) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The argument '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "' contains a '"); - fl_color_print_to(data.error.to, context.set.notable, "+"); - fl_color_print_to(data.error.to, context.set.error, "', which is not allowed for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "' contains a '"); + fl_color_print(data.error.to.stream, context.set.notable, "+"); + fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } else if (status == F_data_not) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, context.set.error, "UNKNOWN ERROR: ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") has occurred while calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s()", function); - fl_color_print_to(data.error.to, context.set.error, "' for the parameter '"); - fl_color_print_to(data.error.to, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); - fl_color_print_to(data.error.to, context.set.error, "' with the value '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", argument); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s()", function); + fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter); + fl_color_print(data.error.to.stream, context.set.error, "' with the value '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", argument); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } } #endif // _di_iki_read_print_error_number_argument_ diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index e0b88b9..c2193ed 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -6,29 +6,29 @@ extern "C" { #endif #ifndef _di_iki_write_print_help_ - f_return_status iki_write_print_help(const int id, const f_color_context_t context) { + f_return_status iki_write_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, iki_write_name_long, iki_write_version); + fll_program_print_help_header(file, context, iki_write_name_long, iki_write_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, iki_write_short_file, iki_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); - fll_program_print_help_option(id, context, iki_write_short_content, iki_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "The content to output."); - fll_program_print_help_option(id, context, iki_write_short_double, iki_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); - fll_program_print_help_option(id, context, iki_write_short_object, iki_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); - fll_program_print_help_option(id, context, iki_write_short_single, iki_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); + fll_program_print_help_option(file, context, iki_write_short_file, iki_write_long_file, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a file to send output to."); + fll_program_print_help_option(file, context, iki_write_short_content, iki_write_long_content, f_console_symbol_short_enable, f_console_symbol_long_enable, "The content to output."); + fll_program_print_help_option(file, context, iki_write_short_double, iki_write_long_double, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use double quotes (default)."); + fll_program_print_help_option(file, context, iki_write_short_object, iki_write_long_object, f_console_symbol_short_enable, f_console_symbol_long_enable, " The object to output."); + fll_program_print_help_option(file, context, iki_write_short_single, iki_write_long_single, f_console_symbol_short_enable, f_console_symbol_long_enable, " Use single quotes."); - fll_program_print_help_usage(id, context, iki_write_name, "filename(s)"); + fll_program_print_help_usage(file, context, iki_write_name, "filename(s)"); fl_color_print(f_type_output, context.set.important, " Notes:"); @@ -68,7 +68,7 @@ extern "C" { iki_write_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true); if (data->error.verbosity == f_console_verbosity_verbose) { - dprintf(data->error.to, "%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); } iki_write_delete_data(data); @@ -129,9 +129,9 @@ extern "C" { if (data->parameters[iki_write_parameter_file].result == f_console_result_additional) { if (data->parameters[iki_write_parameter_file].additional.used > 1) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file); - fl_color_print_to(data->error.to, data->context.set.error, "' may only be specified once.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file); + fl_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -149,9 +149,9 @@ extern "C" { } else if (data->parameters[iki_write_parameter_file].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file); - fl_color_print_to(data->error.to, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file); + fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -160,9 +160,9 @@ extern "C" { if (F_status_is_fine(status) && data->parameters[iki_write_parameter_object].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -170,9 +170,9 @@ extern "C" { if (F_status_is_fine(status) && data->parameters[iki_write_parameter_content].result == f_console_result_found) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content); - fl_color_print_to(data->error.to, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content); + fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -181,12 +181,12 @@ extern "C" { if (F_status_is_fine(status) && !data->process_pipe) { if (data->parameters[iki_write_parameter_object].result != f_console_result_additional && data->parameters[iki_write_parameter_content].result != f_console_result_additional) { if (data->error.verbosity != f_console_verbosity_quiet) { - dprintf(data->error.to, "%c", f_string_eol[0]); - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: No data provided, either pipe the data or use the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' and the '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content); - fl_color_print_to(data->error.to, data->context.set.error, "' parameters.%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: No data provided, either pipe the data or use the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' and the '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content); + fl_color_print(data->error.to.stream, data->context.set.error, "' parameters.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -196,11 +196,11 @@ extern "C" { if (F_status_is_fine(status)) { if (data->parameters[iki_write_parameter_object].additional.used != data->parameters[iki_write_parameter_content].additional.used) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameters '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content); - fl_color_print_to(data->error.to, data->context.set.error, "' and '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object); - fl_color_print_to(data->error.to, data->context.set.error, "' must be specified the same number of times.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameters '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content); + fl_color_print(data->error.to.stream, data->context.set.error, "' and '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object); + fl_color_print(data->error.to.stream, data->context.set.error, "' must be specified the same number of times.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -256,7 +256,7 @@ extern "C" { if (!buffer.used) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The pipe has no content.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The pipe has no content.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -282,7 +282,7 @@ extern "C" { if (object_ended && previous == range.start) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The pipe has incorrectly placed newlines.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The pipe has incorrectly placed newlines.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -339,7 +339,7 @@ extern "C" { if (F_status_is_fine(status) && object_ended) { if (data->error.verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The pipe has an object without content.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The pipe has an object without content.%c", f_string_eol[0]); } status = F_status_set_error(F_parameter); @@ -388,7 +388,7 @@ extern "C" { // ensure a newline is always put at the end of the program execution, unless in quiet mode. if (data->error.verbosity != f_console_verbosity_quiet) { if (F_status_is_error(status)) { - dprintf(data->error.to, "%c", f_string_eol[0]); + fprintf(data->error.to.stream, "%c", f_string_eol[0]); } } diff --git a/level_3/iki_write/c/iki_write.h b/level_3/iki_write/c/iki_write.h index 9232668..6331d00 100644 --- a/level_3/iki_write/c/iki_write.h +++ b/level_3/iki_write/c/iki_write.h @@ -122,7 +122,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_string_dynamic_t buffer; @@ -135,7 +135,7 @@ extern "C" { iki_write_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_string_dynamic_t_initialize, \ f_color_context_t_initialize, \ @@ -143,8 +143,10 @@ extern "C" { #endif // _di_iki_write_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -152,7 +154,7 @@ extern "C" { * F_none on success. */ #ifndef _di_iki_write_print_help_ - extern f_return_status iki_write_print_help(const int id, const f_color_context_t context); + extern f_return_status iki_write_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_iki_write_print_help_ /** diff --git a/level_3/iki_write/c/private-iki_write.c b/level_3/iki_write/c/private-iki_write.c index 01f1ebf..e99d90f 100644 --- a/level_3/iki_write/c/private-iki_write.c +++ b/level_3/iki_write/c/private-iki_write.c @@ -10,10 +10,10 @@ extern "C" { if (status == F_parameter) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Invalid parameter when calling function "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid parameter when calling function "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; @@ -21,10 +21,10 @@ extern "C" { if (status == F_memory_allocation || status == F_memory_reallocation) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Unable to allocate memory in function "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Unable to allocate memory in function "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; @@ -32,10 +32,10 @@ extern "C" { if (status == F_buffer_too_large) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Maximum buffer limit reached while processing "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum buffer limit reached while processing "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; @@ -43,22 +43,22 @@ extern "C" { if (status == F_string_too_large) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Maximum string limit reached while processing "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum string limit reached while processing "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_none; } if (fallback && verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "UNKNOWN ERROR: ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") in function "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "().%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") in function "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]); } return F_unknown; @@ -78,10 +78,10 @@ extern "C" { if (status == F_file_found_not) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to find %s '", type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to find %s '", type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -89,9 +89,9 @@ extern "C" { if (status == F_file_closed) { if (verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: The %s '", type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "' is no longer open.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: The %s '", type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "' is no longer open.%c", f_string_eol[0]); } return F_false; @@ -99,9 +99,9 @@ extern "C" { if (status == F_file_seek) { if (verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: A seek error occurred while accessing the file '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: A seek error occurred while accessing the file '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -109,9 +109,9 @@ extern "C" { if (status == F_file_read) { if (verbosity != f_console_verbosity_quiet) { - fl_color_print_to(data.error.to, context.set.error, "ERROR: A read error occurred while accessing the file '"); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: A read error occurred while accessing the file '"); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -119,10 +119,10 @@ extern "C" { if (status == F_file_found) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: The %s '", type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "' already exists.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: The %s '", type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "' already exists.%c", f_string_eol[0]); } return F_false; @@ -130,12 +130,12 @@ extern "C" { if (status == F_parameter) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); - fl_color_print_to(data.error.to, context.set.notable, "%s", function); - fl_color_print_to(data.error.to, context.set.error, "() for the %s '", type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling "); + fl_color_print(data.error.to.stream, context.set.notable, "%s", function); + fl_color_print(data.error.to.stream, context.set.error, "() for the %s '", type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -143,10 +143,10 @@ extern "C" { if (status == F_name) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Invalid %s name '", type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid %s name '", type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -154,10 +154,10 @@ extern "C" { if (status == F_memory_out) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -165,10 +165,10 @@ extern "C" { if (status == F_number_overflow) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -176,10 +176,10 @@ extern "C" { if (status == F_directory) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -187,10 +187,10 @@ extern "C" { if (status == F_access_denied) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -198,10 +198,10 @@ extern "C" { if (status == F_loop) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Loop while trying to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Loop while trying to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -209,10 +209,10 @@ extern "C" { if (status == F_prohibited) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -221,10 +221,10 @@ extern "C" { if (!type) { if (status == F_directory_found_not) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); } return F_false; @@ -233,10 +233,10 @@ extern "C" { else if (type == 1) { if (status == F_directory_found_not) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]); } return F_false; @@ -244,10 +244,10 @@ extern "C" { if (status == F_failure) { if (verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "ERROR: Failed to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_false; @@ -255,12 +255,12 @@ extern "C" { } if (iki_write_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, context.set.error, "UNKNOWN ERROR: ("); - fl_color_print_to(data.error.to, context.set.notable, "%llu", status); - fl_color_print_to(data.error.to, context.set.error, ") occurred while trying to %s %s '", operation, type_name); - fl_color_print_to(data.error.to, context.set.notable, "%s", name); - fl_color_print_to(data.error.to, context.set.error, "'.%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: ("); + fl_color_print(data.error.to.stream, context.set.notable, "%llu", status); + fl_color_print(data.error.to.stream, context.set.error, ") occurred while trying to %s %s '", operation, type_name); + fl_color_print(data.error.to.stream, context.set.notable, "%s", name); + fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]); } return F_true; @@ -272,10 +272,10 @@ extern "C" { if (!object.used) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The object is missing, it must not have a length of "); - fl_color_print_to(data.error.to, data.context.set.notable, "0"); - fl_color_print_to(data.error.to, data.context.set.error, ".%c", f_string_eol[0]); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The object is missing, it must not have a length of "); + fl_color_print(data.error.to.stream, data.context.set.notable, "0"); + fl_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol[0]); } return F_status_set_error(F_failure); @@ -285,14 +285,14 @@ extern "C" { if (status == F_false) { if (data.error.verbosity != f_console_verbosity_quiet) { - dprintf(data.error.to, "%c", f_string_eol[0]); - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: The object '"); + fprintf(data.error.to.stream, "%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The object '"); fl_color_print_code(f_type_error, data.context.notable); f_print_dynamic(f_type_error, object); fl_color_print_code(f_type_error, data.context.reset); - fl_color_print_to(data.error.to, data.context.set.error, "' is not a valid IKI object.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "' is not a valid IKI object.%c", f_string_eol[0]); } return F_status_set_error(F_failure); diff --git a/level_3/init/c/init.c b/level_3/init/c/init.c index 096f7c7..3a6d52b 100644 --- a/level_3/init/c/init.c +++ b/level_3/init/c/init.c @@ -24,26 +24,26 @@ extern "C" { #endif // _di_init_print_version_ #ifndef _di_init_print_help_ - f_return_status init_print_help(const int id, const f_color_context_t context) { + f_return_status init_print_help(const f_file_t file, const f_color_context_t context) { - fll_program_print_help_header(id, context, init_name_long, init_version); + fll_program_print_help_header(file, context, init_name_long, init_version); - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, init_parameter_no_prepare_short_name, init_parameter_no_prepare_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Do not attempt to process kernel command line or perform any boot-time specific preparations."); - fll_program_print_help_option(id, context, init_parameter_runlevel_short_name, init_parameter_runlevel_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom run level, ignoring the kernel command line runlevel argument."); + fll_program_print_help_option(file, context, init_parameter_no_prepare_short_name, init_parameter_no_prepare_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Do not attempt to process kernel command line or perform any boot-time specific preparations."); + fll_program_print_help_option(file, context, init_parameter_runlevel_short_name, init_parameter_runlevel_long_name, f_console_symbol_short_enable, f_console_symbol_long_enable, " Specify a custom run level, ignoring the kernel command line runlevel argument."); - fll_program_print_help_usage(id, context, init_name, ""); + fll_program_print_help_usage(file, context, init_name, ""); return F_none; } @@ -168,13 +168,13 @@ extern "C" { pid_t pid_services = clone(init_handler_child_services, stack_memory.services + init_stack_size_small_services, init_flags_clone, stack_memory.services); if (pid_services < 0) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to clone services process (errno = %i).%c", errno, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to clone services process (errno = %i).%c", errno, f_string_eol[0]); } pid_t pid_control_file = clone(init_handler_child_control_file, stack_memory.control_file + init_stack_size_control_file, init_flags_clone, stack_memory.control_file); if (pid_control_file < 0) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Failed to clone control via file process (errno = %i).%c", errno, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to clone control via file process (errno = %i).%c", errno, f_string_eol[0]); } */ @@ -202,11 +202,11 @@ extern "C" { continue; } else if (errno != EINTR) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: sigwaitinfo() failed (errno = %i).%c", errno, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: sigwaitinfo() failed (errno = %i).%c", errno, f_string_eol[0]); signal_problem_count++; if (signal_problem_count > problem_count_max_signal_size) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Max signal problem count has been reached, sleeping for a period of time.%c", errno, f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Max signal problem count has been reached, sleeping for a period of time.%c", errno, f_string_eol[0]); sleep(init_panic_signal_sleep_seconds); signal_problem_count = 0; } diff --git a/level_3/init/c/init.h b/level_3/init/c/init.h index 2cac4e3..7f3a944 100644 --- a/level_3/init/c/init.h +++ b/level_3/init/c/init.h @@ -236,7 +236,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_color_context_t context; @@ -247,7 +247,7 @@ extern "C" { init_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } @@ -294,8 +294,10 @@ extern "C" { #endif // _di_init_print_version_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -303,7 +305,7 @@ extern "C" { * F_none on success. */ #ifndef _di_init_print_help_ - extern f_return_status init_print_help(const int id, const f_color_context_t context); + extern f_return_status init_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_init_print_help_ /** diff --git a/level_3/init/c/private-init.c b/level_3/init/c/private-init.c index f9678ab..d751ce0 100644 --- a/level_3/init/c/private-init.c +++ b/level_3/init/c/private-init.c @@ -17,21 +17,21 @@ if (optional) { if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); } else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); } } else { if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]); } else if (status == F_file_found_not) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Unable to find the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to find the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_open) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Unable to open the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to open the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_descriptor) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.%c", filename, f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]); } } @@ -49,19 +49,19 @@ status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read_until().%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read_until().%c", f_string_eol[0]); } else if (status == F_number_overflow) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_closed) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.%c", filename, f_string_eol[0]); } else if (status == F_file_seek) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_file_read) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: A read error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A read error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read_until().%c", status, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read_until().%c", status, f_string_eol[0]); } return F_status_set_error(status); @@ -77,13 +77,13 @@ status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.%c", filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.%c", filename, f_string_eol[0]); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", status, filename, f_string_eol[0]); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", status, filename, f_string_eol[0]); } return F_status_set_error(status); @@ -107,11 +107,11 @@ status = F_status_set_fine(status); if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); } else if (status == F_failure) { // the error message has already been displayed. } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status); } f_macro_fss_objects_t_delete_simple(local->rule_objects); @@ -494,13 +494,13 @@ status = F_status_set_fine(status); if (status == F_parameter) { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", init_rule_core_file); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", init_rule_core_file); } else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) { - fl_color_print_to(data.error.to, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.", init_rule_core_file); + fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.", init_rule_core_file); } else if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.", status, init_rule_core_file); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.", status, init_rule_core_file); } f_macro_string_dynamic_t_delete(buffer); @@ -525,10 +525,10 @@ if (F_status_is_error(status_process)) { if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status); } // @todo: init_delete_data((*data)); @@ -551,11 +551,11 @@ status = F_status_set_fine(status); if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); + fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); } else if (status == F_failure) { // the error message has already been displayed. } else { - fl_color_print_to(data.error.to, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status); + fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status); } f_macro_fss_objects_t_delete_simple((*rule_objects)); @@ -565,10 +565,10 @@ } else { if (status == F_memory_allocation || status == F_memory_reallocation) { - fl_color_print_to(data.error.to, context.set.error, "CRITICAL ERROR: Unable to allocate memory."); + fl_color_print(data.error.to.stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory."); } else { - fl_color_print_to(data.error.to, context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status); + fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status); } } diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 883001c..559d8dc 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -6,27 +6,27 @@ extern "C" { #endif #ifndef _di_status_code_print_help_ - f_return_status status_code_print_help(const int id, const f_color_context_t context) { - fll_program_print_help_header(id, context, status_code_name_long, status_code_version); - - fll_program_print_help_option(id, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); - fll_program_print_help_option(id, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); - fll_program_print_help_option(id, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); - fll_program_print_help_option(id, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); - fll_program_print_help_option(id, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); + f_return_status status_code_print_help(const f_file_t file, const f_color_context_t context) { + fll_program_print_help_header(file, context, status_code_name_long, status_code_version); + + fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); + fll_program_print_help_option(file, context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on dark backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, " Output using colors that show up better on light backgrounds."); + fll_program_print_help_option(file, context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color."); + fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output."); + fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number."); printf("%c", f_string_eol[0]); - fll_program_print_help_option(id, context, status_code_short_is_fine, status_code_long_is_fine, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is not an error, F_false otherwise."); - fll_program_print_help_option(id, context, status_code_short_is_warning, status_code_long_is_warning, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print F_true if the error code is a warning, F_false otherwise."); - fll_program_print_help_option(id, context, status_code_short_is_error, status_code_long_is_error, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is an error, F_false otherwise."); - fll_program_print_help_option(id, context, status_code_short_number, status_code_long_number, f_console_symbol_short_enable, f_console_symbol_long_enable, " Convert status code name to number."); + fll_program_print_help_option(file, context, status_code_short_is_fine, status_code_long_is_fine, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is not an error, F_false otherwise."); + fll_program_print_help_option(file, context, status_code_short_is_warning, status_code_long_is_warning, f_console_symbol_short_enable, f_console_symbol_long_enable, "Print F_true if the error code is a warning, F_false otherwise."); + fll_program_print_help_option(file, context, status_code_short_is_error, status_code_long_is_error, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print F_true if the error code is an error, F_false otherwise."); + fll_program_print_help_option(file, context, status_code_short_number, status_code_long_number, f_console_symbol_short_enable, f_console_symbol_long_enable, " Convert status code name to number."); - fll_program_print_help_usage(id, context, status_code_name, "status code(s)"); + fll_program_print_help_usage(file, context, status_code_name, "status code(s)"); return F_none; } @@ -97,39 +97,39 @@ extern "C" { if (data->parameters[status_code_parameter_is_error].result == f_console_result_found) { if (data->parameters[status_code_parameter_is_warning].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error); - fl_color_print_to(data->error.to, data->context.set.error, "' cannot be used with the parameter "); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error); + fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); status_code_delete_data(data); return F_status_set_error(status); } else if (data->parameters[status_code_parameter_is_fine].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error); - fl_color_print_to(data->error.to, data->context.set.error, "' cannot be used with the parameter "); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error); + fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); status_code_delete_data(data); return F_status_set_error(status); } } else if (data->parameters[status_code_parameter_is_warning].result == f_console_result_found && data->parameters[status_code_parameter_is_fine].result == f_console_result_found) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: The parameter '"); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning); - fl_color_print_to(data->error.to, data->context.set.error, "' cannot be used with the parameter "); - fl_color_print_to(data->error.to, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine); - fl_color_print_to(data->error.to, data->context.set.error, ".%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '"); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning); + fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter "); + fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine); + fl_color_print(data->error.to.stream, data->context.set.error, ".%c", f_string_eol[0]); status_code_delete_data(data); return F_status_set_error(status); } if (data->remaining.used == 0 && !data->process_pipe) { - fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You failed to specify a status code.%c", f_string_eol[0]); + fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify a status code.%c", f_string_eol[0]); status_code_delete_data(data); return F_status_set_error(F_parameter); diff --git a/level_3/status_code/c/status_code.h b/level_3/status_code/c/status_code.h index a22c18d..b1a9894 100644 --- a/level_3/status_code/c/status_code.h +++ b/level_3/status_code/c/status_code.h @@ -108,7 +108,7 @@ extern "C" { f_string_lengths_t remaining; bool process_pipe; - int output; + f_file_t output; fll_error_print_t error; f_color_context_t context; @@ -119,15 +119,17 @@ extern "C" { status_code_console_parameter_t_initialize, \ f_string_lengths_t_initialize, \ F_false, \ - f_type_descriptor_output, \ + f_macro_file_t_initialize(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \ fll_error_print_t_initialize, \ f_color_context_t_initialize, \ } #endif // _di_status_code_data_t_ /** - * Print help to standard output. + * Print help. * + * @param file + * The file to print to. * @param context * The color context settings. * @@ -135,7 +137,7 @@ extern "C" { * F_none on success. */ #ifndef _di_status_code_print_help_ - extern f_return_status status_code_print_help(const int id, const f_color_context_t context); + extern f_return_status status_code_print_help(const f_file_t file, const f_color_context_t context); #endif // _di_status_code_print_help_ /**