As part of making the level_3 projects (aka programs) more consistent, I started centralizing the print functions.
This started with status/error handling.
Then one thing led to the next and I ended up deciding to change the behavior to use file descriptors more consistently everywhere in the FLL project.
I also decided to go with the error print structure I original created in the fake program.
Verbosity has been moved into this structure.
The new level_2 project "fll_error" will store the error messages that are shared between the level_3 projects.
Given the size of these changes, I didn't complete the work.
This commit is guaranteed to not compile.
build_language c
build_libraries -lc
build_libraries-level -lfll_1 -lfll_0
-build_sources_library execute.c private-execute.c file.c private-file.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c fss_status.c iki.c private-iki.c path.c program.c status.c
+build_sources_library error.c private-error.c execute.c private-execute.c file.c private-file.c fss.c private-fss.c fss_basic.c fss_basic_list.c fss_extended.c fss_extended_list.c fss_status.c iki.c private-iki.c path.c program.c status.c
build_sources_program
-build_sources_headers execute.h file.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_status.h iki.h path.h program.h status.h
+build_sources_headers error.h error-common.h execute.h file.h fss.h fss_basic.h fss_basic_list.h fss_extended.h fss_extended_list.h fss_status.h iki.h path.h program.h status.h
build_sources_script
build_sources_setting
build_script yes
build_language c
build_libraries -lc
build_libraries-monolithic
-build_sources_library level_0/account.c level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/fss.c level_0/iki.c level_0/private-iki.c level_0/memory.c level_0/path.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/private-print.c level_0/serialize.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/program.c level_2/status.c
+build_sources_library level_0/account.c level_0/console.c level_0/conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/private-file.c level_0/fss.c level_0/iki.c level_0/private-iki.c level_0/memory.c level_0/path.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/private-print.c level_0/serialize.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/utf.c level_0/private-utf.c level_1/color.c level_1/console.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/error.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/program.c level_2/status.c
build_sources_program
-build_sources_headers level_0/account.h level_0/account-common.h level_0/color.h level_0/console.h level_0/console-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quoted.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/memory.h level_0/memory_structure.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h
+build_sources_headers level_0/account.h level_0/account-common.h level_0/color.h level_0/console.h level_0/console-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quoted.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/memory.h level_0/memory_structure.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/status_array.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/type.h level_0/type_array.h level_0/utf.h level_0/utf-common.h level_1/color.h level_1/console.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_macro.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/program.h level_2/status.h
build_sources_script
build_sources_setting
build_script yes
* Provide a set of two colors, a before and an after.
*
* This is intended to be used for printing, such that the printed code is prefixed with the "before" and postfixed with the "after".
+ * These color strings should be NULL terminated.
*
* before: A pointer to the dynamic string representing the before color to assign, set to NULL to disable.
* after: A pointer to the dynamic string representing the after color to assign, set to NULL to disable.
*/
#ifndef _di_f_color_set_t_
typedef struct {
- const f_string_dynamic_t *before;
- const f_string_dynamic_t *after;
+ const f_string_static_t *before;
+ const f_string_static_t *after;
} f_color_set_t;
#define f_color_set_t_initialize { 0, 0 }
*
* Designed for passing this to a function as a single argument.
*
- * parameter: Intended to be populated with an array of f_console_parameter_id_t whose size is defined by the "used" property.
- * This is not intended to be dynamically allocated, so there is no "size" property.
- * order:
+ * parameters: Intended to be populated with an array of f_console_parameter_id_t whose size is defined by the "used" property.
+ * This is not intended to be dynamically allocated, so there is no "size" property.
+ * length: The total number of parameters in the parameters array.
*/
#ifndef _di_f_console_parameters_t_
typedef struct {
#define f_console_parameters_t_initialize { 0, 0 }
- #define f_macro_console_parameters_t_initialize(parameter, used) { parameter, used }
+ #define f_macro_console_parameters_t_initialize(parameters, length) { parameters, length }
#endif // _di_f_console_parameters_t_
/**
*
* Will not stop at NULL.
* Will not print NULL.
+ * Will print the entire dynamic string.
*
- * @param id
- * The file descriptor to output to.
- * @param string
+ * @param output
+ * The file to output to, including standard streams such as stdout and stderr.
+ * @param buffer
* The string to output.
- * @param length
- * The total number of characters to print.
*
* @return
* F_none on success.
*
* @see write()
*/
-#ifndef _di_f_print_dynamic_to_
- extern f_return_status f_print_dynamic_to(const int id, const f_string_t string, const f_string_length_t length);
-#endif // _di_f_print_dynamic_to_
+#ifndef _di_f_print_to_dynamic_
+ extern f_return_status f_print_to_dynamic(const int id, const f_string_static_t buffer);
+#endif // _di_f_print_to_dynamic_
/**
* Similar to a c-library dprintf, except that this will only print a specific range in a given dynamic string.
*
* Will not stop at NULL.
* Will not print NULL.
+ * Will print the only the buffer range specified by range.
*
- * @param id
- * The file descriptor to output to.
- * @param string
+ * @param output
+ * The file to output to, including standard streams such as stdout and stderr.
+ * @param buffer
* The string to output.
- * @param length
- * The total number of characters to print.
+ * @param range
+ * The range within the provided string to print.
*
* @return
* F_none on success.
*
* @see write()
*/
-#ifndef _di_f_print_dynamic_partial_to_
- extern f_return_status f_print_dynamic_partial_to(const int id, const f_string_t string, const f_string_length_t length);
-#endif // _di_f_print_dynamic_partial_to_
+#ifndef _di_f_print_to_dynamic_partial_
+ extern f_return_status f_print_to_dynamic_partial(const int id, const f_string_static_t buffer, const f_string_range_t range);
+#endif // _di_f_print_to_dynamic_partial_
#ifdef __cplusplus
} // extern "C"
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);
+ 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);
return F_none;
}
#endif // _di_fl_color_set_
+#ifndef _di_fl_color_set_to_
+ f_return_status fl_color_set_to(const int id, 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 (id == -1) 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
+ if (!color2 && (color3 != 0 || color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter);
+ if (!color3 && (color4 != 0 || color5 != 0)) return F_status_set_error(F_parameter);
+ if (!color4 && color5 != 0) return F_status_set_error(F_parameter);
+ #endif // _di_level_1_parameter_checking_
+
+ if (!color2) dprintf(id, "%s%s%s", format.begin, color1, format.end);
+ else if (!color3) dprintf(id, "%s%s%s%s%s", format.begin, color1, format.medium, color2, format.end);
+ else if (!color4) dprintf(id, "%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.end);
+ else if (!color5) dprintf(id, "%s%s%s%s%s%s%s%s%s", format.begin, color1, format.medium, color2, format.medium, color3, format.medium, color4, format.end);
+ else dprintf(id, "%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;
+ }
+#endif // _di_fl_color_set_to_
+
#ifndef _di_fl_color_save_
f_return_status fl_color_save(f_string_dynamic_t *buffer, 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_
else if (!color3) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size);
else if (!color4) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size);
else if (!color5) string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size) + strnlen(color4, f_color_max_size);
- else string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size) + strnlen(color4, f_color_max_size) + strnlen(color5, f_color_max_size);
+ else string_size += strnlen(color1, f_color_max_size) + strnlen(color2, f_color_max_size) + strnlen(color3, f_color_max_size) + strnlen(color4, f_color_max_size) + strnlen(color5, f_color_max_size);
// make sure there is enough allocated space, if not, then allocate some more
if (buffer->size - buffer->used - 1 < string_size) {
#endif // _di_level_1_parameter_checking_
if (set.before) {
- f_status_t status = f_print_dynamic(file, *set.before);
- if (F_status_is_error(status)) return status;
+ fprintf(file, "%s", set.before->string);
}
va_list ap;
va_end(ap);
if (set.after) {
- f_status_t status = f_print_dynamic(file, *set.after);
-
- if (F_status_is_error(status)) return status;
+ fprintf(file, "%s", set.after->string);
}
return F_none;
f_status_t status = F_none;
if (set.before) {
- status = f_print_dynamic(file, *set.before);
- if (F_status_is_error(status)) return status;
+ fprintf(file, "%s", set.before->string);
}
if (extra.before) {
- status = f_print_dynamic(file, *extra.before);
- if (F_status_is_error(status)) return status;
+ fprintf(file, "%s", extra.before->string);
}
va_list ap;
va_end(ap);
if (set.after) {
- status = f_print_dynamic(file, *set.after);
- if (F_status_is_error(status)) return status;
+ fprintf(file, "%s", set.after->string);
}
if (extra.after) {
- status = f_print_dynamic(file, *extra.after);
- if (F_status_is_error(status)) return status;
+ fprintf(file, "%s", extra.after->string);
}
return F_none;
}
#endif // _di_fl_color_print2_
-#ifndef _di_fl_color_print_line_
- f_return_status fl_color_print_line(FILE *file, const f_color_set_t set, const f_string_t string, ...) {
+#ifndef _di_fl_color_print_code_
+ f_return_status fl_color_print_code(FILE *file, const f_string_static_t color) {
#ifndef _di_level_1_parameter_checking_
if (!file) return F_status_set_error(F_parameter);
+ #endif // _di_level_1_parameter_checking_
+
+ if (color.used) {
+ fprintf(file, "%s", color.string);
+ }
+
+ return F_none;
+ }
+#endif // _di_fl_color_print_code_
+
+#ifndef _di_fl_color_print_code_to_
+ f_return_status fl_color_print_code_to(const int id, const f_string_static_t color) {
+ #ifndef _di_level_1_parameter_checking_
+ if (id == -1) return F_status_set_error(F_parameter);
+ #endif // _di_level_1_parameter_checking_
+
+ if (color.used) {
+ dprintf(id, "%s", color.string);
+ }
+
+ return F_none;
+ }
+#endif // _di_fl_color_print_code_to_
+
+#ifndef _di_fl_color_print_to_
+ f_return_status fl_color_print_to(const int id, const f_color_set_t set, const f_string_t string, ...) {
+ #ifndef _di_level_1_parameter_checking_
+ if (id == -1) 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) {
- f_status_t status = f_print_dynamic(file, *set.before);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%s", set.before->string);
}
va_list ap;
va_start(ap, string);
- vfprintf(file, string, ap);
+ vdprintf(id, string, ap);
va_end(ap);
if (set.after) {
- f_status_t status = f_print_dynamic(file, *set.after);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%s", set.after->string);
}
- // now print the trailing newline, this is done _after_ ending the colors to avoid color wrapping issues that can happen when a color code follows a newline
- fprintf(file, "%c", f_string_eol[0]);
-
return F_none;
}
-#endif // _di_fl_color_print_line_
+#endif // _di_fl_color_print_to_
-#ifndef _di_fl_color_print2_line_
- f_return_status fl_color_print2_line(FILE *file, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...) {
+#ifndef _di_fl_color_print2_to_
+ f_return_status fl_color_print2_to(const int id, 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 (id == -1) 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) {
- status = f_print_dynamic(file, *set.before);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%s", set.before->string);
}
if (extra.before) {
- status = f_print_dynamic(file, *extra.before);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%s", extra.before->string);
}
va_list ap;
va_start(ap, string);
- vfprintf(file, string, ap);
+ vdprintf(id, string, ap);
va_end(ap);
if (set.after) {
- status = f_print_dynamic(file, *set.after);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%s", set.after->string);
}
if (extra.after) {
- status = f_print_dynamic(file, *extra.after);
- if (F_status_is_error(status)) return status;
- }
-
- // now print the trailing newline, this is done _after_ ending the colors to avoid color wrapping issues that can happen when a color code follows a newline
- fprintf(file, "%c", f_string_eol[0]);
-
- return F_none;
- }
-#endif // _di_fl_color_print2_line_
-
-#ifndef _di_fl_color_print_code_
- f_return_status fl_color_print_code(FILE *file, const f_string_static_t color) {
- if (color.used) {
- f_status_t status = f_print_dynamic(file, color);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%s", extra.after->string);
}
return F_none;
}
-#endif // _di_fl_color_print_code_
+#endif // _di_fl_color_print2_to_
#ifndef _di_fl_color_load_context_
f_return_status fl_color_load_context(f_color_context_t *context, const bool use_light_colors) {
*
* Provide basic color output support (linux & xterm).
* This is the Featureless LINUX Library, so there is no support for non-linux colors at this time.
+ *
+ * For simplicity purposes, all color code strings are assumed to be NULL terminated.
*/
#ifndef _FL_color_h
#define _FL_color_h
#endif // _di_fl_color_set_
/**
+ * Given some file descriptor, and push color information to that descriptor.
+ *
+ * Up to 5 colors may be associted with a single color format block.
+ *
+ * @param id
+ * The file descriptor to print to.
+ * @param format
+ * The color format parts.
+ * @param color1
+ * A color to assign, set to 0 to disable.
+ * @param color2
+ * A color to assign, set to 0 to disable.
+ * @param color3
+ * A color to assign, set to 0 to disable.
+ * @param color4
+ * A color to assign, set to 0 to disable.
+ * @param color5
+ * A color to assign, set to 0 to disable.
+ *
+ * @return
+ * F_none on success.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_fl_color_set_to_
+ extern f_return_status fl_color_set_to(const int id, 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_to_1(id, format, color1) fl_color_set_to(id, format, color1, 0, 0, 0, 0)
+ #define fl_macro_color_set_to_2(id, format, color1, color2) fl_color_set_to(id, format, color1, color2, 0, 0, 0)
+ #define fl_macro_color_set_to_3(id, format, color1, color2, color3) fl_color_set_to(id, format, color1, color2, color3, 0, 0)
+ #define fl_macro_color_set_to_4(id, format, color1, color2, color3, color4) fl_color_set_to(id, format, color1, color2, color3, color4, 0)
+ #define fl_macro_color_set_to_5(id, format, color1, color2, color3, color4, color5) fl_color_set_to(id, format, color1, color2, color3, color4, color5)
+#endif // _di_fl_color_set_to_
+
+/**
* Save color information to some string.
*
* Up to 5 colors may be associted with a single color format block.
#endif // _di_fl_color_print2_
/**
- * Print a string, wrapped in a given start and stop color, then print an EOL character.
+ * Print a single color code to the given file or standard io.
*
- * If the colors strings have nothing used in them, then this will only print the string.
+ * Be sure to forget to print the color reset when done.
*
* @param file
* The file or standard io.
- * @param set
- * The color set used for printing.
- * @param string
- * The string to print to the file or standard io.
- * @param ...
- * Variable arguments, processed in the same way fprintf() processes them.
+ * @param start_color
+ * The color code to print.
*
* @return
* F_none on success.
*
* Errors (with error bit) from: f_print_dynamic().
*/
-#ifndef _di_fl_color_print_line_
- extern f_return_status fl_color_print_line(FILE *file, const f_color_set_t set, const f_string_t string, ...);
-#endif // _di_fl_color_print_line_
+#ifndef _di_fl_color_print_code_
+ extern f_return_status fl_color_print_code(FILE *file, const f_string_static_t color);
+#endif // _di_fl_color_print_code_
/**
- * Print a string, wrapped in a given start, extra, and stop color, then print an EOL character.
+ * Print a single color code to the given file represented by a file descriptor.
*
- * If the colors strings have nothing used in them, then this will only print the string.
+ * Be sure to forget to print the color reset when done.
*
- * It is common for colors to be bolded.
- * This is intended to simplify printing bold colors.
+ * @param id
+ * The file descriptor to print to.
+ * @param start_color
+ * The color code to print.
*
- * @param file
- * The file or standard io.
+ * @return
+ * F_none on success.
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_print_to_dynamic().
+ */
+#ifndef _di_fl_color_print_code_to_
+ extern f_return_status fl_color_print_code_to(const int id, const f_string_static_t color);
+#endif // _di_fl_color_print_code_to_
+
+/**
+ * Print a string, wrapped in a given start and stop color.
+ *
+ * If the colors strings have nothing used in them, then this will only print the string.
+ *
+ * @param id
+ * The file descriptor to print to.
* @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.
* @param ...
*
* Errors (with error bit) from: f_print_dynamic().
*/
-#ifndef _di_fl_color_print2_line_
- extern f_return_status fl_color_print2_line(FILE *file, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...);
-#endif // _di_fl_color_print2_line_
+#ifndef _di_fl_color_print_to_
+ extern f_return_status fl_color_print_to(const int id, const f_color_set_t set, const f_string_t string, ...);
+#endif // _di_fl_color_print_to_
/**
- * Print a single color code to the given file or standard io.
+ * Print a string, wrapped in a given start, extra, and stop color.
*
- * Try not to forget to print the color reset when done.
+ * If the colors strings have nothing used in them, then this will only print the string.
*
- * @param file
- * The file or standard io.
- * @param start_color
- * The color code to print.
+ * It is common for colors to be bolded.
+ * This is intended to simplify printing bold colors.
+ *
+ * @param id
+ * The file descriptor to print to.
+ * @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.
+ * @param ...
+ * Variable arguments, processed in the same way fprintf() processes them.
*
* @return
* F_none on success.
*
* 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);
-#endif // _di_fl_color_print_code_
+#ifndef _di_fl_color_print2_to_
+ extern f_return_status fl_color_print2_to(const int id, const f_color_set_t set, const f_color_set_t extra, const f_string_t string, ...);
+#endif // _di_fl_color_print2_to_
/**
* Load the appropriate colors into the color context.
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 != -1 && recurse.verbose) {
recurse.verbose(recurse.output, source, destination);
}
status = private_fl_directory_copy(static_source, static_destination, mode, recurse, 1);
}
- if (status == F_none && recurse.output && recurse.verbose) {
+ if (status == F_none && recurse.output != -1 && recurse.verbose) {
recurse.verbose(recurse.output, source, destination);
}
status = private_fl_directory_copy(static_source, static_destination, mode, recurse, 1);
}
- if (status == F_none && recurse.output && recurse.verbose) {
+ if (status == F_none && recurse.output != -1 && recurse.verbose) {
recurse.verbose(recurse.output, source, destination);
}
* If TRUE, will fail when file already exists.
* If FALSE, will not fail if file already exists (existing file will be replaced).
* output:
- * Set to 0 to not print on successful operation.
- * Set to a valid file pointer to print to on successful operation.
- * This is passed to the verbose function if that function pointer is not 0.
+ * Set to -1 to not print on successful operation.
+ * Set to a valid file descriptor to print to on successful operation.
+ * This is passed to the verbose function if that function pointer is not -1.
* verbose:
* Set to 0 to not print on successful operation.
* Set to address of a function to be called for printing such that:
f_number_unsigned_t depth_max;
f_number_unsigned_t size_block;
bool exclusive;
- FILE *output;
- void (*verbose)(FILE *, const f_string_t, const f_string_t);
+ int output;
+ void (*verbose)(const int, 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, 0, 0, 0 }
+ #define fl_directory_recurse_t_initialize { fl_directory_recurse_depth_max, f_file_default_read_size, F_false, -1, 0, 0 }
#endif // _di_fl_directory_recurse_t_
/**
if (depth < recurse.depth_max) {
status = private_fl_directory_clone(source_sub, destination_sub, role, recurse, depth + 1);
- if (status == F_none && recurse.output && recurse.verbose) {
+ if (status == F_none && recurse.output != -1 && recurse.verbose) {
recurse.verbose(recurse.output, source_sub.string, destination_sub.string);
}
}
return F_failure;
}
- if (recurse.output && recurse.verbose) {
+ if (recurse.output != -1 && recurse.verbose) {
recurse.verbose(recurse.output, path_source, path_destination);
}
if (depth < recurse.depth_max) {
status = private_fl_directory_copy(source_sub, destination_sub, mode, recurse, depth + 1);
- if (status == F_none && recurse.output && recurse.verbose) {
+ if (status == F_none && recurse.output != -1 && recurse.verbose) {
recurse.verbose(recurse.output, source_sub.string, destination_sub.string);
}
}
return F_failure;
}
- if (recurse.output && recurse.verbose) {
+ if (recurse.output != -1 && recurse.verbose) {
recurse.verbose(recurse.output, path_source, path_destination);
}
* API Version: 0.5
* Licenses: lgplv2.1
*
- * Provides basic string manipulation and processing capabilities.
- *
* These are provided for internal reduction in redundant code.
* These should not be exposed/used outside of this project.
*/
* API Version: 0.5
* Licenses: lgplv2.1
*
- * Provides UTF-8 character manipulation and processing capabilities.
- *
* These are provided for internal reduction in redundant code.
* These should not be exposed/used outside of this project.
*/
extern "C" {
#endif
-#if !defined(fl_utf_file_read) || !defined(fl_utf_file_read_until) || !defined(fl_utf_file_read_range)
+#if !defined(_di_fl_utf_file_read_) || !defined(_di_fl_utf_file_read_until_) || !defined(_di_fl_utf_file_read_range_)
void private_fl_utf_file_process_read_buffer(const char *buffer_read, const ssize_t size_read, f_utf_string_dynamic_t *buffer, char buffer_char[], uint8_t *width, int8_t *width_last) {
f_utf_character_t character = 0;
f_string_length_t i = 0;
}
} // for
}
-#endif // !defined(fl_utf_file_read) || !defined(fl_utf_file_read_until) || !defined(fl_utf_file_read_range)
+#endif // !defined(_di_fl_utf_file_read_) || !defined(_di_fl_utf_file_read_until_) || !defined(_di_fl_utf_file_read_range_)
-#if !defined(fl_utf_file_write) || !defined(fl_utf_file_write_until) || !defined(fl_utf_file_write_range)
+#if !defined(_di_fl_utf_file_write_) || !defined(_di_fl_utf_file_write_until_) || !defined(fl_utf_file_write_range)
f_return_status private_fl_utf_file_write_until(const f_file_t file, const f_utf_string_t string, const f_utf_string_length_t total, f_utf_string_length_t *written) {
*written = 0;
return F_none;
}
-#endif // !defined(fl_utf_file_write) || !defined(fl_utf_file_write_until) || !defined(fl_utf_file_write_range)
+#endif // !defined(_di_fl_utf_file_write_) || !defined(_di_fl_utf_file_write_until_) || !defined(fl_utf_file_write_range)
#ifdef __cplusplus
} // extern "C"
* @see fl_utf_file_read_range()
* @see fl_utf_file_read_until()
*/
-#if !defined(fl_utf_file_read) || !defined(fl_utf_file_read_until) || !defined(fl_utf_file_read_range)
+#if !defined(_di_fl_utf_file_read_) || !defined(_di_fl_utf_file_read_until_) || !defined(_di_fl_utf_file_read_range_)
void private_fl_utf_file_process_read_buffer(const char *buffer_read, const ssize_t size_read, f_utf_string_dynamic_t *buffer, char buffer_char[], uint8_t *width, int8_t *width_last) f_gcc_attribute_visibility_internal;
-#endif // !defined(fl_utf_file_read) || !defined(fl_utf_file_read_until) || !defined(fl_utf_file_read_range)
+#endif // !defined(_di_fl_utf_file_read_) || !defined(_di_fl_utf_file_read_until_) || !defined(_di_fl_utf_file_read_range_)
/**
* Private implementation of fl_utf_file_write_until().
* @see fl_utf_file_write_range()
* @see fl_utf_file_write_until()
*/
-#if !defined(fl_utf_file_write) || !defined(fl_utf_file_write_until) || !defined(fl_utf_file_write_range)
+#if !defined(_di_fl_utf_file_write_) || !defined(_di_fl_utf_file_write_until_) || !defined(_di_fl_utf_file_write_range_)
extern f_return_status private_fl_utf_file_write_until(const f_file_t file, const f_utf_string_t string, const f_utf_string_length_t total, f_utf_string_length_t *written) f_gcc_attribute_visibility_internal;
-#endif // !defined(fl_utf_file_write) || !defined(fl_utf_file_write_until) || !defined(fl_utf_file_write_range)
+#endif // !defined(_di_fl_utf_file_write_) || !defined(_di_fl_utf_file_write_until_) || !defined(_di_fl_utf_file_write_range_)
#ifdef __cplusplus
} // extern "C"
--- /dev/null
+/**
+ * FLL - Level 2
+ *
+ * Project: Error
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * Defines common data to be used for/by project error.
+ *
+ * This is auto-included by error.h and should not need to be explicitly included.
+ */
+#ifndef _FLL_error_common_h
+#define _FLL_error_common_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Error file types.
+ */
+#ifndef _di_fll_error_file_type_
+ enum {
+ fll_error_file_type_file = 1,
+ fll_error_file_type_directory,
+ fll_error_file_type_pipe,
+ };
+
+ #define fll_error_file_type_string_directory "directory"
+ #define fll_error_file_type_string_file "file"
+ #define fll_error_file_type_string_pipe "pipe"
+
+ #define fll_error_file_type_length_directory 9
+ #define fll_error_file_type_length_file 4
+ #define fll_error_file_type_length_pipe 4
+#endif // _di_fll_error_file_type_
+
+/**
+ * Structure for facilitating the error printing.
+ *
+ * to: The file descriptor 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.
+ * notable: The color codes for a part of the message to make more visible.
+ */
+#ifndef _di_fll_error_print_t_
+ #define fll_error_print_error "ERROR: "
+ #define fll_error_print_warning "WARNING: "
+
+ #define fll_error_print_error_length 7
+ #define fll_error_print_warning_length 9
+
+ typedef struct {
+ int to;
+ uint8_t verbosity;
+
+ const char *prefix;
+
+ f_color_set_t context;
+ f_color_set_t notable;
+ } fll_error_print_t;
+
+ #define fll_error_print_t_initialize { \
+ f_type_descriptor_error, \
+ f_console_verbosity_normal, \
+ fll_error_print_error, \
+ f_color_set_t_initialize, \
+ f_color_set_t_initialize, \
+ }
+
+ #define fll_macro_error_print_t_initialize(to, verbosity, prefix, context, notable) { to, verbosity, prefix, context, notable }
+#endif // _di_fll_error_print_t_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _FLL_error_common_h
--- /dev/null
+#include "error.h"
+#include "private-error.h"
+
+#ifdef __cplusplus
+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);
+ }
+#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) {
+ const char *type_name = fll_error_file_type_string_file;
+
+ if (type == fll_error_file_type_directory) {
+ type_name = fll_error_file_type_string_directory;
+ }
+ else if (type == fll_error_file_type_pipe) {
+ type_name = fll_error_file_type_string_pipe;
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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 : "");
+
+ private_fll_error_print_function(print, 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]);
+ }
+
+ 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]);
+ }
+
+ return F_false;
+ }
+
+ 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]);
+ }
+
+ return F_false;
+ }
+ }
+ 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]);
+ }
+
+ 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);
+ }
+
+ return F_false;
+ }
+ }
+
+ return private_fll_error_print(print, 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) {
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ return F_false;
+ }
+
+ return private_fll_error_print(print, status, function, fallback);
+ }
+#endif // _di_fll_error_parameter_integer_print_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 2
+ *
+ * Project: Error
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * Provide functions commonly used by FLL based programs.
+ */
+#ifndef _FLL_error_h
+#define _FLL_error_h
+
+// libc include
+#include <stdio.h>
+
+// fll-0 includes
+#include <level_0/type.h>
+#include <level_0/status.h>
+#include <level_0/memory.h>
+#include <level_0/string.h>
+#include <level_0/utf.h>
+#include <level_0/console.h>
+
+// fll-1 includes
+#include <level_1/color.h>
+#include <level_1/string.h>
+
+// fll-2 error includes
+#include <level_2/error-common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Print generic 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_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);
+#endif // _di_fll_error_print_
+
+/**
+ * Print file 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.
+ * @param name
+ * The name of the file or directory.
+ * @param operation
+ * The operation that fails, such as 'create' or 'access'.
+ * @param type
+ * A valid file type code from the fll_error_file_type enum.
+ *
+ * @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_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);
+#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
+ * 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.
+ * @param parameter
+ * The name of the parameter.
+ * @param argument
+ * The argument associated with the given parameter.
+ *
+ * @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_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);
+#endif // _di_fll_error_parameter_integer_print_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _FLL_error_h
--- /dev/null
+#include "error.h"
+#include "private-error.h"
+
+#ifdef __cplusplus
+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) {
+
+ 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 : "");
+
+ private_fll_error_print_function(print, function);
+
+ dprintf(print.to, ".%s%c", print.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 : "");
+
+ private_fll_error_print_function(print, function);
+
+ dprintf(print.to, ".%s%c", print.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 : "");
+
+ private_fll_error_print_function(print, function);
+
+ dprintf(print.to, ".%s%c", print.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 : "");
+
+ private_fll_error_print_function(print, function);
+
+ dprintf(print.to, ".%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 while 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;
+ }
+
+ 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);
+
+ private_fll_error_print_function(print, function);
+
+ dprintf(print.to, ".%s%c", print.context.after->string, f_string_eol[0]);
+ }
+ }
+
+ return F_true;
+ }
+#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) {
+
+ 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);
+ }
+ }
+#endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 2
+ *
+ * Project: Error
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * These are provided for internal reduction in redundant code.
+ * These should not be exposed/used outside of this project.
+ */
+#ifndef _PRIVATE_FLL_error_h
+#define _PRIVATE_FLL_error_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Private implementation of private_fll_error_print().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @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.
+ *
+ * @see fll_error_print()
+ * @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;
+#endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_)
+
+/**
+ * Special function for printing the "function name".
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param print
+ * Designates how printing is to be performed.
+ * @param function
+ * The name of the function where the error happened.
+ * Set to 0 to disable.
+ *
+ * @return
+ * F_false is returned on successful print of known errors.
+ * F_true is returned if the status code is unknown.
+ *
+ * @see fll_error_print()
+ * @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;
+#endif // !defined(_di_fll_error_print_) || !defined(_di_fll_error_file_print_) || !defined(_di_fll_error_number_print_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_FLL_error_h
--- /dev/null
+# fss-0000
+
--- /dev/null
+# fss-0000
+
+f_type
+f_status
+f_memory
+f_string
+f_utf
+f_console
+fl_color
+fl_string
--- /dev/null
+# fss-0001
+
+project_name fll_error
+
+version_major 0
+version_minor 5
+version_micro 1
+version_target major
+
+environment
+
+process_pre
+process_post
+
+modes individual
+modes_default individual
+
+build_compiler gcc
+build_indexer ar
+build_language c
+build_libraries -lc
+build_libraries-individual -lfl_string -lfl_color -lf_print -lf_file -lf_console -lf_utf -lf_memory
+build_sources_library error.c private-error.c
+build_sources_program
+build_sources_headers error.h error-common.h
+build_sources_script
+build_sources_setting
+build_script yes
+build_shared yes
+build_static yes
+
+path_headers level_2
+path_library_script script
+path_library_shared shared
+path_library_static static
+path_program_script script
+path_program_shared shared
+path_program_static static
+path_sources
+path_standard yes
+
+search_exclusive yes
+search_shared yes
+search_static yes
+
+defines_all
+defines_static
+defines_shared
+
+flags_all -z now -g -fdiagnostics-color=always
+flags_shared
+flags_static
+flags_library -fPIC
+flags_program -fPIE
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) {
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(file, context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print(file, context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fprintf(file, "%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_line(file, context.set.error, "' is no longer open.");
+ fl_color_print(file, context.set.error, "' is no longer open.");
+ fprintf(file, "%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_line(file, context.set.error, "'.");
+ fl_color_print(file, context.set.error, "'.");
+ fprintf(file, "%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_line(file, context.set.error, "'.");
+ fl_color_print(file, context.set.error, "'.");
+ fprintf(file, "%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_line(file, context.set.error, "'.");
+ fl_color_print(file, context.set.error, "'.");
+ fprintf(file, "%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_line(file, context.set.error, "'.");
+ fl_color_print(file, context.set.error, "'.");
+ fprintf(file, "%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_line(file, context.set.error, "'.");
+ fl_color_print(file, context.set.error, "'.");
+ fprintf(file, "%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_line(file, context.set.error, ".");
+ fl_color_print(file, context.set.error, ".");
+ fprintf(file, "%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_line(file, context.set.error, "'.");
+ fl_color_print(file, context.set.error, "'.");
+ fprintf(file, "%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_line(file, context.set.error, "'.");
+ fl_color_print(file, context.set.error, "'.");
+ fprintf(file, "%c", f_string_eol[0]);
}
else {
return F_false;
{
f_string_length_t seeked = 0;
+
if (F_status_is_error(f_file_seek(file->id, SEEK_SET, 0, &seeked))) {
return F_status_set_error(F_file_seek);
}
#endif
#ifndef _di_fll_program_print_help_header_
- f_return_status fll_program_print_help_header(const f_color_context_t context, const f_string_t name, const f_string_t version) {
- f_status_t status = F_none;
+ 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) {
- printf("%c", f_string_eol[0]);
- status = fl_color_print(f_type_output, context.set.title, " %s", name);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%c", f_string_eol[0]);
+ fl_color_print_to(id, context.set.title, " %s", name);
- printf("%c", f_string_eol[0]);
- status = fl_color_print(f_type_output, context.set.notable, " Version %s", version);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%c", f_string_eol[0]);
+ fl_color_print_to(id, context.set.notable, " Version %s", version);
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
- status = fl_color_print(f_type_output, context.set.important, " Available Options: ");
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
+ fl_color_print_to(id, 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 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_status_t status = F_none;
+ 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) {
- printf("%c", f_string_eol[0]);
- printf(" %s", symbol_short);
- status = fl_color_print(f_type_output, context.set.standout, option_short);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%c %s", f_string_eol[0], symbol_short);
+ fl_color_print_to(id, context.set.standout, option_short);
- printf(", %s", symbol_long);
- status = fl_color_print(f_type_output, context.set.standout, option_long);
- if (F_status_is_error(status)) return status;
+ dprintf(id, ", %s", symbol_long);
+ fl_color_print_to(id, context.set.standout, option_long);
- printf(" %s", description);
+ dprintf(id, " %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 f_color_context_t context, const f_string_t option_long, const f_string_t symbol_long, const f_string_t description) {
- f_status_t status = F_none;
+ 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) {
- printf("%c", f_string_eol[0]);
- printf(" %s", symbol_long);
- status = fl_color_print(f_type_output, context.set.standout, option_long);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%c %s", f_string_eol[0], symbol_long);
+ fl_color_print_to(id, context.set.standout, option_long);
- printf(" %s", description);
+ dprintf(id, " %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 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 int id, const f_color_context_t context, const f_string_t option_other, const f_string_t description) {
- printf("%c ", f_string_eol[0]);
- fl_color_print(f_type_output, context.set.standout, option_other);
+ dprintf(id, "%c ", f_string_eol[0]);
+ fl_color_print_to(id, context.set.standout, option_other);
- printf(" %s", description);
+ dprintf(id, " %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 f_color_context_t context, const f_string_t name, const f_string_t parameters) {
- f_status_t status = F_none;
+ 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) {
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
- status = fl_color_print(f_type_output, context.set.important, " Usage:");
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
+ fl_color_print_to(id, context.set.important, " Usage:");
- printf("%c ", f_string_eol[0]);
- status = fl_color_print(f_type_output, context.set.standout, name);
- if (F_status_is_error(status)) return status;
+ dprintf(id, "%c ", f_string_eol[0]);
+ fl_color_print_to(id, context.set.standout, name);
- printf(" ");
- status = fl_color_print(f_type_output, context.set.notable, "[");
- if (F_status_is_error(status)) return status;
+ dprintf(id, " ");
+ fl_color_print_to(id, context.set.notable, "[");
- printf(" options ");
- status = fl_color_print(f_type_output, context.set.notable, "]");
- if (F_status_is_error(status)) return status;
+ dprintf(id, " options ");
+ fl_color_print_to(id, context.set.notable, "]");
if (parameters[0] != '\0') {
- printf(" ");
- status = fl_color_print(f_type_output, context.set.notable, "[");
- if (F_status_is_error(status)) return status;
+ dprintf(id, " ");
+ fl_color_print_to(id, context.set.notable, "[");
- printf(" %s ", parameters);
- status = fl_color_print(f_type_output, context.set.notable, "]");
- if (F_status_is_error(status)) return status;
+ dprintf(id, " %s ", parameters);
+ fl_color_print_to(id, context.set.notable, "]");
}
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
+ dprintf(id, "%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 f_string_t version) {
- printf("%s%c", version, f_string_eol[0]);
+ f_return_status fll_program_print_version(const int id, const f_string_t version) {
+
+ dprintf(id, "%s%c", version, f_string_eol[0]);
return F_none;
}
f_status_t status = F_none;
status = f_console_parameter_process(arguments, parameters, remaining);
-
- if (F_status_is_error(status)) {
- status = F_status_set_fine(status);
-
- if (status == F_data_not) {
- fl_color_print_line(f_type_error, context->set.error, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
- // @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
- }
- else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(f_type_error, context->set.error, "CRITICAL ERROR: Unable to allocate memory while calling ");
- fl_color_print(f_type_error, context->set.notable, "f_console_parameter_process");
- fl_color_print_line(f_type_error, context->set.error, ").");
- }
- else if (status == F_utf) {
- fl_color_print(f_type_error, context->set.error, "ENCODING ERROR: Invalid UTF-8 character in parameter when calling ");
- fl_color_print(f_type_error, context->set.notable, "f_console_parameter_process()");
- fl_color_print_line(f_type_error, context->set.error, ".");
- }
- else if (status == F_parameter) {
- fl_color_print(f_type_error, context->set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context->set.notable, "f_console_parameter_process()");
- fl_color_print_line(f_type_error, context->set.error, ".");
- }
- else {
- fl_color_print(f_type_error, context->set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context->set.notable, "%u", status);
- fl_color_print(f_type_error, context->set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context->set.notable, "f_console_parameter_process()");
- fl_color_print_line(f_type_error, context->set.error, ".");
- }
-
- return F_status_set_error(status);
- }
+ if (F_status_is_error(status)) return status;
f_console_parameter_id_t decision = choices.id[2];
- f_string_t function;
-
if (right) {
- function = "f_console_parameter_prioritize_right";
status = f_console_parameter_prioritize_right(parameters, choices, &decision);
}
else {
- function = "f_console_parameter_prioritize_left";
status = f_console_parameter_prioritize_left(parameters, choices, &decision);
}
- if (F_status_is_error(status)) {
- status = F_status_set_fine(status);
-
- if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(f_type_error, context->set.error, "CRITICAL ERROR: Unable to allocate memory while calling ");
- fl_color_print(f_type_error, context->set.notable, "%s", function);
- fl_color_print_line(f_type_error, context->set.error, ").");
- }
- else if (status == F_parameter) {
- fl_color_print(f_type_error, context->set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context->set.notable, "%s", function);
- fl_color_print_line(f_type_error, context->set.error, "().");
- }
- else {
- fl_color_print(f_type_error, context->set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context->set.notable, "%u", status);
- fl_color_print(f_type_error, context->set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context->set.notable, "%s", function);
- fl_color_print_line(f_type_error, context->set.error, "().");
- }
-
- return F_status_set_error(status);
- }
+ if (F_status_is_error(status)) return status;
// load colors unless told not to.
if (decision != choices.id[0]) {
f_status_t allocation_status = F_none;
f_macro_color_context_t_new(allocation_status, (*context));
-
- if (F_status_is_error(allocation_status)) {
- fl_color_print(f_type_error, context->set.error, "CRITICAL ERROR: Unable to allocate memory while calling ");
- fl_color_print(f_type_error, context->set.notable, "f_macro_color_context_t_new");
- fl_color_print_line(f_type_error, context->set.error, "().");
-
- return allocation_status;
- }
+ if (F_status_is_error(status)) return status;
status = fl_color_load_context(context, decision == choices.id[1]);
}
}
#endif // _di_fll_program_parameter_process_
-#ifndef _di_fll_program_parameter_process_quietly_
- f_return_status fll_program_parameter_process_quietly(const f_console_arguments_t arguments, f_console_parameters_t parameters, const f_console_parameter_ids_t choices, const bool right, f_string_lengths_t *remaining, f_color_context_t *context) {
- f_status_t status = F_none;
-
- status = f_console_parameter_process(arguments, parameters, remaining);
- if (F_status_is_error(status)) return status;
-
- f_console_parameter_id_t decision = choices.id[2];
-
- if (right) {
- status = f_console_parameter_prioritize_right(parameters, choices, &decision);
- }
- else {
- status = f_console_parameter_prioritize_left(parameters, choices, &decision);
- }
-
- if (F_status_is_error(status)) return status;
-
- // load colors unless told not to.
- if (decision != choices.id[0]) {
- f_status_t allocation_status = F_none;
-
- f_macro_color_context_t_new(allocation_status, (*context));
-
- if (F_status_is_error(allocation_status)) return allocation_status;
-
- status = fl_color_load_context(context, decision == choices.id[1]);
- }
-
- return status;
- }
-#endif // _di_fll_program_parameter_process_quietly_
-
#ifndef _di_fll_program_parameter_additional_append_
f_return_status fll_program_parameter_additional_append(const f_string_t *argv, const f_string_lengths_t additional, f_string_dynamics_t *destination) {
#ifndef _di_level_2_parameter_checking_
*
* Provide functions commonly used by FLL based programs.
*/
-#ifndef _FL_program_h
-#define _FL_program_h
+#ifndef _FLL_program_h
+#define _FLL_program_h
// libc include
#include <stdio.h>
/**
* Print standard help header.
*
+ * @param id
+ * The file descriptor to output to.
* @param context
* The color context.
* @param name
* @param fl_color_print()
*/
#ifndef _di_fll_program_print_help_header_
- extern f_return_status fll_program_print_help_header(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 int id, 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 context
* The color context.
* @param option_short
* @param fl_color_print()
*/
#ifndef _di_fll_program_print_help_option_
- extern f_return_status fll_program_print_help_option(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 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);
#endif // _di_fll_program_print_help_option_
/**
* Print standard help option (long option only).
*
+ * @param id
+ * The file descriptor to output to.
* @param context
* The color context.
* @param option_long
* @param fl_color_print()
*/
#ifndef _di_fll_program_print_help_option_long_
- extern f_return_status fll_program_print_help_option_long(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 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);
#endif // _di_fll_program_print_help_option_long_
/**
* Print standard help option (other option only).
*
+ * @param id
+ * The file descriptor to output to.
* @param context
* The color context.
* @param option_other
* @param fl_color_print()
*/
#ifndef _di_fll_program_print_help_option_other_
- extern f_return_status fll_program_print_help_option_other(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 int id, 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 context
* The color context.
* @param name
* @param fl_color_print()
*/
#ifndef _di_fll_program_print_help_usage_
- extern f_return_status fll_program_print_help_usage(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 int id, 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 version
* The version number of the program.
*
* F_none on success.
*/
#ifndef _di_fll_program_print_version_
- extern f_return_status fll_program_print_version(const f_string_t version);
+ extern f_return_status fll_program_print_version(const int id, const f_string_t version);
#endif // _di_fll_program_print_version_
/**
- * Perform basic parameter loading, including initialization of color context and printing errors.
+ * Perform basic parameter loading, including initialization of color context.
*
* @param arguments
* The parameters passed to the process.
#ifndef _di_fll_program_parameter_process_
extern f_return_status fll_program_parameter_process(const f_console_arguments_t arguments, f_console_parameters_t parameters, const f_console_parameter_ids_t choices, const bool right, f_string_lengths_t *remaining, f_color_context_t *context);
#endif // _di_fll_program_parameter_process_
-/**
- * Perform basic parameter loading, including initialization of color context but does not print errors.
- *
- * @param arguments
- * The parameters passed to the process.
- * @param parameters
- * The console parameters to look for.
- * @param choices
- * A set of the color options: no-color option, light-color option, dark-color option.
- * This must have its used size set to 3 and the ids are expected to be in this order: no_color, light, and dark.
- * @param right
- * Set to TRUE for right priortization and FALSE for left prioritization.
- * @param remaining
- * A list of remaining parameters not associated with anything.
- * @param context
- * The color context.
- *
- * @return
- * F_none on success.
- * F_data_not if "additional" parameters were expected but not found.
- * F_memory_reallocation (with error bit) on memory reallocation error.
- * F_parameter (with error bit) if a parameter is invalid.
- *
- * Errors (with error bit) from: f_console_parameter_prioritize_left().
- * Errors (with error bit) from: f_console_parameter_prioritize_right().
- * Errors (with error bit) from: f_console_parameter_process().
- * Errors (with error bit) from: fl_color_load_context().
- *
- * @see f_console_parameter_prioritize_left()
- * @see f_console_parameter_prioritize_right()
- * @see f_console_parameter_process()
- * @see fl_color_load_context()
- */
-#ifndef _di_fll_program_parameter_process_quietly_
- extern f_return_status fll_program_parameter_process_quietly(const f_console_arguments_t arguments, f_console_parameters_t parameters, const f_console_parameter_ids_t choices, const bool right, f_string_lengths_t *remaining, f_color_context_t *context);
-#endif // _di_fll_program_parameter_process_quietly_
/**
* Allocate new strings from all of the provided locations.
} // extern "C"
#endif
-#endif // _FL_program_h
+#endif // _FLL_program_h
#endif
#ifndef _di_byte_dump_print_help_
- f_return_status byte_dump_print_help(const f_color_context_t context) {
+ f_return_status byte_dump_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, byte_dump_name_long, byte_dump_version);
+ fll_program_print_help_header(id, context, byte_dump_name_long, byte_dump_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
- printf("%c", f_string_eol[0]);
+ dprintf(id, "%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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.");
- printf("%c", f_string_eol[0]);
+ dprintf(id, "%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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.");
- printf("%c", f_string_eol[0]);
+ dprintf(id, "%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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.");
- printf("%c", f_string_eol[0]);
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
- fll_program_print_help_option_long(context, byte_dump_long_normal, f_console_symbol_long_enable, " Display UTF-8 symbols for ASCII control codes.");
- fll_program_print_help_option_long(context, byte_dump_long_simple, f_console_symbol_long_enable, " Display spaces for ASCII control codes.");
- fll_program_print_help_option_long(context, byte_dump_long_classic, f_console_symbol_long_enable, " Display periods for ASCII control codes.");
+ fl_color_print_to(id, context.set.important, " Special Options: ");
- fll_program_print_help_usage(context, byte_dump_name, "filename(s)");
+ 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.");
- printf(" When using the ");
- fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_text);
- printf(" option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.");
+ fll_program_print_help_usage(id, context, byte_dump_name, "filename(s)");
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
+ 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.");
- printf(" Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the ");
- fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_placeholder);
- printf(" option is used).");
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
- printf("%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).");
- printf(" 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]);
- printf("%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.");
- printf(" When ");
- fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last);
- printf(" 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]);
- printf("%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.");
+
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
return F_none;
}
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);
+
byte_dump_delete_data(data);
return F_status_set_error(status);
}
-
- status = F_none;
}
// Identify priority of verbosity related parameters.
}
if (choice == byte_dump_parameter_verbosity_quiet) {
- data->verbosity = f_console_verbosity_quiet;
+ data->error.verbosity = f_console_verbosity_quiet;
}
else if (choice == byte_dump_parameter_verbosity_normal) {
- data->verbosity = f_console_verbosity_normal;
+ data->error.verbosity = f_console_verbosity_normal;
}
else if (choice == byte_dump_parameter_verbosity_verbose) {
- data->verbosity = f_console_verbosity_verbose;
+ data->error.verbosity = f_console_verbosity_verbose;
}
else if (choice == byte_dump_parameter_verbosity_debug) {
- data->verbosity = f_console_verbosity_debug;
+ data->error.verbosity = f_console_verbosity_debug;
}
}
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);
}
}
if (data->parameters[byte_dump_parameter_help].result == f_console_result_found) {
- byte_dump_print_help(data->context);
+ byte_dump_print_help(data->output, data->context);
byte_dump_delete_data(data);
return F_none;
}
if (data->parameters[byte_dump_parameter_version].result == f_console_result_found) {
- fll_program_print_version(byte_dump_version);
+ fll_program_print_version(data->output, byte_dump_version);
byte_dump_delete_data(data);
return F_none;
if (data->remaining.used > 0 || data->process_pipe) {
if (data->parameters[byte_dump_parameter_width].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width);
- fl_color_print_line(f_type_error, data->context.set.error, "' was specified, but no value was given.");
+ 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]);
byte_dump_delete_data(data);
return F_status_set_error(status);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width);
- fl_color_print(f_type_error, data->context.set.error, "' value can only be a number between ");
- fl_color_print(f_type_error, data->context.set.notable, "0");
- fl_color_print(f_type_error, data->context.set.error, " and ");
- fl_color_print(f_type_error, data->context.set.notable, "251");
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
byte_dump_delete_data(data);
return F_status_set_error(status);
}
if (data->parameters[byte_dump_parameter_first].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first);
- fl_color_print_line(f_type_error, data->context.set.error, "' was specified, but no value was given.");
+ 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]);
byte_dump_delete_data(data);
return F_status_set_error(status);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first);
- fl_color_print(f_type_error, data->context.set.error, "' value can only be a number (inclusively) between ");
- fl_color_print(f_type_error, data->context.set.notable, "0");
- fl_color_print(f_type_error, data->context.set.error, " and ");
- fl_color_print(f_type_error, data->context.set.notable, "%llu", f_number_t_size_unsigned);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
byte_dump_delete_data(data);
return F_status_set_error(status);
}
if (data->parameters[byte_dump_parameter_last].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last);
- fl_color_print_line(f_type_error, data->context.set.error, "' was specified, but no value was given.");
+ 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]);
byte_dump_delete_data(data);
return F_status_set_error(status);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last);
- fl_color_print(f_type_error, data->context.set.error, "' value can only be a number (inclusively) between ");
- fl_color_print(f_type_error, data->context.set.notable, "0");
- fl_color_print(f_type_error, data->context.set.error, " and ");
- fl_color_print(f_type_error, data->context.set.notable, "%llu", f_number_t_size_unsigned);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
byte_dump_delete_data(data);
return F_status_set_error(status);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first);
- fl_color_print(f_type_error, data->context.set.error, "' value cannot be greater than the parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last);
- fl_color_print_line(f_type_error, data->context.set.error, "' value.");
+ 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]);
byte_dump_delete_data(data);
return F_status_set_error(status);
file.id = f_type_descriptor_input;
printf("%c", f_string_eol[0]);
- fl_color_print(f_type_output, data->context.set.title, "Piped Byte Dump: (in ");
+ fl_color_print_to(data->output, data->context.set.title, "Piped Byte Dump: (in ");
if (data->mode == byte_dump_mode_hexidecimal) {
- fl_color_print(f_type_output, data->context.set.title, "Hexidecimal");
+ fl_color_print_to(data->output, data->context.set.title, "Hexidecimal");
}
else if (data->mode == byte_dump_mode_duodecimal) {
- fl_color_print(f_type_output, data->context.set.title, "Duodecimal");
+ fl_color_print_to(data->output, data->context.set.title, "Duodecimal");
}
else if (data->mode == byte_dump_mode_octal) {
- fl_color_print(f_type_output, data->context.set.title, "Octal");
+ fl_color_print_to(data->output, data->context.set.title, "Octal");
}
else if (data->mode == byte_dump_mode_binary) {
- fl_color_print(f_type_output, data->context.set.title, "Binary");
+ fl_color_print_to(data->output, data->context.set.title, "Binary");
}
else if (data->mode == byte_dump_mode_decimal) {
- fl_color_print(f_type_output, data->context.set.title, "Decimal");
+ fl_color_print_to(data->output, data->context.set.title, "Decimal");
}
- fl_color_print_line(f_type_output, data->context.set.title, ")");
+ fl_color_print_to(data->output, data->context.set.title, ")%c", f_string_eol[0]);
status = byte_dump_file(*data, "-", file);
missing_files = status;
}
- byte_dump_print_file_error(data->context, "f_file_exists", arguments.argv[data->remaining.array[counter]], F_status_set_fine(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);
}
} // for
status = f_file_open(arguments.argv[data->remaining.array[counter]], 0, &file);
if (F_status_is_error(status)) {
- byte_dump_print_file_error(data->context, "f_file_open", arguments.argv[data->remaining.array[counter]], F_status_set_fine(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);
+
byte_dump_delete_data(data);
return status;
}
printf("%c", f_string_eol[0]);
- fl_color_print(f_type_output, data->context.set.title, "Byte Dump of: ");
- fl_color_print(f_type_output, data->context.set.notable, "%s", arguments.argv[data->remaining.array[counter]]);
- fl_color_print(f_type_output, data->context.set.title, " (in ");
+ 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 ");
if (data->mode == byte_dump_mode_hexidecimal) {
- fl_color_print(f_type_output, data->context.set.title, "Hexidecimal");
+ fl_color_print_to(data->output, data->context.set.title, "Hexidecimal");
}
else if (data->mode == byte_dump_mode_duodecimal) {
- fl_color_print(f_type_output, data->context.set.title, "Duodecimal");
+ fl_color_print_to(data->output, data->context.set.title, "Duodecimal");
}
else if (data->mode == byte_dump_mode_octal) {
- fl_color_print(f_type_output, data->context.set.title, "Octal");
+ fl_color_print_to(data->output, data->context.set.title, "Octal");
}
else if (data->mode == byte_dump_mode_binary) {
- fl_color_print(f_type_output, data->context.set.title, "Binary");
+ fl_color_print_to(data->output, data->context.set.title, "Binary");
}
else if (data->mode == byte_dump_mode_decimal) {
- fl_color_print(f_type_output, data->context.set.title, "Decimal");
+ fl_color_print_to(data->output, data->context.set.title, "Decimal");
}
- fl_color_print_line(f_type_output, data->context.set.title, ")");
+ fl_color_print_to(data->output, data->context.set.title, ")%c", f_string_eol[0]);
status = byte_dump_file(*data, arguments.argv[data->remaining.array[counter]], file);
}
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify one or more filenames.");
+ 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]);
status = F_status_set_error(F_parameter);
}
#include <level_1/utf.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/program.h>
#ifdef __cplusplus
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
uint64_t first;
uint64_t last;
- uint8_t width;
- uint8_t mode;
- uint8_t presentation;
+ uint8_t width;
+ uint8_t mode;
+ uint8_t presentation;
f_color_context_t context;
} byte_dump_data_t;
byte_dump_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
0, \
0, \
8, \
/**
* Print help to standard output.
*
+ * @param id
+ * The file descriptor to print to.
* @param context
* The color context settings.
*
* F_none on success.
*/
#ifndef _di_byte_dump_print_help_
- extern f_return_status byte_dump_print_help(const f_color_context_t context);
+ extern f_return_status byte_dump_print_help(const int id, const f_color_context_t context);
#endif // _di_byte_dump_print_help_
/**
fflush(f_type_output);
if (found_invalid_utf) {
- fl_color_print(f_type_error, data.context.set.error, "Invalid UTF-8 codes were detected for file '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
}
if (size < 0) {
// @todo: determine what the error from read() is and display it.
- fl_color_print(f_type_error, data.context.set.error, "ERROR: read() failed for '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
status = F_status_set_error(F_failure);
}
}
#endif // _di_byte_dump_file_
-#ifndef _di_byte_dump_print_file_error_
- void byte_dump_print_file_error(const f_color_context_t context, const f_string_t function, const f_string_t file_name, const f_status_t status) {
-
- if (status == F_false) {
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to find file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- if (status == F_parameter) {
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ", function, file_name);
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print(f_type_error, context.set.error, "() for the file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- if (status == F_name) {
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid filename '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- if (status == F_memory_out) {
- fl_color_print(f_type_error, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to access file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- if (status == F_number_overflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: Overflow while trying to access file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- if (status == F_directory) {
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid directory while trying to access file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- if (status == F_access_denied) {
- fl_color_print(f_type_error, context.set.error, "ERROR: Access denied while trying to access file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- if (status == F_loop) {
- fl_color_print(f_type_error, context.set.error, "ERROR: Loop while trying to access file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- return;
- }
-
- fl_color_print(f_type_error, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") occurred for file '");
- fl_color_print(f_type_error, context.set.notable, "%s", file_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
- }
-#endif // _di_byte_dump_print_file_error_
-
#ifdef __cplusplus
} // extern "C"
#endif
extern void byte_dump_print_text(const byte_dump_data_t data, const f_utf_string_static_t characters, const uint8_t invalid[], byte_dump_previous_t *previous, uint8_t *offset) f_gcc_attribute_visibility_internal;
#endif // _di_byte_dump_print_text_
-/**
- * Print error messages related to a file.
- *
- * @param context
- * The color context codes.
- * @param status
- * The status code.
- * @param function
- * The name of the function that failed.
- * @param file_name
- * The name of the file related to the error.
- * @param status
- * The status code representing the error.
- *
- * @param
- * F_true if error has been printed.
- * F_false if error has not been printed.
- */
-#ifndef _di_byte_dump_print_file_error_
- extern void byte_dump_print_file_error(const f_color_context_t context, const f_string_t function, const f_string_t file_name, const f_status_t status) f_gcc_attribute_visibility_internal;
-#endif // _di_byte_dump_print_file_error_
-
#ifdef __cplusplus
} // extern "C"
#endif
fl_conversion
fl_string
fl_utf
+fll_error
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfl_utf -lfl_string -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_error -lfl_utf -lfl_string -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library byte_dump.c private-byte_dump.c
#endif
#ifndef _di_fake_print_help_
- f_return_status fake_print_help(const f_color_context_t context) {
+ f_return_status fake_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fake_name_long, fake_version);
+ fll_program_print_help_header(id, context, fake_name_long, fake_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
- printf("%c", f_string_eol[0]);
+ dprintf(id, "%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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.");
- printf("%c", f_string_eol[0]);
+ dprintf(id, "%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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.");
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
- fl_color_print(f_type_output, context.set.important, " Special Options: ");
+ fl_color_print_to(id, context.set.important, " Special Options: ");
- fll_program_print_help_option_long(context, fake_long_documents_disabled, f_console_symbol_long_enable, " Forcibly do not build documents files.");
- fll_program_print_help_option_long(context, fake_long_documents_enabled, f_console_symbol_long_enable, " Forcibly do build documents files.");
- fll_program_print_help_option_long(context, fake_long_shared_disabled, f_console_symbol_long_enable, "Forcibly do not build shared files.");
- fll_program_print_help_option_long(context, fake_long_shared_enabled, f_console_symbol_long_enable, " Forcibly do build shared files.");
- fll_program_print_help_option_long(context, fake_long_static_disabled, f_console_symbol_long_enable, "Forcibly do not build static files.");
- fll_program_print_help_option_long(context, fake_long_static_enabled, f_console_symbol_long_enable, " Forcibly do build static files.");
+ 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.");
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
- fl_color_print(f_type_output, context.set.important, " Operations: ");
+ fl_color_print_to(id, context.set.important, " Operations: ");
- fll_program_print_help_option_other(context, fake_other_operation_build, " Build or compile the code based on build settings file.");
- fll_program_print_help_option_other(context, fake_other_operation_clean, " Delete all build files.");
- fll_program_print_help_option_other(context, fake_other_operation_make, " Build or compile the code based on fakefile.");
- fll_program_print_help_option_other(context, fake_other_operation_skeleton, "Build a skeleton directory structure.");
+ 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_usage(context, fake_name, "operation");
+ fll_program_print_help_usage(id, context, fake_name, "operation");
- printf(" When performing the ");
- fl_color_print(f_type_output, context.set.notable, "%s", fake_other_operation_build);
- printf(" operation, the ");
- fl_color_print(f_type_output, context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode);
- printf(" parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global.");
- printf("%c", f_string_eol[0]);
+ 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]);
- printf(" For example, when a ");
- fl_color_print(f_type_output, context.set.notable, "%s", fake_long_mode);
- printf(" 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, " 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').");
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
- printf(" When specifying the ");
- fl_color_print(f_type_output, context.set.notable, "%s", fake_long_fakefile);
- printf(" or the ");
- fl_color_print(f_type_output, context.set.notable, "%s", fake_long_settings);
- printf(" parameters, the filenames are relative to the data build directory, unless a path is used.");
- printf("%c", 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]);
- printf(" For example, with '");
- fl_color_print(f_type_output, context.set.notable, "%s%s my_fakefile", f_console_symbol_long_enable, fake_long_fakefile);
- printf("' the fakefile at '");
- fl_color_print(f_type_output, context.set.notable, "./%s%smy_fakefile", fake_default_path_data, fake_default_path_build);
- printf(" would be used, however with '");
- fl_color_print(f_type_output, context.set.notable, "%s%s ./my_fakefile", f_console_symbol_long_enable, fake_long_fakefile);
- printf("' the fakefile at '");
- fl_color_print(f_type_output, context.set.notable, "./my_fakefile", fake_default_path_data, fake_default_path_build);
- printf(" would be used.");
+ 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.");
- printf("%c%c", f_string_eol[0], f_string_eol[0]);
+ dprintf(id, "%c%c", f_string_eol[0], f_string_eol[0]);
return F_none;
}
// Identify priority of verbosity related parameters.
{
- f_console_parameter_id_t ids[4] = { fake_parameter_quiet, fake_parameter_normal, fake_parameter_verbose, fake_parameter_debug };
+ f_console_parameter_id_t ids[4] = { fake_parameter_verbosity_quiet, fake_parameter_verbosity_normal, fake_parameter_verbosity_verbose, fake_parameter_verbosity_debug };
f_console_parameter_id_t choice = 0;
const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
return status;
}
- if (choice == fake_parameter_quiet) {
- data->verbosity = f_console_verbosity_quiet;
+ if (choice == fake_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
}
- else if (choice == fake_parameter_normal) {
- data->verbosity = f_console_verbosity_normal;
+ else if (choice == fake_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
}
- else if (choice == fake_parameter_verbose) {
- data->verbosity = f_console_verbosity_verbose;
+ else if (choice == fake_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
}
- else if (choice == fake_parameter_debug) {
- data->verbosity = f_console_verbosity_debug;
+ else if (choice == fake_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
}
}
status = F_none;
if (data->parameters[fake_parameter_help].result == f_console_result_found) {
- fake_print_help(data->context);
+ fake_print_help(data->output, data->context);
fake_delete_data(data);
return F_none;
}
if (data->parameters[fake_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fake_version);
+ fll_program_print_version(data->output, fake_version);
fake_delete_data(data);
return F_none;
break;
}
else if (F_status_is_error(status)) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The operation '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", operations_name);
- fl_color_print_line(f_type_error, data->context.set.error, "' failed.");
+ 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]);
}
break;
} // for
// ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (data->verbosity != f_console_verbosity_quiet) {
+ if (data->error.verbosity != f_console_verbosity_quiet) {
if (F_status_is_error(status) || status == F_signal) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data->error.to, "%c", f_string_eol[0]);
}
else {
- fprintf(f_type_output, "%cAll operations complete.%c%c", f_string_eol[0], f_string_eol[0], f_string_eol[0]);
+ dprintf(data->output, "%cAll operations complete.%c%c", f_string_eol[0], f_string_eol[0], f_string_eol[0]);
}
}
}
else {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify an operation.");
- fprintf(f_type_error, "%c", f_string_eol[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: You failed to specify an operation.%c", f_string_eol[0]);
+ dprintf(data->error.to, "%c", f_string_eol[0]);
}
status = F_status_set_error(F_parameter);
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/execute.h>
#include <level_2/file.h>
#include <level_2/fss.h>
fake_parameter_help,
fake_parameter_light,
fake_parameter_dark,
- fake_parameter_debug,
fake_parameter_no_color,
- fake_parameter_normal,
- fake_parameter_quiet,
- fake_parameter_verbose,
+ fake_parameter_verbosity_quiet,
+ fake_parameter_verbosity_normal,
+ fake_parameter_verbosity_verbose,
+ fake_parameter_verbosity_debug,
fake_parameter_version,
fake_parameter_define,
f_console_parameter_t_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, 0, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(fake_short_define, fake_long_define, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(fake_short_fakefile, fake_long_fakefile, 0, 1, f_console_type_normal), \
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
+
uint8_t operation;
mode_t umask;
fake_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
0, \
0, \
f_signal_t_initialize, \
* F_none on success.
*/
#ifndef _di_fake_print_help_
- extern f_return_status fake_print_help(const f_color_context_t context);
+ extern f_return_status fake_print_help(const int id, const f_color_context_t context);
#endif // _di_fake_print_help_
/**
f_string_dynamic_t path_source = f_string_dynamic_t_initialize;
f_string_dynamic_t destination_file = f_string_dynamic_t_initialize;
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Copying %s.", label);
+ fl_color_print(f_type_output, data.context.set.important, "Copying %s.%c", label, f_string_eol[0]);
}
f_macro_string_dynamic_t_new(*status, path_source, source.used);
fl_directory_recurse_t recurse = fl_directory_recurse_t_initialize;
- if (data.verbosity == f_console_verbosity_verbose) {
- recurse.output = f_type_output;
+ if (data.error.verbosity == f_console_verbosity_verbose) {
+ recurse.output = f_type_descriptor_output;
recurse.verbose = fake_verbose_print_copy;
}
*status = fl_directory_copy_content(path_source.string, destination.string, path_source.used, destination.used, mode, recurse);
if (F_status_is_error(*status)) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
for (f_string_length_t j = 0; j < failures.used; j++) {
fake_print_error_build_operation_file(data, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true);
} // for
break;
}
- else if (data.verbosity != f_console_verbosity_quiet) {
+ else if (data.error.verbosity != f_console_verbosity_quiet) {
fake_print_error_build_operation_file(data, F_status_set_fine(*status), "fl_directory_copy_content", "copy contents of", "to", path_source.string, destination.string, F_true);
}
break;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
}
&path_headers,
};
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Creating base build directories.");
+ fl_color_print(f_type_output, data.context.set.important, "Creating base build directories.%c", f_string_eol[0]);
}
for (uint8_t i = 0; i < 15; i++) {
return;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Created directory '%s'.%c", directorys[i]->string, f_string_eol[0]);
}
} // for
}
// ensure verbosity level is passed to the scripts so that they can also react to requested verbosity.
- if (F_status_is_error_not(*status) && data.verbosity != f_console_verbosity_normal) {
+ if (F_status_is_error_not(*status) && data.error.verbosity != f_console_verbosity_normal) {
char argument[3] = { f_console_symbol_disable, 0, 0 };
- if (data.verbosity == f_console_verbosity_quiet) {
+ if (data.error.verbosity == f_console_verbosity_quiet) {
argument[1] = f_console_standard_short_quiet[0];
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ else if (data.error.verbosity == f_console_verbosity_verbose) {
argument[1] = f_console_standard_short_verbose[0];
}
- else if (data.verbosity == f_console_verbosity_debug) {
+ else if (data.error.verbosity == f_console_verbosity_debug) {
argument[1] = f_console_standard_short_debug[0];
}
else {
if (F_status_is_error(*status)) {
if (F_status_set_fine(*status) == F_failure) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Failed to execute script: ");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path.string);
- fl_color_print_line(f_type_error, data.context.set.error, ".");
+ 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]);
}
}
else {
if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return;
if (!data_build.setting.build_sources_library.used) return;
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Compiling shared library.");
+ fl_color_print(f_type_output, data.context.set.important, "Compiling shared library.%c", f_string_eol[0]);
}
f_string_dynamics_t arguments = f_string_dynamics_t_initialize;
*status = f_file_link(parameter_file_name_micro, parameter_file_path);
- if (F_status_is_error_not(*status) && data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
else if (F_status_is_error(*status)) {
*status = f_file_link(parameter_file_name_micro, parameter_file_path);
}
- if (F_status_is_error_not(*status) && data.verbosity == f_console_verbosity_verbose) {
+ if (F_status_is_error_not(*status) && data.error.verbosity == f_console_verbosity_verbose) {
printf("Linked file '%s' to '", parameter_file_path);
if (data_build.setting.version_target == fake_build_version_type_major) {
if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return;
if (!data_build.setting.build_sources_library.used) return;
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Compiling static library.");
+ fl_color_print(f_type_output, data.context.set.important, "Compiling static library.%c", f_string_eol[0]);
}
f_string_dynamic_t file_name = f_string_dynamic_t_initialize;
if (F_status_is_error_not(*status)) {
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.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The values for the setting '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", fake_build_setting_name_environment);
- fl_color_print(f_type_error, data.context.set.error, "' of setting file '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", data.file_data_build_settings.string);
- fl_color_print_line(f_type_error, data.context.set.error, "' is 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 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]);
}
f_macro_string_dynamic_t_delete_simple(part);
for (uint8_t i = 0; i < 1; i++) {
if (!settings[i]->used) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The setting '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", names[i]);
- fl_color_print(f_type_error, data.context.set.error, "' is required but is not specified in the settings file '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", setting_file.used ? path_file : data.file_data_build_settings.string);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
failed = F_true;
}
} // for
if (found == F_false) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The specified mode '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", modes->array[i].string);
- fl_color_print(f_type_error, data.context.set.error, "' is not a valid mode, according to '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path_file);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
}
error_printed = F_true;
if (F_status_is_error(*status)) {
if (*status == F_status_set_error(F_string_too_large)) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
// @todo update FSS functions to return which setting index the problem happened on.
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: A setting in the build setting file '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path_file);
- fl_color_print_line(f_type_error, data.context.set.error, "' is too long.");
+ 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]);
}
}
else if (!error_printed) {
if (!settings_single_source[i]->used) continue;
if (settings_single_source[i]->used > 1) {
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%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", settings_single_name[i]);
- fl_color_print(f_type_warning, data.context.set.warning, "' in the file '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file);
- fl_color_print(f_type_warning, data.context.set.warning, "' may only have a single property, only using the first: '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", settings_single_source[i]->array[0].string);
- fl_color_print_line(f_type_warning, data.context.set.warning, "'.");
+ 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]);
}
}
else {
*settings_single_bool[i] = F_true;
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%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", settings_single_name[i]);
- fl_color_print(f_type_warning, data.context.set.warning, "' in the file '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file);
- fl_color_print(f_type_warning, data.context.set.warning, "' may be either '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_common_setting_bool_yes);
- fl_color_print(f_type_warning, data.context.set.warning, "' or '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_common_setting_bool_no);
- fl_color_print(f_type_warning, data.context.set.warning, "', defaulting to '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_common_setting_bool_yes);
- fl_color_print_line(f_type_warning, data.context.set.warning, "'.");
+ 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]);
}
}
}
else {
*settings_single_language[i] = fake_build_language_type_c;
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%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", settings_single_name[i]);
- fl_color_print(f_type_warning, data.context.set.warning, "' in the file '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file);
- fl_color_print(f_type_warning, data.context.set.warning, "' may only be one of '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_language_bash);
- fl_color_print(f_type_warning, data.context.set.warning, "', '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_language_c);
- fl_color_print(f_type_warning, data.context.set.warning, "', or '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_language_cpp);
- fl_color_print(f_type_warning, data.context.set.warning, "', defaulting to '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_language_c);
- fl_color_print_line(f_type_warning, data.context.set.warning, "'.");
+ 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]);
}
}
}
else {
*settings_single_version[i] = fake_build_version_type_major;
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%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", settings_single_name[i]);
- fl_color_print(f_type_warning, data.context.set.warning, "' in the file '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file);
- fl_color_print(f_type_warning, data.context.set.warning, "' may only be one of '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_version_major);
- fl_color_print(f_type_warning, data.context.set.warning, "', '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_version_minor);
- fl_color_print(f_type_warning, data.context.set.warning, "', or '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_version_micro);
- fl_color_print(f_type_warning, data.context.set.warning, "', defaulting to '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", fake_build_version_major);
- fl_color_print_line(f_type_warning, data.context.set.warning, "'.");
+ 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]);
}
}
}
setting->search_shared = F_false;
}
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.error, "WARNING: the parameters '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_disabled);
- fl_color_print(f_type_warning, data.context.set.error, "' and '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_enabled);
- fl_color_print(f_type_warning, data.context.set.error, "' contradict, defaulting to '");
+ 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_shared_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_shared_enabled);
+ fl_color_print_TO(data.output, data.context.set.error, "' contradict, defaulting to '");
if (setting->build_shared) {
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_enabled);
+ fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_enabled);
}
else {
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_disabled);
+ fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_disabled);
}
- fl_color_print_line(f_type_warning, data.context.set.error, "'.");
+ fl_color_print_to(data.output, data.context.set.error, "'.%c", f_string_eol[0]);
}
}
else {
setting->search_static = F_false;
}
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.error, "WARNING: the parameters '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled);
- fl_color_print(f_type_warning, data.context.set.error, "' and '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled);
- fl_color_print(f_type_warning, data.context.set.error, "' contradict, defaulting to '");
+ 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 '");
if (setting->build_static) {
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled);
+ fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled);
}
else {
- fl_color_print(f_type_warning, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled);
+ fl_color_print_to(data.output, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled);
}
- fl_color_print_line(f_type_warning, data.context.set.error, "'.");
+ fl_color_print_to(data.output, data.context.set.error, "'.%c", f_string_eol[0]);
}
}
else {
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.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The build settings '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", fake_build_setting_name_build_shared);
- fl_color_print(f_type_error, data.context.set.error, "' and '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", fake_build_setting_name_build_static);
- fl_color_print(f_type_error, data.context.set.error, "' cannot both be false when using the language '");
+ 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 '");
if (setting->build_language == fake_build_language_type_c) {
- fl_color_print(f_type_error, data.context.set.notable, "%s", fake_build_language_c);
+ fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_build_language_c);
}
else {
- fl_color_print(f_type_error, data.context.set.notable, "%s", fake_build_language_cpp);
+ fl_color_print_to(data.error.to, data.context.set.notable, "%s", fake_build_language_cpp);
}
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return;
if (!data_build.setting.build_sources_library.used) return;
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Compiling static objects.");
+ fl_color_print(f_type_output, data.context.set.important, "Compiling static objects.%c", f_string_eol[0]);
}
f_string_dynamic_t file_name = f_string_dynamic_t_initialize;
*status = f_directory_exists(destination_path.string);
if (*status == F_false) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The path '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", destination_path.string);
- fl_color_print_line(f_type_error, data.context.set.error, "' exists but is not a 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: 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]);
}
*status = F_status_set_error(F_failure);
if (F_status_is_error(*status)) {
if (F_status_set_fine(*status) == F_file_found_not) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The path '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", destination_path.string);
- fl_color_print_line(f_type_error, data.context.set.error, "' could not be created, a parent directory does not exist.");
+ 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]);
}
else {
fake_print_error_file(data, F_status_set_fine(*status), "f_directory_create", destination_path.string, "create", F_false, F_true);
break;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Directory '%s' created.%c", destination_path.string, f_string_eol[0]);
}
}
fake_build_load_setting(data, setting_file, &data_build.setting, &status);
if (F_status_is_fine(status)) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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);
fl_color_print_code(f_type_output, data.context.reset);
}
- fl_color_print_line(f_type_output, data.context.set.important, ".");
+ fl_color_print(f_type_output, data.context.set.important, ".%c", f_string_eol[0]);
}
}
if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return;
if (!data_build.setting.build_sources_program.used) return;
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Compiling shared program.");
+ fl_color_print(f_type_output, data.context.set.important, "Compiling shared program.%c", f_string_eol[0]);
}
f_string_dynamics_t arguments = f_string_dynamics_t_initialize;
if (F_status_is_error(*status) || f_file_exists(file_stage.string) == F_true) return;
if (!data_build.setting.build_sources_program.used) return;
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Compiling static program.");
+ fl_color_print(f_type_output, data.context.set.important, "Compiling static program.%c", f_string_eol[0]);
}
f_string_dynamics_t arguments = f_string_dynamics_t_initialize;
f_return_status fake_clean_operate(const fake_data_t data) {
f_status_t status = F_none;
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(f_type_output, data.context.set.important, "'.");
+ fl_color_print(f_type_output, data.context.set.important, "'.%c", f_string_eol[0]);
}
if (fake_signal_received(data)) {
return F_signal;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
status = f_directory_remove_custom(data.path_build.string, f_directory_descriptors_max, F_true, fake_clean_remove_recursively_verbosely);
}
else {
}
if (F_status_set_fine(status) == F_file_found_not) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
int fake_execute(const fake_data_t data, const fake_environment_t environment, const f_string_static_t program, const f_string_statics_t arguments, f_status_t *status) {
if (F_status_is_error(*status)) return 1;
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("%s", program.string);
for (f_array_length_t i = 0; i < arguments.used; i++) {
return_code = 1;
if (F_status_set_fine(*status) == F_file_found_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Failed to find program '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", program.used ? program.string : "");
- fl_color_print_line(f_type_error, data.context.set.error, "' for executing.");
+ 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]);
}
}
else {
status = f_utf_is_word_dash_plus(arguments.argv[location] + j, width_max, F_false);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Failed to process the parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return status;
}
if (status == F_false) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process);
- fl_color_print(f_type_error, data->context.set.error, "' parameters value '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", arguments.argv[location]);
- fl_color_print_line(f_type_error, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.");
+ 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]);
}
return F_status_set_error(F_parameter);
if (F_status_is_error(status)) {
if (status == F_status_set_error(F_string_too_large)) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
- fl_color_print_line(f_type_error, data->context.set.error, "' is too long.");
+ 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]);
}
}
else {
}
if (length == 0 || status == F_data_not) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
- fl_color_print_line(f_type_error, data->context.set.error, "' must not be empty and must not contain only whitespace.");
+ 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]);
}
}
}
status = fl_console_parameter_to_string_dynamic_directory(arguments.argv[data->parameters[parameters_id[i]].additional.array[0]], parameters_value[i]);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Failed to process parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return status;
f_macro_string_dynamic_t_new(status, (*parameters_value[i]), parameter_default_lengths[i]);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Failed to load default for the parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return status;
status = fll_program_parameter_additional_rip(arguments.argv, data->parameters[fake_parameter_define].additional, &data->define);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Failed to process the parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return status;
status = f_utf_is_word(data->define.array[i].string + j, width_max, F_false);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Failed to process the parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return status;
}
if (status == F_false) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define);
- fl_color_print(f_type_error, data->context.set.error, "' parameters value '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", data->define.array[i].string);
- fl_color_print_line(f_type_error, data->context.set.error, "' contains non-word characters.");
+ 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]);
}
return F_status_set_error(F_parameter);
status = fll_program_parameter_additional_rip(arguments.argv, data->parameters[fake_parameter_mode].additional, &data->mode);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Failed to process the parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return status;
status = f_utf_is_word_dash_plus(data->mode.array[i].string + j, width_max, F_false);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Failed to process the parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return status;
}
if (status == F_false) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode);
- fl_color_print(f_type_error, data->context.set.error, "' parameters value '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", data->mode.array[i].string);
- fl_color_print_line(f_type_error, data->context.set.error, "' contains non-word, non-dash, and non-plus characters.");
+ 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]);
}
return F_status_set_error(F_parameter);
case F_signal_quit:
case F_signal_termination:
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print_line(f_type_error, data.context.set.error, "ALERT: An appropriate exit signal has been received, now aborting.");
+ 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]);
}
return F_true;
}
}
else if (parameters_required[i]) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: No valid path for the (required) directory parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
- fl_color_print_line(f_type_error, data.context.set.error, "' was found.");
+ 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]);
return F_status_set_error(F_directory_found_not);
}
#endif // _di_fake_validate_parameter_directories_
#ifndef _di_fake_verbose_print_clone_
- void fake_verbose_print_clone(FILE *output, const f_string_t source, const f_string_t destination) {
- fprintf(output, "Cloned '%s' to '%s'.%c", source, destination, f_string_eol[0]);
+ 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]);
}
#endif // _di_fake_verbose_print_clone_
#ifndef _di_fake_verbose_print_copy_
- void fake_verbose_print_copy(FILE *output, const f_string_t source, const f_string_t destination) {
- fprintf(output, "Copied '%s' to '%s'.%c", source, destination, f_string_eol[0]);
+ 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]);
}
#endif // _di_fake_verbose_print_copy_
#ifndef _di_fake_verbose_print_move_
- void fake_verbose_print_move(FILE *output, const f_string_t source, const f_string_t destination) {
- fprintf(output, "Moved '%s' to '%s'.%c", source, destination, f_string_eol[0]);
+ 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]);
}
#endif // _di_fake_verbose_print_move_
* Helper function for performing a verbose print for a file clone operation.
*
* @param output
- * A file pointer to print to, such as stdout.
+ * A file descriptor to print to, such as f_type_desciptor_output.
* @param source
* The source string.
* @param destination
* The destination string.
*/
#ifndef _di_fake_verbose_print_clone_
- extern void fake_verbose_print_clone(FILE *output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal;
+ extern void fake_verbose_print_clone(const int 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 pointer to print to, such as stdout.
+ * A file descriptor to print to, such as f_type_desciptor_output.
* @param source
* The source string.
* @param destination
* The destination string.
*/
#ifndef _di_fake_verbose_print_copy_
- extern void fake_verbose_print_copy(FILE *output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal;
+ extern void fake_verbose_print_copy(const int 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 pointer to print to, such as stdout.
+ * A file descriptor to print to, such as f_type_desciptor_output.
* @param source
* The source string.
* @param destination
* The destination string.
*/
#ifndef _di_fake_verbose_print_move_
- extern void fake_verbose_print_move(FILE *output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal;
+ extern void fake_verbose_print_move(const int output, const f_string_t source, const f_string_t destination) f_gcc_attribute_visibility_internal;
#endif // _di_fake_verbose_print_move_
#ifdef __cplusplus
#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 fake_make_print_t print, const f_string_static_t buffer, gid_t *id) {
+ f_return_status fake_make_get_id_group(const fake_data_t data, 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;
return F_status_set_error(status);
}
else if (status == F_exist_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(print.to, "%c", f_string_eol[0]);
- fl_color_print(print.to, print.context, "%s: The group name '", print.prefix);
- fl_color_print(print.to, data.context.set.notable, "%s", buffer.string);
- fl_color_print_line(print.to, print.context, "' was not found.");
+ 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]);
}
return F_status_set_error(F_failure);
return F_status_set_error(status);
}
else if (number > f_type_size_32_unsigned) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(print.to, "%c", f_string_eol[0]);
- fl_color_print(print.to, print.context, "%s: The number '", print.prefix);
- fl_color_print(print.to, data.context.set.notable, "%llu", number);
- fl_color_print_line(print.to, print.context, "' is too large.");
+ 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]);
}
}
#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 fake_make_print_t print, 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 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);
return F_status_set_error(F_parameter);
f_status_t status = f_file_mode_from_string(buffer.string, data.umask, mode, replace);
if (F_status_is_error(status)) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
if (F_status_set_fine(status) == F_syntax) {
- fprintf(print.to, "%c", f_string_eol[0]);
- fl_color_print(print.to, print.context, "%s: The mode '", print.prefix);
- fl_color_print(print.to, data.context.set.notable, "%s", buffer.string);
- fl_color_print_line(print.to, print.context, "' is invalid.");
+ 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]);
}
else {
fake_print_message(data, status, "f_file_mode_from_string", F_true, print);
#endif // _di_fake_make_get_id_mode_
#ifndef _di_fake_make_get_id_owner_
- f_return_status fake_make_get_id_owner(const fake_data_t data, const fake_make_print_t print, const f_string_static_t buffer, uid_t *id) {
+ f_return_status fake_make_get_id_owner(const fake_data_t data, const f_string_static_t buffer, uid_t *id) {
const f_string_range_t range = f_macro_string_range_t_initialize(buffer.used);
f_number_unsigned_t number = 0;
return F_status_set_error(status);
}
else if (status == F_exist_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(print.to, "%c", f_string_eol[0]);
- fl_color_print(print.to, print.context, "%s: The user name '", print.prefix);
- fl_color_print(print.to, data.context.set.notable, "%s", buffer.string);
- fl_color_print_line(print.to, print.context, "' was not found.");
+ 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]);
}
return F_status_set_error(F_failure);
return F_status_set_error(status);
}
else if (number > f_type_size_32_unsigned) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(print.to, "%c", f_string_eol[0]);
- fl_color_print(print.to, print.context, "%s: The number '", print.prefix);
- fl_color_print(print.to, data.context.set.notable, "%llu", number);
- fl_color_print_line(print.to, print.context, "' is too large.");
+ 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]);
}
}
}
if (!data_make->buffer.used) {
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_error, "%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", data.file_data_build_fakefile.string);
- fl_color_print(f_type_warning, data.context.set.warning, "' is empty.");
+ 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.");
}
return;
}
if (missing_main) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The fakefile '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", data.file_data_build_fakefile.string);
- fl_color_print(f_type_error, data.context.set.error, "' is missing the required '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", fake_make_section_main);
- fl_color_print_line(f_type_error, data.context.set.error, "' object.");
+ 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]);
}
*status = F_status_set_error(F_failure);
data_make->setting_build.environment.array[data_make->setting_build.environment.used].used--;
data_make->setting_build.environment.used++;
}
- else if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.warning, "WARNING: The environment name '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", name_define.string);
- fl_color_print_line(f_type_warning, data.context.set.warning, "' is already added.");
+ 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]);
}
}
- else if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.warning, "WARNING: The environment name '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", name_define.string);
- fl_color_print_line(f_type_warning, data.context.set.warning, "' is invalid, ignoring.");
+ 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]);
}
name_define.used = 0;
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Invalid characters in the define setting 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 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_line(f_type_error, data.context.set.error, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is allowed.");
+ 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]);
}
*status = F_status_set_error(F_failure);
}
}
- if (data.verbosity != f_console_verbosity_normal) {
+ if (data.error.verbosity != f_console_verbosity_normal) {
if (data_make->parameter.verbosity.used >= data_make->parameter.verbosity.size) {
*status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, &data_make->parameter.verbosity);
}
}
- if (data.verbosity == f_console_verbosity_quiet) {
- if (data.parameters[fake_parameter_quiet].type == f_console_type_normal) {
+ if (data.error.verbosity == f_console_verbosity_quiet) {
+ if (data.parameters[fake_parameter_verbosity_quiet].type == f_console_type_normal) {
*status = fl_string_append(f_console_symbol_short_enable, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
- else if (data.parameters[fake_parameter_quiet].type == f_console_type_inverse) {
+ else if (data.parameters[fake_parameter_verbosity_quiet].type == f_console_type_inverse) {
*status = fl_string_append(f_console_symbol_short_disable, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
*status = fl_string_append(f_console_standard_short_quiet, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
}
- else if (data.verbosity == f_console_verbosity_verbose) {
- if (data.parameters[fake_parameter_verbose].type == f_console_type_normal) {
+ else if (data.error.verbosity == f_console_verbosity_verbose) {
+ if (data.parameters[fake_parameter_verbosity_verbose].type == f_console_type_normal) {
*status = fl_string_append(f_console_symbol_short_enable, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
- else if (data.parameters[fake_parameter_verbose].type == f_console_type_inverse) {
+ else if (data.parameters[fake_parameter_verbosity_verbose].type == f_console_type_inverse) {
*status = fl_string_append(f_console_symbol_short_disable, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
*status = fl_string_append(f_console_standard_short_verbose, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
}
- else if (data.verbosity == f_console_verbosity_debug) {
- if (data.parameters[fake_parameter_debug].type == f_console_type_normal) {
+ else if (data.error.verbosity == f_console_verbosity_debug) {
+ if (data.parameters[fake_parameter_verbosity_debug].type == f_console_type_normal) {
*status = fl_string_append(f_console_symbol_short_enable, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
- else if (data.parameters[fake_parameter_debug].type == f_console_type_inverse) {
+ else if (data.parameters[fake_parameter_verbosity_debug].type == f_console_type_inverse) {
*status = fl_string_append(f_console_symbol_short_disable, 1, &data_make->parameter.verbosity.array[data_make->parameter.verbosity.used]);
}
return F_signal;
}
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Making project.");
+ fl_color_print(f_type_output, data.context.set.important, "Making project.%c", f_string_eol[0]);
}
f_status_t status = F_none;
{
f_status_t status_path = f_path_change_at(data_make.path.top);
- if (F_status_is_error(status_path) && data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.warning, "WARNING: Failed change back to orignal path '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", data_make.path.stack.array[0].string);
- fl_color_print(f_type_warning, data.context.set.warning, "', status code = ");
- fl_color_print(f_type_warning, data.context.set.notable, "%llu", F_status_set_fine(status_path));
- fl_color_print_line(f_type_warning, data.context.set.warning, ".");
+ 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]);
}
}
const f_fss_named_t *section = &data_make->fakefile.array[id_section];
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
fl_color_print(f_type_output, data.context.set.important, "Processing Section '");
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_line(f_type_output, data.context.set.important, "'.");
+ fl_color_print(f_type_output, data.context.set.important, "'.%c", f_string_eol[0]);
}
if (!section->objects.used) {
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
const char *type_name = 0;
if (operation_if == fake_make_operation_if_type_true_next || operation_if == fake_make_operation_if_type_false_next) {
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_line(data_make->print.to, data_make->print.context, "' at end of section.");
+ fl_color_print(data_make->print.to, data_make->print.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);
return;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Breaking as '%s'.", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success);
}
f_string_length_t destination_length = 0;
- if (data.verbosity == f_console_verbosity_verbose) {
- recurse.output = f_type_output;
+ if (data.error.verbosity == f_console_verbosity_verbose) {
+ recurse.output = f_type_descriptor_output;
recurse.verbose = fake_verbose_print_clone;
}
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);
*status = F_status_set_error(F_failure);
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ else if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Cloned '%s' to '%s'.%c", arguments.array[i].string, destination, f_string_eol[0]);
}
}
f_macro_mode_t_set_default_umask(mode, data.umask);
- if (data.verbosity == f_console_verbosity_verbose) {
- recurse.output = f_type_output;
+ if (data.error.verbosity == f_console_verbosity_verbose) {
+ recurse.output = f_type_descriptor_output;
recurse.verbose = fake_verbose_print_copy;
}
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);
*status = F_status_set_error(F_failure);
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ else if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Copied '%s' to '%s'.%c", arguments.array[i].string, destination, f_string_eol[0]);
}
}
if (F_status_is_error(*status)) {
fake_print_message(data, F_status_set_fine(*status), "f_environment_set", F_true, data_make->print);
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ else if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Defined environment variable '%s'.%c", arguments.array[0].string, f_string_eol[0]);
}
if (F_status_is_error(*status)) {
if (F_status_set_fine(*status) == F_file_found_not) {
- if (data.verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_warning, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the file '");
- fl_color_print(f_type_warning, data.context.set.notable, "%s", arguments.array[i].string);
- fl_color_print_line(f_type_warning, data.context.set.warning, "' was not found.");
+ 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]);
}
*status = F_none;
}
}
else if (f_macro_file_type_is_directory(file_stat.st_mode)) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
*status = f_directory_remove_custom(arguments.array[i].string, recursion_max, F_false, fake_clean_remove_recursively_verbosely);
}
else {
}
if (F_status_set_fine(*status) == F_file_found_not) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("The directory '%s' does not exist.%c", arguments.array[i].string, f_string_eol[0]);
}
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);
return;
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ else if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Removed '%s'.%c", arguments.array[i].string, f_string_eol[0]);
}
}
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);
return;
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ else if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Removed '%s'.%c", arguments.array[i].string, f_string_eol[0]);
}
}
return;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Exiting as '%s'.", arguments.used ? arguments.array[0].string : fake_make_operation_argument_success);
}
data_make->print.to = 0;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Set failure state to '");
if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) {
fake_print_message_file(data, *status, "f_file_role_change", arguments.array[i].string, "change group of", F_true, F_true, data_make->print);
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
} // for
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);
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
} // for
*status = F_status_set_error(F_failure);
*operation_if = fake_make_operation_if_type_false_always_next;
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%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_line(data_make->print.to, data_make->print.context, "' may only be between the ranges -%llu to %llu.", f_number_t_size_unsigned, f_number_t_size_unsigned);
+ 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]);
}
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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
}
}
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);
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
break;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
} // for
break;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
} // for
f_string_length_t destination_length = 0;
- if (data.verbosity == f_console_verbosity_verbose) {
- recurse.output = f_type_output;
+ if (data.error.verbosity == f_console_verbosity_verbose) {
+ recurse.output = f_type_descriptor_output;
recurse.verbose = fake_verbose_print_move;
}
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);
break;
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
} // for
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);
}
- else if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
} // for
return;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ 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);
return;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
*status = fake_make_path_relative(data, data_make->path.stack.array[data_make->path.stack.used], data_make);
if (F_status_is_error(*status)) {
return;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Changed to project path ''.%c", f_string_eol[0]);
}
}
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Touched %s '", arguments.array[0].string);
f_print_dynamic(f_type_output, arguments.array[i]);
printf("'.%c", f_string_eol[0]);
data_make->environment.values.used++;
} // for
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("%s", program.string);
for (f_array_length_t i = 0; i < arguments.used; i++) {
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' for executing.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' for executing.%c", f_string_eol[0]);
}
}
else if (F_status_set_fine(status) != F_failure) {
return;
}
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
if (data_make->setting_make.fail == fake_make_operation_fail_type_exit) {
if (operation == fake_make_operation_type_index || operation == fake_make_operation_type_run || operation == fake_make_operation_type_shell) {
if (!arguments.used) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
else if (operation == fake_make_operation_type_index) {
if (!data_make->setting_build.build_indexer.used) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' section operation.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (operation == fake_make_operation_type_break) {
if (arguments.used > 1) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (operation == fake_make_operation_type_build) {
if (arguments.used > 1) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(status_file);
*status = status_file;
}
else if (!status_file) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a regular file.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a regular file.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Filename argument must not be an empty string.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
else if (operation == fake_make_operation_type_pop) {
if (data_make->path.stack.used == 1) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Must not attempt to pop project root off of path stack.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
for (f_array_length_t i = 0; i < arguments.used - 1; i++) {
if (f_file_exists(arguments.array[i].string) != F_true) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a valid directory.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
status_file = f_directory_is(arguments.array[1].string);
if (status_file == F_false) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a valid directory.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (operation == fake_make_operation_type_compile) {
if (!arguments.used) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
else if (data_make->setting_build.build_compiler.used) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' section operation.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
for (f_array_length_t i = 0; i < arguments.used - 1; i++) {
if (f_file_exists(arguments.array[i].string) != F_true) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a valid directory.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
status_file = f_directory_is(arguments.array[1].string);
if (status_file == F_false) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a valid directory.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
} // for
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
*status = fake_make_operate_validate_define_name(arguments.array[0]);
if (*status == F_none) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Define name must not be an empty string.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
}
else if (*status == F_false) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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);
f_print_dynamic(data_make->print.to, arguments.array[0]);
fl_color_print_code(data_make->print.to, data.context.reset);
- fl_color_print_line(data_make->print.to, data_make->print.context, "', only alpha-numeric ASCII characters and underscore (without a leading digit) is allowed.");
+ 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]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' section operation.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' section operation.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has no preceding if condition.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
}
if (arguments.used) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
if (operation == fake_make_operation_type_exit) {
if (arguments.used > 1) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
status_file = f_file_is(arguments.array[i].string, f_file_type_regular, F_false);
if (status_file == F_file_found_not) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(status_file);
}
else if (F_status_is_error(status_file)) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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);
}
return;
}
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' section operation.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' section operation.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
} // for
if (i == 14) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
type_file |= 0x40;
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
type_file |= 0x80;
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (F_status_is_error(status_number)) {
*status = F_status_set_error(F_failure);
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%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_line(data_make->print.to, data_make->print.context, "' may only be between the ranges -%llu to %llu.", f_number_t_size_unsigned, f_number_t_size_unsigned);
+ 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]);
}
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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
}
}
}
}
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (operation == fake_make_operation_type_link) {
if (arguments.used > 2) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
for (f_array_length_t i = 0; i < arguments.used - 1; i++) {
if (f_file_exists(arguments.array[i].string) != F_true) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a valid directory.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
status_file = f_directory_is(arguments.array[1].string);
if (status_file == F_false) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a valid directory.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a valid directory.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (operation == fake_make_operation_type_operate) {
if (arguments.used > 1) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
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_line(data_make->print.to, data_make->print.context, "' was found.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' was found.%c", f_string_eol[0]);
}
else {
for (f_array_length_t i = 0; i < section_stack->used; i++) {
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_line(data_make->print.to, data_make->print.context, "' is already in the operation stack, recursion is not allowed.");
+ 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]);
*status = F_status_set_error(F_failure);
break;
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
if (operation == fake_make_operation_type_to) {
if (arguments.used > 1) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Has too many arguments.", data_make->print.prefix);
+ 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]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(status_file);
}
else if (F_status_is_error(status_file)) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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);
}
*status = status_file;
}
else if (!status_file) {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "' must be a directory file.");
+ fl_color_print(data_make->print.to, data_make->print.context, "' must be a directory file.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Filename argument must not be an empty string.", data_make->print.prefix);
+ 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]);
}
}
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
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.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ 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_line(data_make->print.to, data_make->print.context, "'.");
+ fl_color_print(data_make->print.to, data_make->print.context, "'.%c", f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
} // for
}
else {
- if (data.verbosity != f_console_verbosity_quiet && data_make->print.to) {
+ if (data.error.verbosity != f_console_verbosity_quiet && data_make->print.to) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(data_make->print.to, data_make->print.context, "%s: Requires more arguments.", data_make->print.prefix);
+ fl_color_print(data_make->print.to, data_make->print.context, "%s: Requires more arguments.%c", data_make->print.prefix, f_string_eol[0]);
}
*status = F_status_set_error(F_failure);
f_macro_string_dynamics_t_delete_simple(path.stack)
#endif // _di_fake_make_path_t_
-#ifndef _di_fake_make_print_t_
- typedef struct {
- const char *prefix;
- f_color_set_t context;
-
- FILE *to;
- } fake_make_print_t;
-
- #define fake_make_print_t_initialize { \
- 0, \
- f_color_set_t_initialize, \
- 0, \
- }
-
- #define fake_macro_make_print_t_initialize(prefix, context, to) { prefix, context, to }
-
- #define fake_make_print_error "ERROR"
- #define fake_make_print_warning "WARNING"
-
- #define fake_make_print_error_length 5
- #define fake_make_print_warning_length 7
-#endif // _di_fake_make_print_t_
-
#ifndef _di_fake_make_data_t_
typedef struct {
fake_build_setting_t setting_build;
fake_make_parameter_t parameter;
fake_make_path_t path;
- fake_make_print_t print;
f_fss_nameds_t fakefile;
fake_environment_t_initialize, \
fake_make_parameter_t_initialize, \
fake_make_path_t_initialize, \
- fake_make_print_t_initialize, \
f_fss_nameds_t_initialize, \
f_string_dynamic_t_initialize, \
f_string_dynamic_t_initialize, \
*
* @param data
* The program data.
- * @param print
- * The error/warning print data.
* @param buffer
* The string containing the name or number.
* @param id
* 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 fake_make_print_t print, 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 f_string_static_t buffer, gid_t *id) f_gcc_attribute_visibility_internal;
#endif // _di_fake_make_get_id_group_
/**
*
* @param data
* The program data.
- * @param print
- * The error/warning print data.
* @param buffer
* The string containing the name or number.
* @param mode
* 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 fake_make_print_t print, 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 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_
/**
*
* @param data
* The program data.
- * @param print
- * The error/warning print data.
* @param buffer
* The string containing the name or number.
* @param id
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_fake_make_get_id_owner_
- f_return_status fake_make_get_id_owner(const fake_data_t data, const fake_make_print_t print, const f_string_static_t buffer, uid_t *id) f_gcc_attribute_visibility_internal;
+ f_return_status fake_make_get_id_owner(const fake_data_t data, const f_string_static_t buffer, uid_t *id) f_gcc_attribute_visibility_internal;
#endif // _di_fake_make_get_id_owner_
/**
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, print);
+ return fake_print_message(data, status, function, fallback);
}
#endif // _di_fake_print_error_
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.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Failed to find '");
+ 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 '");
if (f_file_exists(source) == F_true) {
- fl_color_print(f_type_error, data.context.set.notable, "%s", destination);
+ fl_color_print_to(data.error.to, data.context.set.notable, "%s", destination);
}
else {
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ fl_color_print_to(data.error.to, data.context.set.notable, "%s", source);
}
- fl_color_print(f_type_error, data.context.set.error, "' while trying to %s '", operation);
- fl_color_print(f_type_error, 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_parameter) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, data.context.set.notable, "%s", function);
- fl_color_print(f_type_error, data.context.set.error, "() to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_name) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Invalid name for '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' or '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_memory_out) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_number_overflow) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Overflow while trying to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_directory) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Invalid directory while trying to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_access_denied) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Access denied while trying to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_loop) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Loop while trying to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_prohibited) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Prohibited by system while trying to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_directory_found_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Failed to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "' due to an invalid directory in the path.");
+ fl_color_print_to(data.error.to, data.context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_failure) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: Failed to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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);
if (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, 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.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", status);
- fl_color_print(f_type_error, data.context.set.error, ") occurred while trying to %s '", operation);
- fl_color_print(f_type_error, data.context.set.notable, "%s", source);
+ 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 (destination) {
- fl_color_print(f_type_error, data.context.set.error, "' %s '", how);
- fl_color_print(f_type_error, data.context.set.notable, "%s", 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_line(f_type_error, data.context.set.error, "'.");
+ fl_color_print_to(data.error.to, data.context.set.error, "'.%c", f_string_eol[0]);
}
return F_true;
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.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at stop position (at ");
- fl_color_print(f_type_error, data.context.set.notable, "%d", range.start);
- fl_color_print(f_type_error, data.context.set.error, " of setting file '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path_file);
- fl_color_print_line(f_type_error, data.context.set.error, "').");
+ 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]);
}
return F_false;
}
if (status == F_status_set_error(F_incomplete_utf_stop)) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at end of string (at ");
- fl_color_print(f_type_error, data.context.set.notable, "%d", range.start);
- fl_color_print(f_type_error, data.context.set.error, " of setting file '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path_file);
- fl_color_print_line(f_type_error, data.context.set.error, "').");
+ 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]);
}
return F_false;
}
- if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", status);
- fl_color_print(f_type_error, data.context.set.error, ") in function ");
- fl_color_print(f_type_error, data.context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, data.context.set.error, "().");
+ 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]);
}
return F_true;
#ifndef _di_fake_print_error_parameter_missing_value_
void fake_print_error_parameter_missing_value(const fake_data_t data, const f_string_t parameter) {
- if (data.verbosity == f_console_verbosity_quiet) return;
+ if (data.error.verbosity == f_console_verbosity_quiet) return;
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data.error.to, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
+ 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_line(f_type_error, data.context.set.error, "' was specified, but no value was given.");
+ fl_color_print_to(data.error.to, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
}
#endif // _di_fake_print_error_parameter_missing_value_
#ifndef _di_fake_print_error_parameter_too_many_
void fake_print_error_parameter_too_many(const fake_data_t data, const f_string_t parameter) {
- if (data.verbosity == f_console_verbosity_quiet) return;
+ if (data.error.verbosity == f_console_verbosity_quiet) return;
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data.error.to, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
+ 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_line(f_type_error, data.context.set.error, "' specified too many times.");
+ fl_color_print_to(data.error.to, data.context.set.error, "' specified too many times.%c", f_string_eol[0]);
}
#endif // _di_fake_print_error_parameter_too_many_
#ifndef _di_fake_print_message_
- f_return_status fake_print_message(const fake_data_t data, const f_status_t status, const f_string_t function, const bool fallback, const fake_make_print_t print) {
+ f_return_status fake_print_message(const fake_data_t data, const f_status_t status, const f_string_t function, const bool fallback) {
if (status == F_parameter) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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);
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_line(print.to, print.context, "().");
+ fl_color_print(print.to, print.context, "().%c", f_string_eol[0]);
}
else {
- fl_color_print_line(print.to, print.context, ".");
+ fl_color_print(print.to, print.context, ".%c", f_string_eol[0]);
}
}
}
if (status == F_memory_allocation || status == F_memory_reallocation) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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);
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_line(print.to, print.context, "().");
+ fl_color_print(print.to, print.context, "().%c", f_string_eol[0]);
}
else {
- fl_color_print_line(print.to, print.context, ".");
+ fl_color_print(print.to, print.context, ".%c", f_string_eol[0]);
}
}
return F_none;
}
- if (fallback && data.verbosity != f_console_verbosity_quiet) {
+ 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);
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_line(print.to, print.context, "().");
+ fl_color_print(print.to, print.context, "().%c", f_string_eol[0]);
}
else {
- fl_color_print_line(print.to, print.context, ".");
+ fl_color_print(print.to, print.context, ".%c", f_string_eol[0]);
}
}
#endif // _di_fake_print_message_
#ifndef _di_fake_print_message_file_
- bool fake_print_message_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) {
+ bool fake_print_message_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 f_string_t file_or_directory = is_file ? "file" : "directory";
if (status == F_file_found_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_file_found) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "' already exists.");
+ fl_color_print(print.to, print.context, "' already exists.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_directory_empty_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "' is not empty.");
+ fl_color_print(print.to, print.context, "' is not empty.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_parameter) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_name) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_memory_out) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_number_overflow) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_directory) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_access_denied) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_loop) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_prohibited) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_access_owner) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_access_group) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
if (is_file) {
if (status == F_directory_found_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "' due to an invalid directory in the path.");
+ fl_color_print(print.to, print.context, "' due to an invalid directory in the path.%c", f_string_eol[0]);
}
return F_false;
}
else {
if (status == F_directory_found_not) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "' due to an invalid directory in the path.");
+ fl_color_print(print.to, print.context, "' due to an invalid directory in the path.%c", f_string_eol[0]);
}
return F_false;
}
if (status == F_failure) {
- if (data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_false;
}
}
- if (fake_print_error(data, status, function, F_false) == F_unknown && fallback && data.verbosity != f_console_verbosity_quiet) {
+ 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_line(print.to, print.context, "'.");
+ fl_color_print(print.to, print.context, "'.%c", f_string_eol[0]);
}
return F_true;
#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.verbosity == f_console_verbosity_quiet || !print.to) return;
+ if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return;
f_string_length_t line = 1;
fl_color_print(print.to, print.context, "' on line ");
fl_color_print(print.to, data.context.set.notable, "%llu", line);
- fl_color_print_line(print.to, print.context, " failed.");
+ fl_color_print(print.to, print.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.verbosity == f_console_verbosity_quiet || !print.to) return;
+ if (data.error.verbosity == f_console_verbosity_quiet || !print.to) 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_line(print.to, print.context, "' is outside the project root.");
+ fl_color_print(print.to, print.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);
#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.verbosity == f_console_verbosity_quiet || !print.to) return;
+ if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return;
if (status == F_buffer_too_large) {
fprintf(print.to, "%c", f_string_eol[0]);
fl_color_print(print.to, print.context, "()");
}
- fl_color_print_line(print.to, print.context, ".");
+ fl_color_print(print.to, print.context, ".%c", f_string_eol[0]);
}
else {
fake_print_message_file(data, status, function, path, "change path to", F_false, F_true, print);
#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.verbosity == f_console_verbosity_quiet || !print.to) return;
+ if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return;
f_string_length_t line = 1;
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_line(print.to, print.context, " has been reached.");
+ fl_color_print(print.to, print.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.verbosity == f_console_verbosity_quiet || !print.to) return;
+ if (data.error.verbosity == f_console_verbosity_quiet || !print.to) return;
f_string_length_t line = 1;
fl_color_print(print.to, print.context, "' on line ");
fl_color_print(print.to, data.context.set.notable, "%llu", line);
- fl_color_print_line(print.to, print.context, " is not a known operation name.");
+ fl_color_print(print.to, print.context, " is not a known operation name.%c", f_string_eol[0]);
}
#endif // _di_fake_print_message_section_operation_unknown_
#ifndef _di_fake_print_warning_settings_content_empty_
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.verbosity == f_console_verbosity_quiet) return;
+ if (data.error.verbosity == f_console_verbosity_quiet) return;
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data.error.to, "%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);
f_print_dynamic_partial(f_type_warning, buffer, range_object);
fl_color_print_code(f_type_warning, data.context.reset);
- fl_color_print_line(f_type_warning, data.context.set.warning, "'.");
+ fl_color_print(f_type_warning, data.context.set.warning, "'.%c", f_string_eol[0]);
}
#endif // _di_fake_print_warning_settings_content_empty_
#ifndef _di_fake_print_warning_settings_content_invalid_
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.verbosity == f_console_verbosity_quiet) return;
+ if (data.error.verbosity == f_console_verbosity_quiet) return;
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data.error.to, "%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);
f_print_dynamic_partial(f_type_warning, buffer, range_object);
fl_color_print_code(f_type_warning, data.context.reset);
- fl_color_print_line(f_type_warning, data.context.set.warning, "'.");
+ fl_color_print(f_type_warning, data.context.set.warning, "'.%c", f_string_eol[0]);
}
#endif // _di_fake_print_warning_settings_content_invalid_
#ifndef _di_fake_print_warning_settings_content_multiple_
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.verbosity != f_console_verbosity_verbose) return;
+ if (data.error.verbosity != f_console_verbosity_verbose) return;
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data.error.to, "%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);
fl_color_print(f_type_warning, data.context.set.warning, "' in the file '");
fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file);
- fl_color_print_line(f_type_warning, data.context.set.warning, "' may only have a single property, only using the first.");
+ fl_color_print(f_type_warning, data.context.set.warning, "' may only have a single property, only using the first.%c", f_string_eol[0]);
}
#endif // _di_fake_print_warning_settings_content_multiple_
#ifndef _di_fake_print_warning_settings_object_multiple_
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.verbosity != f_console_verbosity_verbose) return;
+ if (data.error.verbosity != f_console_verbosity_verbose) return;
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data.error.to, "%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);
fl_color_print(f_type_warning, data.context.set.warning, "' in the file '");
fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file);
- fl_color_print_line(f_type_warning, data.context.set.warning, "' may only be specified once, only using the first.");
+ fl_color_print(f_type_warning, data.context.set.warning, "' may only be specified once, only using the first.%c", f_string_eol[0]);
}
#endif // _di_fake_print_warning_settings_object_multiple_
* Set to 0 to disable.
* @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_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_message_
- extern f_return_status fake_print_message(const fake_data_t data, const f_status_t status, const f_string_t function, const bool fallback, const fake_make_print_t print) f_gcc_attribute_visibility_internal;
+ extern f_return_status fake_print_message(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_message_
/**
* F_false is returned on successful print of known errors.
*/
#ifndef _di_fake_print_message_file_
- extern bool fake_print_message_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) f_gcc_attribute_visibility_internal;
+ extern bool fake_print_message_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_message_file_
/**
f_status_t status = F_none;
- if (data.verbosity != f_console_verbosity_quiet) {
+ if (data.error.verbosity != f_console_verbosity_quiet) {
printf("%c", f_string_eol[0]);
- fl_color_print_line(f_type_output, data.context.set.important, "Generating skeleton structure.");
+ fl_color_print(f_type_output, data.context.set.important, "Generating skeleton structure.%c", f_string_eol[0]);
}
{
status = f_directory_exists(path.string);
if (status == F_true) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Directory '%s' already exists.%c", path.string, f_string_eol[0]);
}
}
if (status == F_false) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The path '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path.string);
- fl_color_print_line(f_type_error, data.context.set.error, "' exists but is not a 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: 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]);
}
return F_status_set_warning(F_failure);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The path '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path.string);
- fl_color_print_line(f_type_error, data.context.set.error, "' could not be created, a parent directory does not exist.");
+ 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]);
}
else {
fake_print_error_file(data, F_status_set_fine(status), "f_directory_create", path.string, "create", F_false, F_true);
return status;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("Directory '%s' created.%c", path.string, f_string_eol[0]);
}
}
status = f_file_is(path.string, f_file_type_regular, F_false);
if (status == F_true) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("File '%s' already exists.%c", path.string, f_string_eol[0]);
}
status = f_file_is(path.string, f_file_type_link, F_false);
if (status == F_true) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("File '%s' already exists (as a symbolic link).%c", path.string, f_string_eol[0]);
}
}
if (status == F_false) {
- if (data.verbosity == f_console_verbosity_verbose) {
+ 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]);
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The file '");
- fl_color_print(f_type_error, data.context.set.notable, "%s", path.string);
- fl_color_print_line(f_type_error, data.context.set.error, "' could not be created, a parent directory does not exist.");
+ 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]);
}
else {
fake_print_error_file(data, F_status_set_fine(status), "f_file_create", path.string, "create", F_true, F_true);
return status;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("File '%s' created.%c", path.string, f_string_eol[0]);
}
return status;
}
- if (data.verbosity == f_console_verbosity_verbose) {
+ if (data.error.verbosity == f_console_verbosity_verbose) {
printf("File '%s' pre-populated.%c", path.string, f_string_eol[0]);
}
fl_status
fl_string
fl_utf
-fll_fss
+fll_error
fll_execute
fll_file
+fll_fss
fll_path
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_path -lfll_file -lfll_execute -lfl_environment -lfll_fss -lfl_utf -lfl_string -lfl_status -lfl_iki -lfl_fss -lfl_directory -lfl_conversion -lfl_console -lfl_color -lf_signal -lf_print -lf_path -lf_iki -lf_file -lf_fss -lf_environment -lf_directory -lf_conversion -lf_console -lf_account -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_path -lfll_fss -lfll_file -lfll_execute -lfl_environment -lfll_error -lfl_utf -lfl_string -lfl_status -lfl_iki -lfl_fss -lfl_directory -lfl_conversion -lfl_console -lfl_color -lf_signal -lf_print -lf_path -lf_iki -lf_file -lf_fss -lf_environment -lf_directory -lf_conversion -lf_console -lf_account -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fake.c private-fake.c private-clean.c private-build.c private-make.c private-print.c private-skeleton.c
#endif
#ifndef _di_firewall_print_help_
- f_return_status firewall_print_help(const f_color_context_t context) {
+ f_return_status firewall_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, firewall_name_long, firewall_version);
+ fll_program_print_help_header(id, context, firewall_name_long, firewall_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
#ifdef _en_firewall_debug_
- fll_program_print_help_option(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(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.");
+ #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.");
+
+ #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.");
#endif // _en_firewall_debug_
printf("%c%c", f_string_eol[0], f_string_eol[0]);
fl_color_print(f_type_output, context.set.standout, firewall_command_show);
printf(" Show active firewall settings");
- fll_program_print_help_usage(context, firewall_name, "command");
+ fll_program_print_help_usage(id, context, firewall_name, "command");
return F_none;
}
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, firewall_total_parameters);
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
+ const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, firewall_total_parameters);
- if (F_status_is_error(status)) {
- firewall_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ firewall_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { firewall_parameter_verbosity_quiet, firewall_parameter_verbosity_normal, firewall_parameter_verbosity_verbose, firewall_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ firewall_delete_data(data);
+ return status;
+ }
+
+ if (choice == firewall_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == firewall_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == firewall_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == firewall_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[firewall_parameter_help].result == f_console_result_found) {
- firewall_print_help(data->context);
+ firewall_print_help(data->output, data->context);
firewall_delete_data(data);
return F_none;
}
if (data->parameters[firewall_parameter_version].result == f_console_result_found) {
- fll_program_print_version(firewall_version);
+ fll_program_print_version(data->output, firewall_version);
firewall_delete_data(data);
return F_none;
if (strncmp("nat", arguments.argv[data->remaining.array[counter]], 4) != 0) {
if (strncmp("mangle", arguments.argv[data->remaining.array[counter]], 7) != 0) {
if (strncmp("ports", arguments.argv[data->remaining.array[counter]], 6) != 0) {
- fl_color_print_line(f_type_warning, data->context.set.warning, "WARNING: '%s' is not a valid show option", arguments.argv[data->remaining.array[counter]]);
+ fl_color_print(f_type_warning, data->context.set.warning, "WARNING: '%s' is not a valid show option%c", arguments.argv[data->remaining.array[counter]], f_string_eol[0]);
}
else {
show_ports = F_true;
f_macro_string_dynamics_resize(status, parameters, 7);
if (F_status_is_error(status)) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, 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;
if (show_nat) {
fl_color_print(f_type_output, data->context.set.standout, "=========================== ");
fl_color_print(f_type_output, data->context.set.title, "NAT");
- fl_color_print_line(f_type_output, data->context.set.standout, " ============================");
+ fl_color_print(f_type_output, data->context.set.standout, " ============================%c", f_string_eol[0]);
fflush(f_type_output);
parameters.used = 6;
if (F_status_is_error_not(status) && show_mangle) {
fl_color_print(f_type_output, data->context.set.standout, "========================== ");
fl_color_print(f_type_output, data->context.set.title, "MANGLE");
- fl_color_print_line(f_type_output, data->context.set.standout, " ==========================");
+ fl_color_print(f_type_output, data->context.set.standout, " ==========================%c", f_string_eol[0]);
fflush(f_type_output);
parameters.used = 6;
if (F_status_is_error_not(status) && show_ports) {
fl_color_print(f_type_output, data->context.set.standout, "========================== ");
fl_color_print(f_type_output, data->context.set.title, "FILTER");
- fl_color_print_line(f_type_output, data->context.set.standout, " ==========================");
+ fl_color_print(f_type_output, data->context.set.standout, " ==========================%c", f_string_eol[0]);
fflush(f_type_output);
parameters.used = 4;
status = F_status_set_fine(status);
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Failed to perform requested %s operation:", firewall_tool_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]);
fprintf(f_type_error, " ");
f_string_length_t i = 0;
status = F_status_set_fine(status);
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
}
else if (status == F_data_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Could not find any network devices");
+ fl_color_print_to(data->error.to, data->context.set.error, "ERROR: Could not find any network devices%c", f_string_eol[0]);
}
else if (status == F_failure) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Failed to read the device directory '%s'", network_devices);
+ 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]);
}
firewall_delete_local_data(&local);
return status;
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Failed to perform lock request because the lock instructions are missing from: %s.", network_path firewall_file_other);
+ 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]);
firewall_delete_local_data(&local);
firewall_delete_data(data);
}
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Failed to perform stop request because the lock instructions are missing from: %s.", network_path firewall_file_other);
+ 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]);
firewall_delete_local_data(&local);
firewall_delete_data(data);
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_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, 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;
firewall_delete_local_data(&local);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You did not pass a command");
+ fl_color_print_to(data->error.to, data->context.set.error, "ERROR: You did not pass a command%c", f_string_eol[0]);
status = F_status_set_error(F_parameter);
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/execute.h>
#include <level_2/fss_basic.h>
#include <level_2/fss_basic_list.h>
firewall_parameter_light,
firewall_parameter_dark,
firewall_parameter_no_color,
- firewall_parameter_version,
+ firewall_parameter_verbosity_quiet,
+ firewall_parameter_verbosity_normal,
+ firewall_parameter_verbosity_verbose,
#ifdef _en_firewall_debug_
firewall_parameter_debug,
#endif // _en_firewall_debug_
+ firewall_parameter_version,
+
firewall_parameter_command_start,
firewall_parameter_command_stop,
firewall_parameter_command_restart,
#ifdef _en_firewall_debug_
#define firewall_console_parameter_t_initialize \
{ \
- f_console_parameter_t_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, F_false, f_console_type_normal), \
- f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(0, 0, firewall_command_start, F_false, f_console_type_other), \
f_console_parameter_t_initialize(0, 0, firewall_command_stop, F_false, f_console_type_other), \
f_console_parameter_t_initialize(0, 0, firewall_command_restart, F_false, f_console_type_other), \
f_console_parameter_t_initialize(0, 0, firewall_command_show, F_false, f_console_type_other), \
}
- #define firewall_total_parameters 11
+ #define firewall_total_parameters 14
#else
#define firewall_console_parameter_t_initialize \
{ \
- f_console_parameter_t_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, F_false, f_console_type_normal), \
- f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(0, 0, firewall_command_start, F_false, f_console_type_other), \
f_console_parameter_t_initialize(0, 0, firewall_command_stop, F_false, f_console_type_other), \
f_console_parameter_t_initialize(0, 0, firewall_command_restart, F_false, f_console_type_other), \
f_console_parameter_t_initialize(0, 0, firewall_command_show, F_false, f_console_type_other), \
}
- #define firewall_total_parameters 10
+ #define firewall_total_parameters 13
#endif // _en_firewall_debug_
#endif // _di_firewall_defines_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_string_dynamics_t chains;
f_string_dynamics_t devices;
firewall_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
f_color_context_t_initialize, \
* F_none on success.
*/
#ifndef _di_firewall_print_help_
- extern f_return_status firewall_print_help(const f_color_context_t context);
+ extern f_return_status firewall_print_help(const int id, const f_color_context_t context);
#endif // _di_firewall_print_help_
/**
fprintf(f_type_warning, "\n");
}
else {
- fl_color_print_line(f_type_warning, data.context.set.warning, "WARNING: At line %i, the object has no content", i);
+ fl_color_print(f_type_warning, data.context.set.warning, "WARNING: At line %i, the object has no content%c", i, f_string_eol[0]);
}
continue;
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
+ 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]);
}
else if (status == F_file_found_not) {
// the file does not have to exist
- fl_color_print_line(f_type_warning, data.context.set.warning, "WARNING: Cannot find the file '%.*s'", file_path.used, file_path.string);
+ fl_color_print(f_type_warning, data.context.set.warning, "WARNING: Cannot find the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]);
status = F_none;
}
else if (status == F_file_open) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Unable to open the file '%.*s'", file_path.used, file_path.string);
+ 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]);
}
else if (status == F_file_descriptor) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%.*s'", file_path.used, file_path.string);
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
+ 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]);
}
if (status != F_file_found_not) {
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read()");
+ 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]);
}
else if (status == F_number_overflow) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%.*s'", file_path.used, file_path.string);
+ 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]);
}
else if (status == F_file_closed) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: The file '%.*s' is no longer open", file_path.used, file_path.string);
+ 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]);
}
else if (status == F_file_seek) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%.*s'", file_path.used, file_path.string);
+ 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]);
}
else if (status == F_file_read) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: A read error occurred while accessing the file '%.*s'", file_path.used, file_path.string);
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read()", status);
+ 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]);
}
status = F_status_set_error(status);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_read() for the file '%.*s'", file_path.used, file_path.string);
+ 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]);
}
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_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_read() for the file '%.*s'", status, file_path.used, file_path.string);
+ 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]);
}
status = F_status_set_error(status);
}
if (F_status_is_error(status)) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, 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);
}
f_macro_string_dynamic_t_new(status, ip_argument, ip_length);
if (F_status_is_error(status)) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
break;
}
status = fll_execute_program((f_string_t) current_tool, arguments, 0, &return_code);
if (status == F_failure) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Failed to perform requested %s operation:", current_tool);
+ 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]);
fprintf(f_type_error, " ");
fl_color_print_code(f_type_error, data.context.error);
break;
}
else if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()");
+ 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]);
// remove ip_argument from arguments string.
f_macro_string_dynamic_t_delete_simple(arguments.array[arguments.used]);
status = fll_execute_program(current_tool, arguments, 0, &return_code);
if (status == F_failure) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Failed to perform requested %s operation:", current_tool);
+ 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]);
fprintf(f_type_error, " ");
fl_color_print_code(f_type_error, data.context.error);
break;
}
else if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()");
+ 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]);
break;
}
}
if (status == F_failure) {
if (tool == firewall_program_iptables) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Failed to perform requested %s operation:", firewall_tool_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]);
}
else if (tool == firewall_program_ip6tables) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Failed to perform requested %s operation:", firewall_tool_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]);
}
fprintf(f_type_error, " ");
fprintf(f_type_error, "\n");
}
else if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()");
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()", status);
+ 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]);
}
f_macro_string_dynamics_t_delete_simple(arguments);
status = F_status_set_fine(status);
if (status == F_failure) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Failed to perform requested %s operation:", tools[i]);
+ 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]);
fprintf(f_type_error, " ");
fl_color_print_code(f_type_error, data.context.error);
fprintf(f_type_error, "\n");
}
else if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()");
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()", status);
+ 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]);
}
return status;
status = F_status_set_fine(status);
if (status == F_failure) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Failed to perform requested %s operation:", tools[i]);
+ 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]);
fprintf(f_type_error, " ");
fl_color_print_code(f_type_error, data.context.error);
fprintf(f_type_error, "\n");
}
else if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()");
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()", status);
+ 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]);
}
return status;
status = F_status_set_fine(status);
if (status == F_failure) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Failed to perform requested %s operation:", tools[j]);
+ 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]);
fprintf(f_type_error, " ");
fl_color_print_code(f_type_error, data.context.error);
fprintf(f_type_error, "\n");
}
else if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()");
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()", status);
+ 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]);
}
return status;
if (optional) {
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().");
+ 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]);
}
else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().", status);
+ 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]);
}
} else {
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().");
+ 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]);
}
else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to find the file '%s'.", filename);
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: Unable to open the file '%s'.", filename);
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.", filename);
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().", status);
+ 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]);
}
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read().");
+ 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]);
}
else if (status == F_number_overflow) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.", filename);
+ 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]);
}
else if (status == F_file_closed) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.", filename);
+ 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]);
}
else if (status == F_file_seek) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.", filename);
+ 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]);
}
else if (status == F_file_read) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: A read error occurred while accessing the file '%s'.", filename);
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read().", status);
+ 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]);
}
return status;
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", filename);
+ 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]);
}
else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: No relevant data was found within the file '%s'.", filename);
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.", status, filename);
+ 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]);
}
return status;
status = F_status_set_fine(status);
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
+ 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]);
}
f_macro_fss_objects_t_delete_simple(local->rule_objects);
(structure.array[index].stop - structure.array[index].start) + 1
// TODO: temporarily added, convert this to a function below.
-// TODO: also report: fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+// 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]);
#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); \
fl_fss
fl_status
fl_string
+fll_error
fll_execute
fll_fss
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_environment -lf_signal -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_path -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_execute -lfl_environment -lf_signal -lfll_error -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_path -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library firewall.c private-firewall.c
#endif
#ifndef _di_fss_basic_list_read_print_help_
- f_return_status fss_basic_list_read_print_help(const f_color_context_t context) {
+ f_return_status fss_basic_list_read_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_basic_list_read_name_long, fss_basic_list_read_version);
+ fll_program_print_help_header(id, context, fss_basic_list_read_name_long, fss_basic_list_read_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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_usage(context, fss_basic_list_read_name, "filename(s)");
+ fll_program_print_help_usage(id, context, fss_basic_list_read_name, "filename(s)");
fl_color_print(f_type_output, context.set.important, " Notes:");
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark };
- const f_console_parameter_ids_t choices = { ids, 3 };
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_list_read_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark };
+ const f_console_parameter_ids_t choices = { ids, 3 };
- if (F_status_is_error(status)) {
- fss_basic_list_read_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_basic_list_read_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_basic_list_read_parameter_verbosity_quiet, fss_basic_list_read_parameter_verbosity_normal, fss_basic_list_read_parameter_verbosity_verbose, fss_basic_list_read_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_basic_list_read_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_basic_list_read_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_basic_list_read_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_basic_list_read_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_basic_list_read_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_basic_list_read_parameter_help].result == f_console_result_found) {
- fss_basic_list_read_print_help(data->context);
+ fss_basic_list_read_print_help(data->output, data->context);
fss_basic_list_read_delete_data(data);
return status;
}
if (data->parameters[fss_basic_list_read_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_basic_list_read_version);
+ fll_program_print_version(data->output, fss_basic_list_read_version);
fss_basic_list_read_delete_data(data);
return status;
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_at);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a string.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
fss_basic_list_read_delete_data(data);
return F_status_set_error(F_parameter);
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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_additional) {
if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter requires a positive number.");
+ 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]);
macro_fss_basic_list_read_depths_t_delete_simple(depths);
fss_basic_list_read_delete_data(data);
macro_fss_basic_list_read_depths_t_delete_simple(depths);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify one or more files.");
+ 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]);
status = F_status_set_error(F_parameter);
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/execute.h>
#include <level_2/file.h>
#include <level_2/fss_basic_list.h>
fss_basic_list_read_parameter_light,
fss_basic_list_read_parameter_dark,
fss_basic_list_read_parameter_no_color,
+ fss_basic_list_read_parameter_verbosity_quiet,
+ fss_basic_list_read_parameter_verbosity_normal,
+ fss_basic_list_read_parameter_verbosity_verbose,
+ fss_basic_list_read_parameter_verbosity_debug,
fss_basic_list_read_parameter_version,
fss_basic_list_read_parameter_at,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_basic_list_read_short_at, fss_basic_list_read_long_at, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_read_short_depth, fss_basic_list_read_long_depth, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_read_short_trim, fss_basic_list_read_long_trim, 0, F_false, f_console_type_normal), \
}
- #define fss_basic_list_read_total_parameters 14
+ #define fss_basic_list_read_total_parameters 18
#endif // _di_fss_basic_list_read_defines_
#ifndef _di_fss_basic_list_read_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_string_dynamic_t buffer;
f_fss_objects_t objects;
fss_basic_list_read_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_string_dynamic_t_initialize, \
f_fss_objects_t_initialize, \
f_fss_contents_t_initialize, \
* F_none on success.
*/
#ifndef _di_fss_basic_list_read_print_help_
- extern f_return_status fss_basic_list_read_print_help(const f_color_context_t context);
+ extern f_return_status fss_basic_list_read_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_basic_list_read_print_help_
/**
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(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
}
#endif // _di_fss_basic_list_read_print_file_error_
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(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
else if (status == F_number) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_underflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too small for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_overflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too large for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_negative) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_positive) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' contains a '");
- fl_color_print(f_type_error, context.set.notable, "+");
- fl_color_print(f_type_error, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_data_not) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "' must not be an empty string.");
+ 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]);
}
else {
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print(f_type_error, context.set.error, "' for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(f_type_error, context.set.error, "' with the value '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
}
#endif // _di_fss_basic_list_read_print_number_argument_error_
macro_fss_basic_list_read_depths_t_new(status, (*depths), depth_size);
if (F_status_is_error(status)) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
return status;
}
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, 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(f_type_error, data.context.set.error, "ERROR: Unable to process '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_trim);
- fl_color_print_line(f_type_error, data.context.set.error, "' because the maximum buffer size was reached.");
+ 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]);
}
else {
f_string_t function = "fl_string_append";
function = "fl_string_rip";
}
- fl_color_print(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data.context.set.notable, "%u", status_code);
- fl_color_print(f_type_error, data.context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data.context.set.notable, "%s()", function);
- fl_color_print_line(f_type_error, data.context.set.error, ".");
+ 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]);
}
return status;
}
if (!depths->array[i].value_name.used) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name);
- fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string.");
+ 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]);
return F_status_set_error(F_parameter);
}
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' may only be specified once for the parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth);
- fl_color_print(f_type_error, data.context.set.error, "' may not have the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' before the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[j].depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_basic_list_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, 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(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data->context.set.notable, "%u", status);
- fl_color_print(f_type_error, data->context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_basic_list_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return F_status_set_error(status);
fl_print
fl_status
fl_string
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_list_read.c private-fss_basic_list_read.c
#endif
#ifndef _di_fss_basic_list_write_print_help_
- f_return_status fss_basic_list_write_print_help(const f_color_context_t context) {
+ f_return_status fss_basic_list_write_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_basic_list_write_name_long, fss_basic_list_write_version);
+ fll_program_print_help_header(id, context, fss_basic_list_write_name_long, fss_basic_list_write_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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(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_usage(context, fss_basic_list_write_name, "");
+ fll_program_print_help_usage(id, context, fss_basic_list_write_name, "");
return F_none;
}
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_list_write_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- fss_basic_list_write_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_basic_list_write_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_basic_list_write_parameter_verbosity_quiet, fss_basic_list_write_parameter_verbosity_normal, fss_basic_list_write_parameter_verbosity_verbose, fss_basic_list_write_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_basic_list_write_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_basic_list_write_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_basic_list_write_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_basic_list_write_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_basic_list_write_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_basic_list_write_parameter_help].result == f_console_result_found) {
- fss_basic_list_write_print_help(data->context);
+ fss_basic_list_write_print_help(data->output, data->context);
fss_basic_list_write_delete_data(data);
return status;
}
if (data->parameters[fss_basic_list_write_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_basic_list_write_version);
+ fll_program_print_version(data->output, fss_basic_list_write_version);
fss_basic_list_write_delete_data(data);
return status;
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
+ 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]);
}
else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to find the file '%s'", "-");
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: Unable to open the file '%s'", "-");
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'", "-");
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
f_file_close(&output.id);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
+ 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]);
}
else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to find the file '%s'", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
+ 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]);
}
else if (status == F_file_open) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to open the file '%s'", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
+ 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]);
}
else if (status == F_file_descriptor) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()");
+ 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]);
}
else if (status == F_file_write) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to write to the file '%s'", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/fss_status.h>
#include <level_2/program.h>
fss_basic_list_write_parameter_light,
fss_basic_list_write_parameter_dark,
fss_basic_list_write_parameter_no_color,
+ fss_basic_list_write_parameter_verbosity_quiet,
+ fss_basic_list_write_parameter_verbosity_normal,
+ fss_basic_list_write_parameter_verbosity_verbose,
+ fss_basic_list_write_parameter_verbosity_debug,
fss_basic_list_write_parameter_version,
fss_basic_list_write_parameter_content,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_basic_list_write_short_content, fss_basic_list_write_long_content, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_write_short_double, fss_basic_list_write_long_double, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_list_write_short_single, fss_basic_list_write_long_single, 0, F_true, f_console_type_normal), \
}
- #define fss_basic_list_write_total_parameters 11
+ #define fss_basic_list_write_total_parameters 15
#endif // _di_fss_basic_list_write_defines_
#ifndef _di_fss_basic_list_write_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_color_context_t context;
} fss_basic_list_write_data_t;
fss_basic_list_write_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_color_context_t_initialize, \
}
#endif // _di_fss_basic_list_write_data_t_
* F_none on success.
*/
#ifndef _di_fss_basic_list_write_print_help_
- extern f_return_status fss_basic_list_write_print_help(const f_color_context_t context);
+ extern f_return_status fss_basic_list_write_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_basic_list_write_print_help_
/**
fl_fss
fl_status
fl_string
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_list_write.c
#endif
#ifndef _di_fss_basic_read_print_help_
- f_return_status fss_basic_read_print_help(const f_color_context_t context) {
+ f_return_status fss_basic_read_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_basic_read_name_long, fss_basic_read_version);
+ fll_program_print_help_header(id, context, fss_basic_read_name_long, fss_basic_read_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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_usage(context, fss_basic_read_name, "filename(s)");
+ fll_program_print_help_usage(id, context, fss_basic_read_name, "filename(s)");
fl_color_print(f_type_output, context.set.important, " Notes:");
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_read_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- fss_basic_read_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_basic_read_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_basic_read_parameter_verbosity_quiet, fss_basic_read_parameter_verbosity_normal, fss_basic_read_parameter_verbosity_verbose, fss_basic_read_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_basic_read_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_basic_read_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_basic_read_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_basic_read_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_basic_read_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_basic_read_parameter_help].result == f_console_result_found) {
- fss_basic_read_print_help(data->context);
+ fss_basic_read_print_help(data->output, data->context);
fss_basic_read_delete_data(data);
return status;
}
if (data->parameters[fss_basic_read_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_basic_read_version);
+ fll_program_print_version(data->output, fss_basic_read_version);
fss_basic_read_delete_data(data);
return status;
if (data->remaining.used > 0 || data->process_pipe) {
if (data->parameters[fss_basic_read_parameter_at].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_at);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a string.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
fss_basic_read_delete_data(data);
return F_status_set_error(F_parameter);
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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.");
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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_additional) {
if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter requires a positive number.");
+ 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]);
macro_fss_basic_read_depths_t_delete_simple(depths);
fss_basic_read_delete_data(data);
macro_fss_basic_read_depths_t_delete_simple(depths);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify one or more files.");
+ 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]);
status = F_status_set_error(F_parameter);
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/execute.h>
#include <level_2/file.h>
#include <level_2/fss_basic.h>
fss_basic_read_parameter_light,
fss_basic_read_parameter_dark,
fss_basic_read_parameter_no_color,
+ fss_basic_read_parameter_verbosity_quiet,
+ fss_basic_read_parameter_verbosity_normal,
+ fss_basic_read_parameter_verbosity_verbose,
+ fss_basic_read_parameter_verbosity_debug,
fss_basic_read_parameter_version,
fss_basic_read_parameter_at,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_basic_read_short_at, fss_basic_read_long_at, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_read_short_depth, fss_basic_read_long_depth, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_read_short_trim, fss_basic_read_long_trim, 0, F_false, f_console_type_normal), \
}
- #define fss_basic_read_total_parameters 14
+ #define fss_basic_read_total_parameters 18
#endif // _di_fss_basic_read_defines_
#ifndef _di_fss_basic_read_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_string_dynamic_t buffer;
f_fss_objects_t objects;
fss_basic_read_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_string_dynamic_t_initialize, \
f_fss_objects_t_initialize, \
f_fss_contents_t_initialize, \
* F_none on success.
*/
#ifndef _di_fss_basic_read_print_help_
- extern f_return_status fss_basic_read_print_help(const f_color_context_t context);
+ extern f_return_status fss_basic_read_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_basic_read_print_help_
/**
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(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
}
#endif // _di_fss_basic_read_print_file_error_
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(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
else if (status == F_number) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_underflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too small for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_overflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too large for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_negative) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_positive) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' contains a '");
- fl_color_print(f_type_error, context.set.notable, "+");
- fl_color_print(f_type_error, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_data_not) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "' must not be an empty string.");
+ 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]);
}
else {
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print(f_type_error, context.set.error, "' for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(f_type_error, context.set.error, "' with the value '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
}
#endif // _di_fss_basic_read_print_number_argument_error_
macro_fss_basic_read_depths_t_new(status, (*depths), depth_size);
if (F_status_is_error(status)) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
return status;
}
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, 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(f_type_error, data.context.set.error, "ERROR: Unable to process '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_trim);
- fl_color_print_line(f_type_error, data.context.set.error, "' because the maximum buffer size was reached.");
+ 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]);
}
else {
f_string_t function = "fl_string_append";
function = "fl_string_rip";
}
- fl_color_print(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data.context.set.notable, "%u", status_code);
- fl_color_print(f_type_error, data.context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data.context.set.notable, "%s()", function);
- fl_color_print_line(f_type_error, data.context.set.error, ".");
+ 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]);
}
return status;
}
if (!depths->array[i].value_name.used) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name);
- fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string.");
+ 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]);
return F_status_set_error(F_parameter);
}
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' may only be specified once for the parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth);
- fl_color_print(f_type_error, data.context.set.error, "' may not have the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' before the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[j].depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_basic_list_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, 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(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data->context.set.notable, "%u", status);
- fl_color_print(f_type_error, data->context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_basic_list_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return F_status_set_error(status);
fl_print
fl_status
fl_string
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_read.c private-fss_basic_read.c
#endif
#ifndef _di_fss_basic_write_print_help_
- f_return_status fss_basic_write_print_help(const f_color_context_t context) {
+ f_return_status fss_basic_write_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_basic_write_name_long, fss_basic_write_version);
+ fll_program_print_help_header(id, context, fss_basic_write_name_long, fss_basic_write_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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(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_usage(context, fss_basic_write_name, "");
+ fll_program_print_help_usage(id, context, fss_basic_write_name, "");
return F_none;
}
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_basic_write_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- fss_basic_write_delete_data(data);
- return status;
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_basic_write_delete_data(data);
+ return status;
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_basic_write_parameter_verbosity_quiet, fss_basic_write_parameter_verbosity_normal, fss_basic_write_parameter_verbosity_verbose, fss_basic_write_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_basic_write_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_basic_write_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_basic_write_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_basic_write_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_basic_write_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_basic_write_parameter_help].result == f_console_result_found) {
- fss_basic_write_print_help(data->context);
+ fss_basic_write_print_help(data->output, data->context);
fss_basic_write_delete_data(data);
return status;
}
if (data->parameters[fss_basic_write_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_basic_write_version);
+ fll_program_print_version(data->output, fss_basic_write_version);
fss_basic_write_delete_data(data);
return status;
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
+ 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]);
}
else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to find the file '%s'", "-");
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: Unable to open the file '%s'", "-");
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'", "-");
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(input);
f_file_close(&output.id);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
+ 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]);
}
else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to find the file '%s'", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
+ 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]);
}
else if (status == F_file_open) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to open the file '%s'", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
+ 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]);
}
else if (status == F_file_descriptor) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()");
+ 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]);
}
else if (status == F_file_write) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to write to the file '%s'", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/fss_status.h>
#include <level_2/program.h>
fss_basic_write_parameter_light,
fss_basic_write_parameter_dark,
fss_basic_write_parameter_no_color,
+ fss_basic_write_parameter_verbosity_quiet,
+ fss_basic_write_parameter_verbosity_normal,
+ fss_basic_write_parameter_verbosity_verbose,
+ fss_basic_write_parameter_verbosity_debug,
fss_basic_write_parameter_version,
fss_basic_write_parameter_content,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_basic_write_short_content, fss_basic_write_long_content, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_write_short_double, fss_basic_write_long_double, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_basic_write_short_single, fss_basic_write_long_single, 0, F_true, f_console_type_normal), \
}
- #define fss_basic_write_total_parameters 11
+ #define fss_basic_write_total_parameters 15
#endif // _di_fss_basic_write_defines_
#ifndef _di_fss_basic_write_data_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_color_context_t context;
} fss_basic_write_data;
fss_basic_write_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_color_context_t_initialize, \
}
#endif // _di_fss_basic_write_data_
* F_none on success.
*/
#ifndef _di_fss_basic_write_print_help_
- extern f_return_status fss_basic_write_print_help(const f_color_context_t context);
+ extern f_return_status fss_basic_write_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_basic_write_print_help_
/**
fl_fss
fl_status
fl_string
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_write.c
#endif
#ifndef _di_fss_extended_list_read_print_help_
- f_return_status fss_extended_list_read_print_help(const f_color_context_t context) {
+ f_return_status fss_extended_list_read_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_extended_list_read_name_long, fss_extended_list_read_version);
+ fll_program_print_help_header(id, context, fss_extended_list_read_name_long, fss_extended_list_read_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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_usage(context, fss_extended_list_read_name, "filename(s)");
+ fll_program_print_help_usage(id, context, fss_extended_list_read_name, "filename(s)");
fl_color_print(f_type_output, context.set.important, " Notes:");
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_extended_list_read_parameter_no_color, fss_extended_list_read_parameter_light, fss_extended_list_read_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_extended_list_read_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_extended_list_read_parameter_no_color, fss_extended_list_read_parameter_light, fss_extended_list_read_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- fss_extended_list_read_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_extended_list_read_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_extended_list_read_parameter_verbosity_quiet, fss_extended_list_read_parameter_verbosity_normal, fss_extended_list_read_parameter_verbosity_verbose, fss_extended_list_read_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_extended_list_read_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_extended_list_read_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_extended_list_read_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_extended_list_read_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_extended_list_read_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_extended_list_read_parameter_help].result == f_console_result_found) {
- fss_extended_list_read_print_help(data->context);
+ fss_extended_list_read_print_help(data->output, data->context);
fss_extended_list_write_delete_data(data);
return F_none;
}
if (data->parameters[fss_extended_list_read_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_extended_list_read_version);
+ fll_program_print_version(data->output, fss_extended_list_read_version);
fss_extended_list_write_delete_data(data);
return F_none;
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_at);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a string.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
fss_extended_list_read_delete_data(data);
return F_status_set_error(F_parameter);
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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_additional) {
if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter requires a positive number.");
+ 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]);
macro_fss_extended_list_read_depths_t_delete_simple(depths);
fss_extended_list_read_delete_data(data);
macro_fss_extended_list_read_depths_t_delete_simple(depths);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify one or more files.");
+ 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]);
status = F_status_set_error(F_parameter);
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/execute.h>
#include <level_2/file.h>
#include <level_2/fss_extended_list.h>
fss_extended_list_read_parameter_light,
fss_extended_list_read_parameter_dark,
fss_extended_list_read_parameter_no_color,
+ fss_extended_list_read_parameter_verbosity_quiet,
+ fss_extended_list_read_parameter_verbosity_normal,
+ fss_extended_list_read_parameter_verbosity_verbose,
+ fss_extended_list_read_parameter_verbosity_debug,
fss_extended_list_read_parameter_version,
fss_extended_list_read_parameter_at,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_extended_list_read_short_at, fss_extended_list_read_long_at, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_list_read_short_depth, fss_extended_list_read_long_depth, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_list_read_short_trim, fss_extended_list_read_long_trim, 0, F_false, f_console_type_normal), \
}
- #define fss_extended_list_read_total_parameters 14
+ #define fss_extended_list_read_total_parameters 18
#endif // _di_fss_extended_list_read_defines_
#ifndef _di_fss_extended_list_read_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_string_dynamic_t buffer;
f_fss_nest_t nest;
fss_extended_list_read_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_string_dynamic_t_initialize, \
f_fss_nest_t_initialize, \
f_string_quantity_t_initialize, \
* F_none on success.
*/
#ifndef _di_fss_extended_list_read_print_help_
- extern f_return_status fss_extended_list_read_print_help(const f_color_context_t context);
+ extern f_return_status fss_extended_list_read_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_extended_list_read_print_help_
/**
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(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
}
#endif // _di_fss_extended_list_read_print_file_error_
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(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
else if (status == F_number) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_underflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too small for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_overflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too large for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_negative) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_positive) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' contains a '");
- fl_color_print(f_type_error, context.set.notable, "+");
- fl_color_print(f_type_error, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_data_not) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "' must not be an empty string.");
+ 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]);
}
else {
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print(f_type_error, context.set.error, "' for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(f_type_error, context.set.error, "' with the value '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
}
#endif // _di_fss_extended_list_read_print_number_argument_error_
macro_fss_extended_list_read_depths_t_new(status, (*depths), depth_size);
if (F_status_is_error(status)) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
return status;
}
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, 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(f_type_error, data.context.set.error, "ERROR: Unable to process '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_trim);
- fl_color_print_line(f_type_error, data.context.set.error, "' because the maximum buffer size was reached.");
+ 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]);
}
else {
f_string_t function = "fl_string_append";
function = "fl_string_rip";
}
- fl_color_print(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data.context.set.notable, "%u", status_code);
- fl_color_print(f_type_error, data.context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data.context.set.notable, "%s()", function);
- fl_color_print_line(f_type_error, data.context.set.error, ".");
+ 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]);
}
return status;
}
if (!depths->array[i].value_name.used) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name);
- fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string.");
+ 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]);
return F_status_set_error(F_parameter);
}
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' may only be specified once for the parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth);
- fl_color_print(f_type_error, data.context.set.error, "' may not have the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' before the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[j].depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_extended_list_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, 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(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data->context.set.notable, "%u", status);
- fl_color_print(f_type_error, data->context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_extended_list_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return F_status_set_error(status);
fl_print
fl_status
fl_string
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_conversion -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_list_read.c private-fss_extended_list_read.c
#endif
#ifndef _di_fss_extended_read_print_help_
- f_return_status fss_extended_read_print_help(const f_color_context_t context) {
+ f_return_status fss_extended_read_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_extended_read_name_long, fss_extended_read_version);
+ fll_program_print_help_header(id, context, fss_extended_read_name_long, fss_extended_read_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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_usage(context, fss_extended_read_name, "filename(s)");
+ fll_program_print_help_usage(id, context, fss_extended_read_name, "filename(s)");
fl_color_print(f_type_output, context.set.important, " Notes:");
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_extended_read_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- fss_extended_read_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_extended_read_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_extended_read_parameter_verbosity_quiet, fss_extended_read_parameter_verbosity_normal, fss_extended_read_parameter_verbosity_verbose, fss_extended_read_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_extended_read_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_extended_read_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_extended_read_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_extended_read_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_extended_read_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_extended_read_parameter_help].result == f_console_result_found) {
- fss_extended_read_print_help(data->context);
+ fss_extended_read_print_help(data->output, data->context);
fss_extended_read_delete_data(data);
return F_none;
}
if (data->parameters[fss_extended_read_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_extended_read_version);
+ fll_program_print_version(data->output, fss_extended_read_version);
fss_extended_read_delete_data(data);
return F_none;
if (data->remaining.used > 0 || data->process_pipe) {
if (data->parameters[fss_extended_read_parameter_at].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_at);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a string.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
+ 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]);
fss_extended_read_delete_data(data);
return F_status_set_error(F_parameter);
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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_additional) {
if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter requires a positive number.");
+ 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]);
macro_fss_extended_read_depths_t_delete_simple(depths);
fss_extended_read_delete_data(data);
macro_fss_extended_read_depths_t_delete_simple(depths);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify one or more files.");
+ 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]);
status = F_status_set_error(F_parameter);
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/execute.h>
#include <level_2/file.h>
#include <level_2/fss_extended.h>
fss_extended_read_parameter_light,
fss_extended_read_parameter_dark,
fss_extended_read_parameter_no_color,
+ fss_extended_read_parameter_verbosity_quiet,
+ fss_extended_read_parameter_verbosity_normal,
+ fss_extended_read_parameter_verbosity_verbose,
+ fss_extended_read_parameter_verbosity_debug,
fss_extended_read_parameter_version,
fss_extended_read_parameter_at,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_extended_read_short_at, fss_extended_read_long_at, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_read_short_depth, fss_extended_read_long_depth, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_read_short_trim, fss_extended_read_long_trim, 0, F_false, f_console_type_normal), \
}
- #define fss_extended_read_total_parameters 14
+ #define fss_extended_read_total_parameters 18
#endif // _di_fss_extended_read_defines_
#ifndef _di_fss_extended_read_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_string_dynamic_t buffer;
f_fss_objects_t objects;
fss_extended_read_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_string_dynamic_t_initialize, \
f_fss_objects_t_initialize, \
f_fss_contents_t_initialize, \
* F_none on success.
*/
#ifndef _di_fss_extended_read_print_help_
- extern f_return_status fss_extended_read_print_help(const f_color_context_t context);
+ extern f_return_status fss_extended_read_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_extended_read_print_help_
/**
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(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
}
#endif // _di_fss_extended_read_print_file_error_
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(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
else if (status == F_number) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_underflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too small for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_overflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too large for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_negative) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_positive) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' contains a '");
- fl_color_print(f_type_error, context.set.notable, "+");
- fl_color_print(f_type_error, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_data_not) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print_line(f_type_error, context.set.error, "' must not be an empty string.");
+ 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]);
}
else {
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function_name);
- fl_color_print(f_type_error, context.set.error, "' for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(f_type_error, context.set.error, "' with the value '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
}
#endif // _di_fss_extended_read_print_number_argument_error_
macro_fss_extended_read_depths_t_new(status, (*depths), depth_size);
if (F_status_is_error(status)) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
return status;
}
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, 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(f_type_error, data.context.set.error, "ERROR: Unable to process '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_trim);
- fl_color_print_line(f_type_error, data.context.set.error, "' because the maximum buffer size was reached.");
+ 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]);
}
else {
f_string_t function = "fl_string_append";
function = "fl_string_rip";
}
- fl_color_print(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data.context.set.notable, "%u", status_code);
- fl_color_print(f_type_error, data.context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data.context.set.notable, "%s()", function);
- fl_color_print_line(f_type_error, data.context.set.error, ".");
+ 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]);
}
return status;
}
if (!depths->array[i].value_name.used) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name);
- fl_color_print_line(f_type_error, data.context.set.error, "' must not be an empty string.");
+ 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]);
return F_status_set_error(F_parameter);
}
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' may only be specified once for the parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth);
- fl_color_print(f_type_error, data.context.set.error, "' may not have the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth);
- fl_color_print(f_type_error, data.context.set.error, "' before the value '");
- fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[j].depth);
- fl_color_print_line(f_type_error, data.context.set.error, "'.");
+ 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]);
return F_status_set_error(F_parameter);
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_extended_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data->error.to, 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(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(f_type_error, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
- fl_color_print(f_type_error, data->context.set.notable, "%d", input.start);
- fl_color_print_line(f_type_error, data->context.set.error, ").");
+ 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]);
}
else {
- fl_color_print(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(f_type_error, data->context.set.notable, "%u", status);
- fl_color_print(f_type_error, data->context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, data->context.set.notable, "fll_fss_extended_read()");
- fl_color_print(f_type_error, data->context.set.error, " for the file '");
- fl_color_print(f_type_error, data->context.set.notable, "%s", filename);
- fl_color_print_line(f_type_error, data->context.set.error, "'.");
+ 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]);
}
return F_status_set_error(status);
fl_print
fl_status
fl_string
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lfl_conversion -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_print -lfl_fss -lfl_console -lfl_conversion -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_read.c private-fss_extended_read.c
#endif
#ifndef _di_fss_extended_write_print_help_
- f_return_status fss_extended_write_print_help(const f_color_context_t context) {
+ f_return_status fss_extended_write_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_extended_write_name_long, fss_extended_write_version);
+ fll_program_print_help_header(id, context, fss_extended_write_name_long, fss_extended_write_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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(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_usage(context, fss_extended_write_name, "");
+ fll_program_print_help_usage(id, context, fss_extended_write_name, "");
return F_none;
}
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_extended_write_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- fss_extended_write_delete_data(data);
- return status;
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_extended_write_delete_data(data);
+ return status;
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_extended_write_parameter_verbosity_quiet, fss_extended_write_parameter_verbosity_normal, fss_extended_write_parameter_verbosity_verbose, fss_extended_write_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_extended_write_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_extended_write_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_extended_write_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_extended_write_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_extended_write_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_extended_write_parameter_help].result == f_console_result_found) {
- fss_extended_write_print_help(data->context);
+ fss_extended_write_print_help(data->output, data->context);
fss_extended_write_delete_data(data);
return F_none;
}
if (data->parameters[fss_extended_write_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_extended_write_version);
+ fll_program_print_version(data->output, fss_extended_write_version);
fss_extended_write_delete_data(data);
return F_none;
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
+ 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]);
}
else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to find the file '%s'", "-");
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: Unable to open the file '%s'", "-");
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'", "-");
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(input);
f_file_close(&output.id);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
+ 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]);
}
else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to find the file '%s'", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
+ 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]);
}
else if (status == F_file_open) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to open the file '%s'", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
+ 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]);
}
else if (status == F_file_descriptor) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()");
+ 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]);
}
else if (status == F_file_write) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: Unable to write to the file '%s'", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
+ 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]);
}
else {
- fl_color_print_line(f_type_error, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()", status);
+ 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]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/fss_status.h>
#include <level_2/program.h>
fss_extended_write_parameter_light,
fss_extended_write_parameter_dark,
fss_extended_write_parameter_no_color,
+ fss_extended_write_parameter_verbosity_quiet,
+ fss_extended_write_parameter_verbosity_normal,
+ fss_extended_write_parameter_verbosity_verbose,
+ fss_extended_write_parameter_verbosity_debug,
fss_extended_write_parameter_version,
fss_extended_write_parameter_content,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_extended_write_short_content, fss_extended_write_long_content, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_write_short_double, fss_extended_write_long_double, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(fss_extended_write_short_single, fss_extended_write_long_single, 0, F_true, f_console_type_normal), \
}
- #define fss_extended_write_total_parameters 11
+ #define fss_extended_write_total_parameters 15
#endif // _di_fss_extended_write_defines_
#ifndef _di_fss_extended_write_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_color_context_t context;
} fss_extended_write_data_t;
fss_extended_write_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_color_context_t_initialize, \
}
#endif // _di_fss_extended_write_data_t_
* F_none on success.
*/
#ifndef _di_fss_extended_write_print_help_
- extern f_return_status fss_extended_write_print_help(const f_color_context_t context);
+ extern f_return_status fss_extended_write_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_extended_write_print_help_
/**
fl_fss
fl_status
fl_string
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_fss -lfl_conversion -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_fss -lfl_conversion -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_write.c
#endif
#ifndef _di_fss_status_code_print_help_
- f_return_status fss_status_code_print_help(const f_color_context_t context) {
+ f_return_status fss_status_code_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, fss_status_code_name_long, fss_status_code_version);
+ fll_program_print_help_header(id, context, fss_status_code_name_long, fss_status_code_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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_usage(context, fss_status_code_name, "status code(s)");
+ fll_program_print_help_usage(id, context, fss_status_code_name, "status code(s)");
return F_none;
}
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, fss_status_code_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- fss_status_code_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ fss_status_code_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { fss_status_code_parameter_verbosity_quiet, fss_status_code_parameter_verbosity_normal, fss_status_code_parameter_verbosity_verbose, fss_status_code_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ fss_status_code_delete_data(data);
+ return status;
+ }
+
+ if (choice == fss_status_code_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == fss_status_code_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == fss_status_code_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == fss_status_code_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[fss_status_code_parameter_help].result == f_console_result_found) {
- fss_status_code_print_help(data->context);
+ fss_status_code_print_help(data->output, data->context);
fss_status_code_delete_data(data);
return F_none;
}
if (data->parameters[fss_status_code_parameter_version].result == f_console_result_found) {
- fll_program_print_version(fss_status_code_version);
+ fll_program_print_version(data->output, fss_status_code_version);
fss_status_code_delete_data(data);
return F_none;
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error);
- fl_color_print(f_type_error, data->context.set.error, "' cannot be used with the parameter ");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error);
- fl_color_print(f_type_error, data->context.set.error, "' cannot be used with the parameter ");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning);
- fl_color_print(f_type_error, data->context.set.error, "' cannot be used with the parameter ");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
fss_status_code_delete_data(data);
return F_status_set_error(status);
}
if (data->remaining.used == 0 && !data->process_pipe) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify an error code.");
+ fl_color_print_to(data->error.to, 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);
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/fss_status.h>
#include <level_2/program.h>
#include <level_2/status.h>
fss_status_code_parameter_light,
fss_status_code_parameter_dark,
fss_status_code_parameter_no_color,
+ fss_status_code_parameter_verbosity_quiet,
+ fss_status_code_parameter_verbosity_normal,
+ fss_status_code_parameter_verbosity_verbose,
+ fss_status_code_parameter_verbosity_debug,
fss_status_code_parameter_version,
fss_status_code_parameter_is_fine,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(fss_status_code_short_is_fine, fss_status_code_long_is_fine, 0, F_false, f_console_type_normal), \
f_console_parameter_t_initialize(fss_status_code_short_is_warning, fss_status_code_long_is_warning, 0, F_false, f_console_type_normal), \
f_console_parameter_t_initialize(fss_status_code_short_number, fss_status_code_long_number, 0, F_false, f_console_type_normal), \
}
- #define fss_status_code_total_parameters 9
+ #define fss_status_code_total_parameters 13
#endif // _di_fss_status_code_defines_
#ifndef _di_fss_status_code_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_color_context_t context;
} fss_status_code_data_t;
fss_status_code_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_color_context_t_initialize, \
}
#endif // _di_fss_status_code_data_t_
* F_none on success.
*/
#ifndef _di_fss_status_code_print_help_
- extern f_return_status fss_status_code_print_help(const f_color_context_t context);
+ extern f_return_status fss_status_code_print_help(const int id, const f_color_context_t context);
#endif // _di_fss_status_code_print_help_
/**
status = fl_conversion_string_to_number_unsigned(value, &number, range);
if (status == F_none) {
- fl_color_print_line(f_type_output, data.context.set.error, "invalid name");
+ fl_color_print(f_type_output, data.context.set.error, "invalid name%c", f_string_eol[0]);
return F_status_set_error(F_parameter);
}
if (status == F_data_not || F_status_set_fine(status) == F_parameter) {
- fl_color_print_line(f_type_output, data.context.set.error, "invalid data");
+ fl_color_print(f_type_output, data.context.set.error, "invalid data%c", f_string_eol[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- fl_color_print_line(f_type_output, data.context.set.error, "unknown name");
+ fl_color_print(f_type_output, data.context.set.error, "unknown name%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_output, data.context.set.error, "failed to convert");
+ fl_color_print(f_type_output, data.context.set.error, "failed to convert%c", f_string_eol[0]);
}
return status;
}
if (status == F_data) {
- fl_color_print_line(f_type_output, data.context.set.warning, "unknown code");
+ fl_color_print(f_type_output, data.context.set.warning, "unknown code%c", f_string_eol[0]);
return F_none;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- fl_color_print_line(f_type_output, data.context.set.error, "unknown code");
+ fl_color_print(f_type_output, data.context.set.error, "unknown code%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_output, data.context.set.error, "failed to convert");
+ fl_color_print(f_type_output, data.context.set.error, "failed to convert%c", f_string_eol[0]);
}
return status;
f_status_t status = fl_conversion_string_to_number_unsigned(value, number, range);
if (*number > F_status_size_max_with_signal) {
- fl_color_print_line(f_type_output, data.context.set.error, "out of range");
+ fl_color_print(f_type_output, data.context.set.error, "out of range%c", f_string_eol[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_number_negative) {
- fl_color_print_line(f_type_output, data.context.set.error, "out of range");
+ fl_color_print(f_type_output, data.context.set.error, "out of range%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_output, data.context.set.error, "invalid number");
+ fl_color_print(f_type_output, data.context.set.error, "invalid number%c", f_string_eol[0]);
}
return status;
fl_status
fl_string
fl_utf
+fll_error
fll_execute
fll_file
fll_fss
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_status -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_status -lfll_program -lfll_fss -lfll_file -lfl_directory -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_utf -lfl_string -lfl_status -lfl_fss -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_conversion -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_status_code.c private-fss_status_code.c
#endif
#ifndef _di_iki_read_print_help_
- f_return_status iki_read_print_help(const f_color_context_t context) {
+ f_return_status iki_read_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, iki_read_name_long, iki_read_version);
+ fll_program_print_help_header(id, context, iki_read_name_long, iki_read_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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_usage(context, iki_read_name, "filename(s)");
+ fll_program_print_help_usage(id, context, iki_read_name, "filename(s)");
fl_color_print(f_type_output, context.set.important, " Notes:");
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { iki_read_parameter_no_color, iki_read_parameter_light, iki_read_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, iki_read_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { iki_read_parameter_no_color, iki_read_parameter_light, iki_read_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true);
- if (data->verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ if (data->error.verbosity == f_console_verbosity_verbose) {
+ dprintf(data->error.to, "%c", f_string_eol[0]);
+ }
+
+ iki_read_delete_data(data);
+ return F_status_set_error(status);
}
+ }
- iki_read_delete_data(data);
- return F_status_set_error(status);
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { iki_read_parameter_verbosity_quiet, iki_read_parameter_verbosity_normal, iki_read_parameter_verbosity_verbose, iki_read_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
+
+ iki_read_delete_data(data);
+ return status;
+ }
+
+ if (choice == iki_read_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == iki_read_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == iki_read_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == iki_read_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[iki_read_parameter_help].result == f_console_result_found) {
- iki_read_print_help(data->context);
+ iki_read_print_help(data->output, data->context);
iki_read_delete_data(data);
return F_none;
}
if (data->parameters[iki_read_parameter_version].result == f_console_result_found) {
- fll_program_print_version(iki_read_version);
+ fll_program_print_version(data->output, iki_read_version);
iki_read_delete_data(data);
return F_none;
}
- if (data->parameters[iki_read_parameter_verbose].result == f_console_result_found) {
- if (data->parameters[iki_read_parameter_quiet].result == f_console_result_found) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, f_console_standard_long_verbose);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, f_console_standard_long_quiet);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
+ 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]);
+ }
status = F_status_set_error(F_parameter);
}
+ else if (data->parameters[iki_read_parameter_at].result == f_console_result_additional) {
+ const f_string_length_t index = data->parameters[iki_read_parameter_at].additional.array[data->parameters[iki_read_parameter_at].additional.used - 1];
+ const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index]));
- data->verbosity = f_console_verbosity_verbose;
- }
- else if (data->parameters[iki_read_parameter_quiet].result == f_console_result_found) {
- data->verbosity = f_console_verbosity_quiet;
- }
- else {
- data->verbosity = f_console_verbosity_normal;
- }
+ f_number_unsigned_t number = 0;
- if (F_status_is_fine(status)) {
- if (data->remaining.used > 0 || data->process_pipe) {
- if (data->parameters[iki_read_parameter_at].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
- }
+ status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range);
+
+ if (F_status_is_error(status)) {
+ iki_read_print_error_number_argument(data->context, data->error.verbosity, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", iki_read_long_line, arguments.argv[index]);
status = F_status_set_error(F_parameter);
}
- else if (data->parameters[iki_read_parameter_at].result == f_console_result_additional) {
- const f_string_length_t index = data->parameters[iki_read_parameter_at].additional.array[data->parameters[iki_read_parameter_at].additional.used - 1];
- const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index]));
- f_number_unsigned_t number = 0;
+ data->at = number;
- status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range);
+ 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.");
+ }
- if (F_status_is_error(status)) {
- iki_read_print_error_number_argument(data->context, data->verbosity, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", iki_read_long_line, arguments.argv[index]);
+ status = F_status_set_error(F_parameter);
+ }
+ }
- status = F_status_set_error(F_parameter);
- }
+ 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]);
+ }
- data->at = number;
+ status = F_status_set_error(F_parameter);
+ }
+ else if (data->parameters[iki_read_parameter_line].result == f_console_result_additional) {
+ const f_string_length_t index = data->parameters[iki_read_parameter_line].additional.array[data->parameters[iki_read_parameter_line].additional.used - 1];
+ const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index]));
- if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
+ f_number_unsigned_t number = 0;
- status = F_status_set_error(F_parameter);
- }
- }
+ status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range);
- if (data->parameters[iki_read_parameter_line].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_line);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a positive number.");
- }
+ if (F_status_is_error(status)) {
+ iki_read_print_error_number_argument(data->context, data->error.verbosity, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", iki_read_long_line, arguments.argv[index]);
status = F_status_set_error(F_parameter);
}
- else if (data->parameters[iki_read_parameter_line].result == f_console_result_additional) {
- const f_string_length_t index = data->parameters[iki_read_parameter_line].additional.array[data->parameters[iki_read_parameter_line].additional.used - 1];
- const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index]));
- f_number_unsigned_t number = 0;
+ data->line = number;
+ }
- status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range);
+ 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]);
+ }
- if (F_status_is_error(status)) {
- iki_read_print_error_number_argument(data->context, data->verbosity, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", iki_read_long_line, arguments.argv[index]);
+ status = F_status_set_error(F_parameter);
+ }
- status = F_status_set_error(F_parameter);
+ 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]);
}
- data->line = number;
+ status = F_status_set_error(F_parameter);
}
- if (data->parameters[iki_read_parameter_name].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_name);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires a string.");
+ 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]);
}
status = F_status_set_error(F_parameter);
}
+ }
- 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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute);
- fl_color_print_line(f_type_error, data->context.set.error, "' requires 3 strings.");
- }
-
- status = F_status_set_error(F_parameter);
+ 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]);
}
- if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
-
- status = F_status_set_error(F_parameter);
- }
+ status = F_status_set_error(F_parameter);
}
- 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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
-
- status = F_status_set_error(F_parameter);
+ 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]);
}
- if (data->parameters[iki_read_parameter_content].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
-
- status = F_status_set_error(F_parameter);
- }
+ status = F_status_set_error(F_parameter);
+ }
- if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
-
- status = F_status_set_error(F_parameter);
+ 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]);
}
- data->mode = iki_read_mode_literal;
+ status = F_status_set_error(F_parameter);
}
- 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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
-
- status = F_status_set_error(F_parameter);
- }
- if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
-
- status = F_status_set_error(F_parameter);
+ data->mode = iki_read_mode_literal;
+ }
+ 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]);
}
- data->mode = iki_read_mode_object;
- }
- else if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
- data->mode = iki_read_mode_total;
- }
- else {
- // this is the default behavior, so there is no reason to check for the -c/--content parameter.
- data->mode = iki_read_mode_content;
+ status = F_status_set_error(F_parameter);
}
- 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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_whole);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
- }
-
- status = F_status_set_error(F_parameter);
+ 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]);
}
+
+ status = F_status_set_error(F_parameter);
}
- if (F_status_is_error(status)) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ data->mode = iki_read_mode_object;
+ }
+ else if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
+ data->mode = iki_read_mode_total;
+ }
+ else {
+ // this is the default behavior, so there is no reason to check for the -c/--content parameter.
+ data->mode = iki_read_mode_content;
+ }
+
+ 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]);
}
- iki_read_delete_data(data);
- return F_status_set_error(F_parameter);
+ status = F_status_set_error(F_parameter);
}
+ }
- if (data->process_pipe) {
- f_file_t file = f_file_t_initialize;
+ if (F_status_is_error(status)) {
+ if (data->error.verbosity != f_console_verbosity_quiet) {
+ dprintf(data->error.to, "%c", f_string_eol[0]);
+ }
- file.id = f_type_descriptor_input;
+ iki_read_delete_data(data);
+ return F_status_set_error(F_parameter);
+ }
- status = f_file_read(file, &data->buffer);
+ if (data->process_pipe) {
+ f_file_t file = f_file_t_initialize;
- if (F_status_is_error(status)) {
- iki_read_print_error_file(data->context, data->verbosity, F_status_set_fine(status), "f_file_read", "-", "process", F_true, F_true);
- }
- else {
- status = iki_read_process_buffer(arguments, "-", data);
- }
+ file.id = f_type_descriptor_input;
- // Clear buffers before continuing.
- f_macro_string_dynamic_t_delete_simple(data->buffer);
- }
+ status = f_file_read(file, &data->buffer);
- if (F_status_is_fine(status) && data->remaining.used > 0) {
- f_string_length_t i = 0;
- f_string_length_t total = 0;
- f_file_t file = f_file_t_initialize;
+ if (F_status_is_error(status)) {
+ iki_read_print_error_file(data->context, data->error.verbosity, F_status_set_fine(status), "f_file_read", "-", "process", F_true, F_true);
+ }
+ else {
+ status = iki_read_process_buffer(arguments, "-", data);
+ }
- for (; i < data->remaining.used; i++) {
- f_macro_file_t_reset(file);
- total = 0;
+ // Clear buffers before continuing.
+ f_macro_string_dynamic_t_delete_simple(data->buffer);
+ }
- status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file);
+ if (F_status_is_fine(status) && data->remaining.used > 0) {
+ f_string_length_t i = 0;
+ f_string_length_t total = 0;
+ f_file_t file = f_file_t_initialize;
- if (F_status_is_error(status)) {
- iki_read_print_error_file(data->context, data->verbosity, F_status_set_fine(status), "f_file_open", arguments.argv[data->remaining.array[i]], "process", F_true, F_true);
- break;
- }
+ for (; i < data->remaining.used; i++) {
+ f_macro_file_t_reset(file);
+ total = 0;
- status = f_file_size_by_id(file.id, &total);
+ status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file);
- if (F_status_is_error(status)) {
- iki_read_print_error_file(data->context, data->verbosity, F_status_set_fine(status), "f_file_size_by_id", arguments.argv[data->remaining.array[i]], "process", F_true, F_true);
+ if (F_status_is_error(status)) {
+ iki_read_print_error_file(data->context, data->error.verbosity, F_status_set_fine(status), "f_file_open", arguments.argv[data->remaining.array[i]], "process", F_true, F_true);
+ break;
+ }
- f_file_close(&file.id);
- break;
- }
+ status = f_file_size_by_id(file.id, &total);
- // Skip past empty files.
- if (!total) {
- f_file_close(&file.id);
- continue;
- }
+ if (F_status_is_error(status)) {
+ iki_read_print_error_file(data->context, data->error.verbosity, F_status_set_fine(status), "f_file_size_by_id", arguments.argv[data->remaining.array[i]], "process", F_true, F_true);
- status = f_file_read_until(file, total, &data->buffer);
+ f_file_close(&file.id);
+ break;
+ }
+ // Skip past empty files.
+ if (!total) {
f_file_close(&file.id);
+ continue;
+ }
- if (F_status_is_error(status)) {
- iki_read_print_error_file(data->context, data->verbosity, F_status_set_fine(status), "f_file_read_until", arguments.argv[data->remaining.array[i]], "process", F_true, F_true);
- break;
- }
+ status = f_file_read_until(file, total, &data->buffer);
- status = iki_read_process_buffer(arguments, arguments.argv[data->remaining.array[i]], data);
- if (F_status_is_error(status)) break;
+ f_file_close(&file.id);
- // Clear buffers before repeating the loop.
- f_macro_string_dynamic_t_delete_simple(data->buffer);
- } // for
- }
- }
- else {
- if (data->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: you failed to specify one or more files.");
- }
+ if (F_status_is_error(status)) {
+ iki_read_print_error_file(data->context, data->error.verbosity, F_status_set_fine(status), "f_file_read_until", arguments.argv[data->remaining.array[i]], "process", F_true, F_true);
+ break;
+ }
- status = F_status_set_error(F_parameter);
+ status = iki_read_process_buffer(arguments, arguments.argv[data->remaining.array[i]], data);
+ if (F_status_is_error(status)) break;
+
+ // Clear buffers before repeating the loop.
+ f_macro_string_dynamic_t_delete_simple(data->buffer);
+ } // for
+ }
+ }
+ 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]);
}
+
+ status = F_status_set_error(F_parameter);
}
// ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (data->verbosity != f_console_verbosity_quiet) {
+ if (data->error.verbosity != f_console_verbosity_quiet) {
if (F_status_is_error(status) || !data->mode) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data->error.to, "%c", f_string_eol[0]);
}
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/file.h>
#include <level_2/program.h>
iki_read_parameter_light,
iki_read_parameter_dark,
iki_read_parameter_no_color,
- iki_read_parameter_quiet,
- iki_read_parameter_verbose,
+ iki_read_parameter_verbosity_quiet,
+ iki_read_parameter_verbosity_normal,
+ iki_read_parameter_verbosity_verbose,
+ iki_read_parameter_verbosity_debug,
iki_read_parameter_version,
iki_read_parameter_at,
f_console_parameter_t_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, 0, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(iki_read_short_at, iki_read_long_at, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(iki_read_short_content, iki_read_long_content, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(iki_read_short_total, iki_read_long_total, 0, 0, f_console_type_normal), \
}
- #define iki_read_total_parameters 16
+ #define iki_read_total_parameters 17
#endif // _di_iki_read_defines_
#ifndef _di_iki_read_substitution_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
+
uint8_t mode;
f_number_unsigned_t at;
iki_read_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
0, \
0, \
0, \
* F_none on success.
*/
#ifndef _di_iki_read_print_help_
- extern f_return_status iki_read_print_help(const f_color_context_t context);
+ extern f_return_status iki_read_print_help(const int id, const f_color_context_t context);
#endif // _di_iki_read_print_help_
/**
if (status == F_parameter) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid parameter when calling function ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
if (status == F_memory_allocation || status == F_memory_reallocation) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Unable to allocate memory in function ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
if (status == F_buffer_too_large) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Maximum buffer limit reached while processing ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
if (status == F_string_too_large) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Maximum string limit reached while processing ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
}
if (fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") in function ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_unknown;
if (status == F_file_found_not) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to find %s '", file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_file_found) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: The %s '", file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "' already exists.");
+ 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]);
}
return F_false;
if (status == F_parameter) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print(f_type_error, context.set.error, "() for the %s '", file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_name) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid %s name '", file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_memory_out) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_number_overflow) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_directory) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_access_denied) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_loop) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Loop while trying to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_prohibited) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (is_file) {
if (status == F_directory_found_not) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "' due to an invalid directory in the path.");
+ 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]);
}
return F_false;
else {
if (status == F_directory_found_not) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "' due to an invalid directory in the path.");
+ 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]);
}
return F_false;
if (status == F_failure) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
}
if (iki_read_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") occurred while trying to %s %s '", operation, file_or_directory);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_true;
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;
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data.error.to, "%c", f_string_eol[0]);
if (status == F_parameter) {
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function);
- fl_color_print_line(f_type_error, context.set.error, ".");
+ 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]);
}
else if (status == F_number) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_underflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too small for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_overflow) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is too large for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_negative) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_number_positive) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The argument '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print(f_type_error, context.set.error, "' contains a '");
- fl_color_print(f_type_error, context.set.notable, "+");
- fl_color_print(f_type_error, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
else if (status == F_data_not) {
- fl_color_print(f_type_error, context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print_line(f_type_error, context.set.error, "' must not be an empty string.");
+ 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]);
}
else {
- fl_color_print(f_type_error, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") has occurred while calling ");
- fl_color_print(f_type_error, context.set.notable, "%s()", function);
- fl_color_print(f_type_error, context.set.error, "' for the parameter '");
- fl_color_print(f_type_error, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(f_type_error, context.set.error, "' with the value '");
- fl_color_print(f_type_error, context.set.notable, "%s", argument);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
}
#endif // _di_iki_read_print_error_number_argument_
status = fl_iki_read(&data->buffer, buffer_range, variable, vocabulary, content);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
return status;
}
status = iki_read_substitutions_identify(arguments, file_name, data, vocabulary, substitutionss);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
for (f_array_length_t i = 0; i < variable->used; i++) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
status = fl_string_append_nulless(arguments.argv[index], strlen(arguments.argv[index]), &name);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
for (f_array_length_t i = 0; i < variable->used; i++) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
status = fl_iki_read(&data->buffer, &range, variable, vocabulary, content);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
return status;
}
status = iki_read_substitutions_identify(arguments, file_name, data, vocabulary, substitutionss);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
for (f_array_length_t i = 0; i < variable->used; i++) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
if (name_missed) {
f_macro_memory_structure_macro_increment(status, names, 1, f_iki_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "iki_read_process_buffer_ranges_whole", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "iki_read_process_buffer_ranges_whole", F_true);
break;
}
status = fl_string_append_nulless(arguments.argv[index], length_argument, &names.array[names.used]);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
break;
}
status = fl_iki_read(&data->buffer, &range, variable, vocabulary, content);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
return status;
}
status = fl_string_append_nulless(arguments.argv[index], strlen(arguments.argv[index]), &name);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
+ iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
f_macro_string_dynamic_t_delete_simple(name);
return status;
fl_conversion
fl_iki
fl_string
+fll_error
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfl_string -lfl_iki -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_iki -lf_file -lf_conversion -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_error -lfl_string -lfl_iki -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_iki -lf_file -lf_conversion -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library iki_read.c private-iki_read.c
#endif
#ifndef _di_iki_write_print_help_
- f_return_status iki_write_print_help(const f_color_context_t context) {
+ f_return_status iki_write_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, iki_write_name_long, iki_write_version);
+ fll_program_print_help_header(id, context, iki_write_name_long, iki_write_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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(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_usage(context, iki_write_name, "filename(s)");
+ fll_program_print_help_usage(id, context, iki_write_name, "filename(s)");
fl_color_print(f_type_output, context.set.important, " Notes:");
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { iki_write_parameter_no_color, iki_write_parameter_light, iki_write_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, iki_write_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { iki_write_parameter_no_color, iki_write_parameter_light, iki_write_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- iki_write_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ 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]);
+ }
+
+ iki_write_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { iki_write_parameter_verbosity_quiet, iki_write_parameter_verbosity_normal, iki_write_parameter_verbosity_verbose, iki_write_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
- if (data->verbosity == f_console_verbosity_verbose) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ iki_write_delete_data(data);
+ return status;
}
- iki_write_delete_data(data);
- return F_status_set_error(status);
+ if (choice == iki_write_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == iki_write_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == iki_write_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == iki_write_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[iki_write_parameter_help].result == f_console_result_found) {
- iki_write_print_help(data->context);
+ iki_write_print_help(data->output, data->context);
iki_write_delete_data(data);
return F_none;
}
if (data->parameters[iki_write_parameter_version].result == f_console_result_found) {
- fll_program_print_version(iki_write_version);
+ fll_program_print_version(data->output, iki_write_version);
iki_write_delete_data(data);
return F_none;
}
- if (data->parameters[iki_write_parameter_verbose].result == f_console_result_found) {
- if (data->parameters[iki_write_parameter_quiet].result == f_console_result_found) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: Cannot specify the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, f_console_standard_long_verbose);
- fl_color_print(f_type_error, data->context.set.error, "' parameter with the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, f_console_standard_long_quiet);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameter.");
-
- status = F_status_set_error(F_parameter);
- }
-
- data->verbosity = f_console_verbosity_verbose;
- }
- else if (data->parameters[iki_write_parameter_quiet].result == f_console_result_found) {
- data->verbosity = f_console_verbosity_quiet;
- }
-
f_file_t output = f_file_t_initialize;
output.id = f_type_descriptor_output;
if (F_status_is_fine(status)) {
if (data->parameters[iki_write_parameter_file].result == f_console_result_additional) {
if (data->parameters[iki_write_parameter_file].additional.used > 1) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file);
- fl_color_print_line(f_type_error, data->context.set.error, "' may only be specified once.");
+ 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]);
}
status = F_status_set_error(F_parameter);
status = f_file_open(arguments.argv[location], f_file_mode_all_rw, &output);
if (F_status_is_error(status)) {
- iki_write_print_error_file(data->context, data->verbosity, F_status_set_fine(status), "f_file_open", arguments.argv[location], "open", 0, F_true);
+ iki_write_print_error_file(data->context, data->error.verbosity, F_status_set_fine(status), "f_file_open", arguments.argv[location], "open", 0, F_true);
}
}
}
else if (data->parameters[iki_write_parameter_file].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file);
- fl_color_print_line(f_type_error, data->context.set.error, "' was specified, but no value was given.");
+ 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]);
}
status = F_status_set_error(F_parameter);
}
if (F_status_is_fine(status) && data->parameters[iki_write_parameter_object].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object);
- fl_color_print_line(f_type_error, data->context.set.error, "' was specified, but no value was given.");
+ 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]);
}
status = F_status_set_error(F_parameter);
}
if (F_status_is_fine(status) && data->parameters[iki_write_parameter_content].result == f_console_result_found) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content);
- fl_color_print_line(f_type_error, data->context.set.error, "' was specified, but no value was given.");
+ 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]);
}
status = F_status_set_error(F_parameter);
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->verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data->context.set.error, "ERROR: No data provided, either pipe the data or use the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object);
- fl_color_print(f_type_error, data->context.set.error, "' and the '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content);
- fl_color_print_line(f_type_error, data->context.set.error, "' parameters.");
+ 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]);
}
status = F_status_set_error(F_parameter);
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->verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameters '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content);
- fl_color_print(f_type_error, data->context.set.error, "' and '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object);
- fl_color_print_line(f_type_error, data->context.set.error, "' must be specified the same number of times.");
+ 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]);
}
status = F_status_set_error(F_parameter);
status_pipe = f_file_read(file, &buffer);
if (F_status_is_error(status_pipe)) {
- iki_write_print_error_file(data->context, data->verbosity, F_status_set_fine(status_pipe), "f_file_read_to", "-", "read", 2, F_true);
+ iki_write_print_error_file(data->context, data->error.verbosity, F_status_set_fine(status_pipe), "f_file_read_to", "-", "read", 2, F_true);
status = F_status_set_error(F_pipe);
break;
}
if (!buffer.used) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: The pipe has no content.");
+ 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]);
}
status = F_status_set_error(F_parameter);
status = fl_string_dynamic_seek_line(buffer.string, &range);
if (F_status_is_error(status)) {
- iki_write_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_dynamic_seek_line", F_true);
+ iki_write_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_string_dynamic_seek_line", F_true);
break;
}
if (status == F_data_not_stop) {
status = F_status_set_error(F_parameter);
- iki_write_print_error(data->context, data->verbosity, F_parameter, "fl_string_dynamic_seek_line", F_true);
+ iki_write_print_error(data->context, data->error.verbosity, F_parameter, "fl_string_dynamic_seek_line", F_true);
break;
}
if (object_ended && previous == range.start) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: The pipe has incorrectly placed newlines.");
+ 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]);
}
status = F_status_set_error(F_parameter);
status = fl_string_dynamic_partial_append_nulless(buffer, range, &content);
if (F_status_is_error(status)) {
- iki_write_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
+ iki_write_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
break;
}
}
status = fl_string_dynamic_partial_append_nulless(buffer, range, &object);
if (F_status_is_error(status)) {
- iki_write_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
+ iki_write_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
break;
}
} // for
if (F_status_is_fine(status) && object_ended) {
- if (data->verbosity != f_console_verbosity_quiet) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: The pipe has an object without content.");
+ 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]);
}
status = F_status_set_error(F_parameter);
} // for
// ensure there is always a newline at the end, unless in quiet mode.
- if (F_status_is_fine(status) && data->verbosity != f_console_verbosity_quiet && data->parameters[iki_write_parameter_file].result == f_console_result_none) {
+ if (F_status_is_fine(status) && data->error.verbosity != f_console_verbosity_quiet && data->parameters[iki_write_parameter_file].result == f_console_result_none) {
fprintf(f_type_output, "%c", f_string_eol[0]);
}
}
}
// ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (data->verbosity != f_console_verbosity_quiet) {
+ if (data->error.verbosity != f_console_verbosity_quiet) {
if (F_status_is_error(status)) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
+ dprintf(data->error.to, "%c", f_string_eol[0]);
}
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/file.h>
#include <level_2/iki.h>
#include <level_2/program.h>
iki_write_parameter_light,
iki_write_parameter_dark,
iki_write_parameter_no_color,
- iki_write_parameter_quiet,
- iki_write_parameter_verbose,
+ iki_write_parameter_verbosity_quiet,
+ iki_write_parameter_verbosity_normal,
+ iki_write_parameter_verbosity_verbose,
+ iki_write_parameter_verbosity_debug,
iki_write_parameter_version,
iki_write_parameter_file,
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(iki_write_short_file, iki_write_long_file, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(iki_write_short_content, iki_write_long_content, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(iki_write_short_single, iki_write_long_single, 0, 0, f_console_type_normal), \
}
- #define iki_write_total_parameters 12
+ #define iki_write_total_parameters 14
#endif // _di_iki_write_defines_
#ifndef _di_iki_write_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_string_dynamic_t buffer;
iki_write_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_string_dynamic_t_initialize, \
f_color_context_t_initialize, \
}
* F_none on success.
*/
#ifndef _di_iki_write_print_help_
- extern f_return_status iki_write_print_help(const f_color_context_t context);
+ extern f_return_status iki_write_print_help(const int id, const f_color_context_t context);
#endif // _di_iki_write_print_help_
/**
if (status == F_parameter) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid parameter when calling function ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
if (status == F_memory_allocation || status == F_memory_reallocation) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Unable to allocate memory in function ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
if (status == F_buffer_too_large) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Maximum buffer limit reached while processing ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
if (status == F_string_too_large) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Maximum string limit reached while processing ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_none;
}
if (fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") in function ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print_line(f_type_error, context.set.error, "().");
+ 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]);
}
return F_unknown;
if (status == F_file_found_not) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to find %s '", type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_file_closed) {
if (verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: The %s '", type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "' is no longer open.");
+ 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]);
}
return F_false;
if (status == F_file_seek) {
if (verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, context.set.error, "ERROR: A seek error occurred while accessing the file '");
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_file_read) {
if (verbosity != f_console_verbosity_quiet) {
- fl_color_print(f_type_error, context.set.error, "ERROR: A read error occurred while accessing the file '");
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_file_found) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: The %s '", type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "' already exists.");
+ 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]);
}
return F_false;
if (status == F_parameter) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(f_type_error, context.set.notable, "%s", function);
- fl_color_print(f_type_error, context.set.error, "() for the %s '", type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_name) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid %s name '", type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_memory_out) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_number_overflow) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_directory) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_access_denied) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_loop) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Loop while trying to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (status == F_prohibited) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
if (!type) {
if (status == F_directory_found_not) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "' due to an invalid directory in the path.");
+ 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]);
}
return F_false;
else if (type == 1) {
if (status == F_directory_found_not) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "' due to an invalid directory in the path.");
+ 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]);
}
return F_false;
if (status == F_failure) {
if (verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "ERROR: Failed to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_false;
}
if (iki_write_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(f_type_error, context.set.notable, "%llu", status);
- fl_color_print(f_type_error, context.set.error, ") occurred while trying to %s %s '", operation, type_name);
- fl_color_print(f_type_error, context.set.notable, "%s", name);
- fl_color_print_line(f_type_error, context.set.error, "'.");
+ 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]);
}
return F_true;
f_return_status iki_write_process(const iki_write_data_t data, const f_string_static_t object, const f_string_static_t content, const uint8_t quote, const int output, f_string_dynamic_t *escaped) {
if (!object.used) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The object is missing, it must not have a length of ");
- fl_color_print(f_type_error, data.context.set.notable, "0");
- fl_color_print_line(f_type_error, data.context.set.error, ".");
+ 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]);
}
return F_status_set_error(F_failure);
f_status_t status = f_iki_object_is(object);
if (status == F_false) {
- if (data.verbosity != f_console_verbosity_quiet) {
- fprintf(f_type_error, "%c", f_string_eol[0]);
- fl_color_print(f_type_error, data.context.set.error, "ERROR: The object '");
+ 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 '");
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_line(f_type_error, data.context.set.error, "' is not a valid IKI object.");
+ fl_color_print_to(data.error.to, data.context.set.error, "' is not a valid IKI object.%c", f_string_eol[0]);
}
return F_status_set_error(F_failure);
}
else if (F_status_is_error(status)) {
- iki_write_print_error(data.context, data.verbosity, F_status_set_fine(status), "f_iki_object_is", F_true);
+ iki_write_print_error(data.context, data.error.verbosity, F_status_set_fine(status), "f_iki_object_is", F_true);
return F_status_set_error(F_failure);
}
status = fll_iki_content_escape(content, quote, escaped);
if (F_status_is_error(status)) {
- iki_write_print_error(data.context, data.verbosity, F_status_set_fine(status), "fll_iki_content_escape", F_true);
+ iki_write_print_error(data.context, data.error.verbosity, F_status_set_fine(status), "fll_iki_content_escape", F_true);
f_macro_string_dynamic_t_delete_simple((*escaped));
return F_status_set_error(F_failure);
fl_iki
fl_string
fll_iki
+fll_error
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_iki -lfl_string -lfl_iki -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_iki -lf_file -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_error -lfll_iki -lfl_string -lfl_iki -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_iki -lf_file -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library iki_write.c private-iki_write.c
#endif // _di_init_print_version_
#ifndef _di_init_print_help_
- f_return_status init_print_help(const f_color_context_t context) {
+ f_return_status init_print_help(const int id, const f_color_context_t context) {
- fll_program_print_help_header(context, init_name_long, init_version);
+ fll_program_print_help_header(id, context, init_name_long, init_version);
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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(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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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_usage(context, init_name, "");
+ fll_program_print_help_usage(id, context, init_name, "");
return F_none;
}
unsigned short do_socket_port = F_false;
{
- f_console_parameter_id_t ids[3] = { init_parameter_no_color, init_parameter_light, init_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, init_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { init_parameter_no_color, init_parameter_light, init_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- // @todo: init_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ // @todo: init_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { init_parameter_verbosity_quiet, init_parameter_verbosity_normal, init_parameter_verbosity_verbose, init_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ init_delete_data(data);
+ return status;
+ }
+
+ if (choice == init_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == init_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == init_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == init_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
+ if (data->parameters[init_parameter_help].result == f_console_result_found) {
+ init_print_help(data->output, data->context);
+
+ init_delete_data(data);
+ return F_none;
+ }
+
+ if (data->parameters[init_parameter_version].result == f_console_result_found) {
+ fll_program_print_version(data->output, init_version);
+
+ init_delete_data(data);
+ return F_none;
+ }
+
if (data->parameters[init_parameter_runlevel].result == f_console_result_found) {
const unsigned int parameter_length = strlen(arguments.argv[data->parameters[init_parameter_runlevel].additional.array[0]]);
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_line(f_type_error, data->context.set.error, "ERROR: Failed to clone services process (errno = %i).", errno);
+ 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]);
}
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_line(f_type_error, data->context.set.error, "ERROR: Failed to clone control via file process (errno = %i).", errno);
+ 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]);
}
*/
continue;
}
else if (errno != EINTR) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: sigwaitinfo() failed (errno = %i).", errno);
+ fl_color_print_to(data->error.to, 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_line(f_type_error, data->context.set.error, "ERROR: Max signal problem count has been reached, sleeping for a period of time.", errno);
+ 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]);
sleep(init_panic_signal_sleep_seconds);
signal_problem_count = 0;
}
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/execute.h>
#include <level_2/fss_basic_list.h>
#include <level_2/fss_extended.h>
init_parameter_light,
init_parameter_dark,
init_parameter_no_color,
- init_parameter_version,
+ init_parameter_verbosity_quiet,
+ init_parameter_verbosity_normal,
+ init_parameter_verbosity_verbose,
#ifdef _en_init_debug_
- init_parameter_debug,
+ init_parameter_verbosity_debug,
#endif // _en_init_debug_
+ init_parameter_version,
+
init_parameter_runlevel,
init_parameter_no_prepare,
};
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(init_parameter_runlevel_short_name, init_parameter_runlevel_long_name, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(init_parameter_no_prepare_short_name, init_parameter_no_prepare_long_name, 0, F_true, f_console_type_normal), \
}
- #define init_total_parameters 8
+ #define init_total_parameters 11
#else
#define init_console_parameter_t_initialize \
{ \
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(init_parameter_runlevel_short_name, init_parameter_runlevel_long_name, 0, F_true, f_console_type_normal), \
f_console_parameter_t_initialize(init_parameter_no_prepare_short_name, init_parameter_no_prepare_long_name, 0, F_true, f_console_type_normal), \
}
- #define init_total_parameters 7
+ #define init_total_parameters 10
#endif // _en_init_debug_
#endif // _di_init_defines_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_color_context_t context;
} init_data_t;
init_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_color_context_t_initialize, \
}
* F_none on success.
*/
#ifndef _di_init_print_help_
- extern f_return_status init_print_help(const f_color_context_t context);
+ extern f_return_status init_print_help(const int id, const f_color_context_t context);
#endif // _di_init_print_help_
/**
if (optional) {
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().");
+ 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]);
} else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().", status);
+ 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]);
}
} else {
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().");
+ 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]);
} else if (status == F_file_found_not) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Unable to find the file '%s'.", filename);
+ fl_color_print_to(data.error.to, 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_line(f_type_error, data.context.set.error, "ERROR: Unable to open the file '%s'.", filename);
+ fl_color_print_to(data.error.to, 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_line(f_type_error, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.", filename);
+ 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]);
} else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().", status);
+ 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]);
}
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read_until().");
+ 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]);
} else if (status == F_number_overflow) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.", filename);
+ 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]);
} else if (status == F_file_closed) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.", filename);
+ 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]);
} else if (status == F_file_seek) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.", filename);
+ 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]);
} else if (status == F_file_read) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: A read error occurred while accessing the file '%s'.", filename);
+ 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]);
} else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
} else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read_until().", status);
+ 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]);
}
return F_status_set_error(status);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", filename);
+ 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]);
} else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.", filename);
+ 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]);
} else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
} else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.", status, filename);
+ 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]);
}
return F_status_set_error(status);
status = F_status_set_fine(status);
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, 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_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
+ 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);
}
f_macro_fss_objects_t_delete_simple(local->rule_objects);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print_line(f_type_error, 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_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);
} else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
- fl_color_print_line(f_type_error, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.", init_rule_core_file);
+ 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);
} else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
} else {
- fl_color_print_line(f_type_error, 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_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);
}
f_macro_string_dynamic_t_delete(buffer);
if (F_status_is_error(status_process)) {
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
}
else {
- fl_color_print_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status);
+ 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);
}
// @todo: init_delete_data((*data));
status = F_status_set_fine(status);
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, 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_line(f_type_error, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
+ 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);
}
f_macro_fss_objects_t_delete_simple((*rule_objects));
}
else {
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print_line(f_type_error, context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print_to(data.error.to, context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
}
else {
- fl_color_print_line(f_type_error, context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status);
+ 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_fss
fl_status
fl_string
+fll_error
fll_execute
fll_fss
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_program -lfll_fss -lfl_conversion -lfll_execute -lfl_environment -lf_signal -lf_path -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_program -lfll_fss -lfl_conversion -lfll_execute -lfl_environment -lf_signal -lf_path -lfll_error -lfl_string -lfl_status -lfl_fss -lfl_console -lf_conversion -lfl_color -lf_print -lf_pipe -lf_fss -lf_file -lf_environment -lf_directory -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library init.c private-init.c
status = fl_conversion_string_to_number_unsigned(value, &number, range);
if (status == F_none) {
- fl_color_print_line(f_type_output, data.context.set.error, "invalid name");
+ fl_color_print(f_type_output, data.context.set.error, "invalid name%c", f_string_eol[0]);
return F_status_set_error(F_parameter);
}
if (status == F_data_not || F_status_set_fine(status) == F_parameter) {
- fl_color_print_line(f_type_output, data.context.set.error, "invalid data");
+ fl_color_print(f_type_output, data.context.set.error, "invalid data%c", f_string_eol[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- fl_color_print_line(f_type_output, data.context.set.error, "unknown name");
+ fl_color_print(f_type_output, data.context.set.error, "unknown name%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_output, data.context.set.error, "failed to convert");
+ fl_color_print(f_type_output, data.context.set.error, "failed to convert%c", f_string_eol[0]);
}
return status;
}
if (status == F_data) {
- fl_color_print_line(f_type_output, data.context.set.warning, "unknown code");
+ fl_color_print(f_type_output, data.context.set.warning, "unknown code%c", f_string_eol[0]);
return F_none;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- fl_color_print_line(f_type_output, data.context.set.error, "unknown code");
+ fl_color_print(f_type_output, data.context.set.error, "unknown code%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_output, data.context.set.error, "failed to convert");
+ fl_color_print(f_type_output, data.context.set.error, "failed to convert%c", f_string_eol[0]);
}
return status;
f_status_t status = fl_conversion_string_to_number_unsigned(value, number, range);
if (*number > F_status_size_max_with_signal) {
- fl_color_print_line(f_type_output, data.context.set.error, "out of range");
+ fl_color_print(f_type_output, data.context.set.error, "out of range%c", f_string_eol[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_number_negative) {
- fl_color_print_line(f_type_output, data.context.set.error, "out of range");
+ fl_color_print(f_type_output, data.context.set.error, "out of range%c", f_string_eol[0]);
}
else {
- fl_color_print_line(f_type_output, data.context.set.error, "invalid number");
+ fl_color_print(f_type_output, data.context.set.error, "invalid number%c", f_string_eol[0]);
}
return status;
#endif
#ifndef _di_status_code_print_help_
- f_return_status status_code_print_help(const f_color_context_t context) {
- fll_program_print_help_header(context, status_code_name_long, status_code_version);
-
- fll_program_print_help_option(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(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(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(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(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(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(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(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(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 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.");
printf("%c", f_string_eol[0]);
- fll_program_print_help_option(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(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(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(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(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_usage(context, status_code_name, "status code(s)");
+ fll_program_print_help_usage(id, context, status_code_name, "status code(s)");
return F_none;
}
f_status_t status = F_none;
{
- f_console_parameter_id_t ids[3] = { status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark };
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, status_code_total_parameters);
- status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+ {
+ f_console_parameter_id_t ids[3] = { status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 3);
- if (F_status_is_error(status)) {
- status_code_delete_data(data);
- return F_status_set_error(status);
+ status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
+
+ if (F_status_is_error(status)) {
+ status_code_delete_data(data);
+ return F_status_set_error(status);
+ }
+ }
+
+ // Identify priority of verbosity related parameters.
+ {
+ f_console_parameter_id_t ids[4] = { status_code_parameter_verbosity_quiet, status_code_parameter_verbosity_normal, status_code_parameter_verbosity_verbose, status_code_parameter_verbosity_debug };
+ f_console_parameter_id_t choice = 0;
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+
+ status = f_console_parameter_prioritize_right(parameters, choices, &choice);
+
+ if (F_status_is_error(status)) {
+ status_code_delete_data(data);
+ return status;
+ }
+
+ if (choice == status_code_parameter_verbosity_quiet) {
+ data->error.verbosity = f_console_verbosity_quiet;
+ }
+ else if (choice == status_code_parameter_verbosity_normal) {
+ data->error.verbosity = f_console_verbosity_normal;
+ }
+ else if (choice == status_code_parameter_verbosity_verbose) {
+ data->error.verbosity = f_console_verbosity_verbose;
+ }
+ else if (choice == status_code_parameter_verbosity_debug) {
+ data->error.verbosity = f_console_verbosity_debug;
+ }
}
status = F_none;
}
if (data->parameters[status_code_parameter_help].result == f_console_result_found) {
- status_code_print_help(data->context);
+ status_code_print_help(data->output, data->context);
status_code_delete_data(data);
return F_none;
}
if (data->parameters[status_code_parameter_version].result == f_console_result_found) {
- fll_program_print_version(status_code_version);
+ fll_program_print_version(data->output, status_code_version);
status_code_delete_data(data);
return F_none;
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error);
- fl_color_print(f_type_error, data->context.set.error, "' cannot be used with the parameter ");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error);
- fl_color_print(f_type_error, data->context.set.error, "' cannot be used with the parameter ");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
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(f_type_error, data->context.set.error, "ERROR: The parameter '");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning);
- fl_color_print(f_type_error, data->context.set.error, "' cannot be used with the parameter ");
- fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine);
- fl_color_print_line(f_type_error, data->context.set.error, ".");
+ 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]);
status_code_delete_data(data);
return F_status_set_error(status);
}
if (data->remaining.used == 0 && !data->process_pipe) {
- fl_color_print_line(f_type_error, data->context.set.error, "ERROR: You failed to specify a status code.");
+ fl_color_print_to(data->error.to, 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);
#include <level_1/string.h>
// fll-2 includes
+#include <level_2/error.h>
#include <level_2/program.h>
#include <level_2/status.h>
status_code_parameter_light,
status_code_parameter_dark,
status_code_parameter_no_color,
+ status_code_parameter_verbosity_quiet,
+ status_code_parameter_verbosity_normal,
+ status_code_parameter_verbosity_verbose,
+ status_code_parameter_verbosity_debug,
status_code_parameter_version,
status_code_parameter_is_fine,
f_console_parameter_t_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, F_false, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_normal, f_console_standard_long_normal, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, F_false, f_console_type_inverse), \
f_console_parameter_t_initialize(status_code_short_is_fine, status_code_long_is_fine, 0, F_false, f_console_type_normal), \
f_console_parameter_t_initialize(status_code_short_is_warning, status_code_long_is_warning, 0, F_false, f_console_type_normal), \
f_console_parameter_t_initialize(status_code_short_number, status_code_long_number, 0, F_false, f_console_type_normal), \
}
- #define status_code_total_parameters 9
+ #define status_code_total_parameters 13
#endif // _di_status_code_defines_
#ifndef _di_status_code_data_t_
f_string_lengths_t remaining;
bool process_pipe;
- uint8_t verbosity;
+ int output;
+ fll_error_print_t error;
f_color_context_t context;
} status_code_data_t;
status_code_console_parameter_t_initialize, \
f_string_lengths_t_initialize, \
F_false, \
- f_console_verbosity_normal, \
+ f_type_descriptor_output, \
+ fll_error_print_t_initialize, \
f_color_context_t_initialize, \
}
#endif // _di_status_code_data_t_
* F_none on success.
*/
#ifndef _di_status_code_print_help_
- extern f_return_status status_code_print_help(const f_color_context_t context);
+ extern f_return_status status_code_print_help(const int id, const f_color_context_t context);
#endif // _di_status_code_print_help_
/**
fl_status
fl_string
fl_utf
+fll_error
fll_program
fll_status
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_status -lfll_program -lfl_utf -lfl_string -lfl_status -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory
+build_libraries-individual -lfll_status -lfll_program -lfll_error -lfl_utf -lfl_string -lfl_status -lfl_conversion -lfl_console -lfl_color -lf_print -lf_pipe -lf_file -lf_conversion -lf_console -lf_utf -lf_memory
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library status_code.c private-status_code.c