This appears to get most of the changes in regards to printing.
There will need to be some testing and reviewing to double check for any mistakes.
(With such a massive set of changes, minor/subtle mistakes are likely.)
I will resume my work on updating and getting the fss write functions to be more like the iki_write in some of the design practices (in terms of program operations, parameter usages, etc..) where applicable.
return F_false;
}
+ if (status == F_file_open) {
+ fl_color_print(error.to.stream, error.context, "%s%sUnable to open the file '", error.context.before->string, error.prefix ? error.prefix : "");
+ fl_color_print(error.to.stream, error.notable, "%s", file_name);
+ fl_color_print(error.to.stream, error.context, "'.");
+ fprintf(error.to.stream, "%c", f_string_eol[0]);
+
+ return F_false;
+ }
+
+ if (status == F_file_descriptor) {
+ fl_color_print(error.to.stream, error.context, "%s%sFile descriptor error while trying to open the file '", error.context.before->string, error.prefix ? error.prefix : "");
+ fl_color_print(error.to.stream.to.stream, error.notable, "%s", file_name);
+ fl_color_print(stream, error.context, "'.");
+ fprintf(error.to.stream, "%c", f_string_eol[0]);
+
+ return F_false;
+ }
+
+ if (status == F_number_underflow) {
+ fl_color_print(error.to.stream, error.context, "%s%sInteger underflow while trying to buffer the file '", error.context.before->string, error.prefix ? error.prefix : "");
+ fl_color_print(error.to.stream, error.notable, "%s", file_name);
+ fl_color_print(error.to.stream, error.context, "'.");
+ fprintf(error.to.stream, "%c", f_string_eol[0]);
+
+ return F_false;
+ }
+
if (status == F_file_read) {
if (error.verbosity != f_console_verbosity_quiet) {
fprintf(error.to.stream, "%c", f_string_eol[0]);
extern "C" {
#endif
-#ifndef _di_fll_file_error_print_
- f_return_status fll_file_error_print(FILE *stream, const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status) {
-
- if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_file_closed) {
- fl_color_print(stream, context.set.error, "INTERNAL ERROR: The file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "' is no longer open.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_file_seek) {
- fl_color_print(stream, context.set.error, "ERROR: A seek error occurred while accessing the file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "'.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_file_read) {
- fl_color_print(stream, context.set.error, "ERROR: A read error occurred while accessing the file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "'.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_file_found_not) {
- fl_color_print(stream, context.set.error, "ERROR: Unable to find the file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "'.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_file_open) {
- fl_color_print(stream, context.set.error, "ERROR: Unable to open the file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "'.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_file_descriptor) {
- fl_color_print(stream, context.set.error, "ERROR: File descriptor error while trying to open the file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "'.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_parameter) {
- fl_color_print(stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(stream, context.set.notable, "%s()", function_name);
- fl_color_print(stream, context.set.error, ".");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_number_overflow) {
- fl_color_print(stream, context.set.error, "ERROR: Integer overflow while trying to buffer the file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "'.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else if (status == F_number_underflow) {
- fl_color_print(stream, context.set.error, "ERROR: Integer underflow while trying to buffer the file '");
- fl_color_print(stream, context.set.notable, "%s", file_name);
- fl_color_print(stream, context.set.error, "'.");
- fprintf(stream, "%c", f_string_eol[0]);
- }
- else {
- return F_false;
- }
-
- return F_true;
- }
-#endif // _di_fll_file_error_print_
-
#ifndef _di_fll_file_mode_set_all_
f_return_status fll_file_mode_set_all(const f_string_t path, const mode_t mode, const f_number_unsigned_t depth_max) {
#ifndef _di_level_2_parameter_checking_
#endif
/**
- * Print file error messages.
- *
- * @param stream
- * The file stream to write to, such as f_type_output or f_type_error.
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param file_name
- * The name of the file with the error.
- * @param status
- * The status code representing the error.
- * The status code should be passed through F_status_set_fine() if it contains error or warning bits.
- *
- * @return
- * F_true if error message was printed.
- * F_false if no error message was printed.
- */
-#ifndef _di_fll_file_error_print_
- extern f_return_status fll_file_error_print(FILE *stream, const f_color_context_t context, const f_string_t function_name, const f_string_t file_name, const f_status_t status);
-#endif // _di_fll_file_error_print_
-
-/**
* Change mode of a given file or directory at the specified path.
*
* This does not set mode based on umask(), be sure to apply umask if so desired.
if (data->remaining.used > 0 || data->process_pipe) {
if (data->parameters[byte_dump_parameter_width].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width);
fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width);
fl_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number between ");
fl_color_print(data->error.to.stream, data->context.set.notable, "0");
}
if (data->parameters[byte_dump_parameter_first].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first);
fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first);
fl_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number (inclusively) between ");
fl_color_print(data->error.to.stream, data->context.set.notable, "0");
}
if (data->parameters[byte_dump_parameter_last].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last);
fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last);
fl_color_print(data->error.to.stream, data->context.set.error, "' value can only be a number (inclusively) between ");
fl_color_print(data->error.to.stream, data->context.set.notable, "0");
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first);
fl_color_print(data->error.to.stream, data->context.set.error, "' value cannot be greater than the parameter '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last);
}
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more filenames.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more filenames.%c", fll_error_print_error, f_string_eol[0]);
status = F_status_set_error(F_parameter);
}
if (size < 0) {
// @todo: determine what the error from read() is and display it.
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: read() failed for '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sread() failed for '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", file_name);
fl_color_print(data.error.to.stream, data.context.set.error, "'.");
fprintf(data.error.to.stream, "%c%x", f_string_eol[0], f_string_eol[0]);
else if (F_status_is_error(status)) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->error.context, "ERROR: The operation '");
+ fl_color_print(data->error.to.stream, data->error.context, "%sThe operation '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->error.notable, "%s", operations_name);
fl_color_print(data->error.to.stream, data->error.context, "' failed.%c", f_string_eol[0]);
}
else {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->error.context, "ERROR: You failed to specify an operation.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->error.context, "%sYou failed to specify an operation.%c", fll_error_print_error, f_string_eol[0]);
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
}
if (names.used + data_build.setting.environment.used > f_array_length_t_size) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The values for the setting '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe values for the setting '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_setting_name_environment);
fl_color_print(data.error.to.stream, data.context.set.error, "' of setting file '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", data.file_data_build_settings.string);
if (!settings[i]->used) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The setting '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe setting '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", names[i]);
fl_color_print(data.error.to.stream, data.context.set.error, "' is required but is not specified in the settings file '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", setting_file.used ? path_file : data.file_data_build_settings.string);
if (found == F_false) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The specified mode '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe specified mode '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", modes->array[i].string);
fl_color_print(data.error.to.stream, data.context.set.error, "' is not a valid mode, according to '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file);
if (data.error.verbosity != f_console_verbosity_quiet) {
// @todo update FSS functions to return which setting index the problem happened on.
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A setting in the build setting file '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sA setting in the build setting file '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file);
fl_color_print(data.error.to.stream, data.context.set.error, "' is too long.%c", f_string_eol[0]);
}
if (settings_single_source[i]->used > 1) {
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]);
fl_color_print(data.output.stream, data.context.set.warning, "' in the file '");
fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file);
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]);
fl_color_print(data.output.stream, data.context.set.warning, "' in the file '");
fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file);
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]);
fl_color_print(data.output.stream, data.context.set.warning, "' in the file '");
fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file);
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the setting '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sthe setting '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", settings_single_name[i]);
fl_color_print(data.output.stream, data.context.set.warning, "' in the file '");
fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file);
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.error, "WARNING: the parameters '");
+ fl_color_print(data.output.stream, data.context.set.error, "%sthe parameters '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_disabled);
fl_color_print(data.output.stream, data.context.set.error, "' and '");
fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_shared_enabled);
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.error, "WARNING: the parameters '");
+ fl_color_print(data.output.stream, data.context.set.error, "%sthe parameters '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_disabled);
fl_color_print(data.output.stream, data.context.set.error, "' and '");
fl_color_print(data.output.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_static_enabled);
if (setting->build_shared == F_false && setting->build_static == F_false) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The build settings '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe build settings '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_setting_name_build_shared);
fl_color_print(data.error.to.stream, data.context.set.error, "' and '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", fake_build_setting_name_build_static);
if (*status == F_false) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The path '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination_path.string);
fl_color_print(data.error.to.stream, data.context.set.error, "' exists but is not a directory.%c", f_string_eol[0]);
}
if (F_status_is_error(*status)) {
if (F_status_set_fine(*status) == F_file_found_not) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The path '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination_path.string);
fl_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]);
}
if (F_status_set_fine(*status) == F_file_found_not) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to find program '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to find program '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", program.used ? program.string : "");
fl_color_print(data.error.to.stream, data.context.set.error, "' for executing.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (fll_error_print(data->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
if (status == F_false) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_process);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameters value '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s", arguments.argv[location]);
if (status == F_status_set_error(F_string_too_large)) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
fl_color_print(data->error.to.stream, data->context.set.error, "' is too long.%c", f_string_eol[0]);
}
if (length == 0 || status == F_data_not) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
fl_color_print(data->error.to.stream, data->context.set.error, "' must not be empty and must not contain only whitespace.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (fll_error_print(data->error, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (fll_error_print(data->error, F_status_set_fine(status), "f_macro_string_dynamic_t_new", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to load default for the parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to load default for the parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (fll_error_print(data->error, F_status_set_fine(status), "f_utf_is_word", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
if (status == F_false) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_define);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameters value '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s", data->define.array[i].string);
if (F_status_is_error(status)) {
if (fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (fll_error_print(data->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_unknown && data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to process the parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to process the parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
if (status == F_false) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fake_long_mode);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameters value '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s", data->mode.array[i].string);
}
else if (parameters_required[i]) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: No valid path for the (required) directory parameter '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sNo valid path for the (required) directory parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameters_name[i]);
fl_color_print(data.error.to.stream, data.context.set.error, "' was found.%c", f_string_eol[0]);
if (!data_make->buffer.used) {
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the fakefile '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sthe fakefile '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", data.file_data_build_fakefile.string);
fl_color_print(data.output.stream, data.context.set.warning, "' is empty.");
}
}
else if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: The environment name '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sThe environment name '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", name_define.string);
fl_color_print(data.output.stream, data.context.set.warning, "' is already added.%c", f_string_eol[0]);
}
}
else if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: The environment name '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sThe environment name '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", name_define.string);
fl_color_print(data.output.stream, data.context.set.warning, "' is invalid, ignoring.%c", f_string_eol[0]);
}
else {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Invalid characters in the define setting name '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid characters in the define setting name '", fll_error_print_error);
fl_color_print_code(data.error.to.stream, *data.error.notable.before);
f_print_dynamic(data.error.to.stream, define.array[i].name);
if (F_status_is_error(status_path) && data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: Failed change back to orignal path '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sFailed change back to orignal path '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", data_make.path.stack.array[0].string);
fl_color_print(data.output.stream, data.context.set.warning, "', status code = ");
fl_color_print(data.output.stream, data.context.set.notable, "%llu", F_status_set_fine(status_path));
if (F_status_set_fine(*status) == F_file_found_not) {
if (data.error.verbosity == f_console_verbosity_verbose) {
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the file '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sthe file '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", arguments.array[i].string);
fl_color_print(data.output.stream, data.context.set.warning, "' was not found.%c", f_string_eol[0]);
}
if (status == F_file_found_not) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to find '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to find '", fll_error_print_error);
if (f_file_exists(source) == F_true) {
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", destination);
if (status == F_parameter) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling ", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function);
fl_color_print(data.error.to.stream, data.context.set.error, "() to %s '", operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (status == F_name) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Invalid name for '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid name for '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (status == F_memory_out) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory, while trying to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Overflow while trying to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sOverflow while trying to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (status == F_directory) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Invalid directory while trying to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid directory while trying to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (status == F_access_denied) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Access denied while trying to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAccess denied while trying to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (status == F_loop) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Loop while trying to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sLoop while trying to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (status == F_prohibited) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Prohibited by system while trying to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sProhibited by system while trying to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (status == F_directory_found_not) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (status == F_failure) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to %s '", operation);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to %s '", fll_error_print_error, operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (destination) {
if (fll_error_print(data.error, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN ERROR: (");
+ fl_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN %s(", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", status);
fl_color_print(data.error.to.stream, data.context.set.error, ") occurred while trying to %s '", operation);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", source);
if (status == F_file_found_not) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at stop position (at ");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%serror occurred on invalid UTF-8 character at stop position (at ", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%d", range.start);
fl_color_print(data.error.to.stream, data.context.set.error, " of setting file '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file);
if (status == F_status_set_error(F_incomplete_utf_stop)) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ENCODING ERROR: error occurred on invalid UTF-8 character at end of string (at ");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%serror occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%d", range.start);
fl_color_print(data.error.to.stream, data.context.set.error, " of setting file '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path_file);
if (fll_error_print(data.error, status, function, F_false) == F_unknown && fallback && data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN ERROR: (");
+ fl_color_print(data.error.to.stream, data.context.set.error, "UNKNOWN %s(", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", status);
fl_color_print(data.error.to.stream, data.context.set.error, ") in function ");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", function);
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
fl_color_print(data.error.to.stream, data.context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
fl_color_print(data.error.to.stream, data.context.set.error, "' specified too many times.%c", f_string_eol[0]);
f_fss_count_lines(buffer, operation_name.start, &line);
fprintf(error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(error.to.stream, data.error.context, "%s: The section operation '", data.error.prefix);
+ fl_color_print(error.to.stream, data.error.context, "%sThe section operation '", data.error.prefix);
fl_color_print_code(error.to.stream, data.context.notable);
f_print_dynamic_partial(error.to.stream, buffer, operation_name);
if (F_status_set_fine(status) == F_false) {
fprintf(error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(error.to.stream, data.error.context, "%s: The path '", data.error.prefix);
+ fl_color_print(error.to.stream, data.error.context, "%sThe path '", data.error.prefix);
fl_color_print(error.to.stream, data.context.set.notable, "%s", path);
fl_color_print(error.to.stream, data.error.context, "' is outside the project root.%c", f_string_eol[0]);
}
f_fss_count_lines(buffer, operation_name.start, &line);
fprintf(error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(error.to.stream, data.error.context, "%s: The section operation '", data.error.prefix);
+ fl_color_print(error.to.stream, data.error.context, "The section operation '", data.error.prefix);
fl_color_print_code(error.to.stream, data.context.notable);
f_print_dynamic_partial(error.to.stream, buffer, operation_name);
f_fss_count_lines(buffer, operation_name.start, &line);
fprintf(error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(error.to.stream, data.error.context, "%s: The section operation '", data.error.prefix);
+ fl_color_print(error.to.stream, data.error.context, "%sThe section operation '", data.error.prefix);
fl_color_print_code(error.to.stream, data.context.notable);
f_print_dynamic_partial(error.to.stream, buffer, operation_name);
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the fakefile '");
+ fl_color_print(f_type_warning, data.context.set.warning, "%sthe fakefile '", fll_error_print_warning);
fl_color_print(f_type_warning, data.context.set.notable, "%s", path_file);
fl_color_print(f_type_warning, data.context.set.warning, "' has empty content for the '");
fl_color_print(f_type_warning, data.context.set.notable, "%s", settings_name);
fprintf(data.output.stream, "%c", f_string_eol[0]);
- fl_color_print(data.output.stream, data.context.set.warning, "WARNING: the fakefile '");
+ fl_color_print(data.output.stream, data.context.set.warning, "%sthe fakefile '", fll_error_print_warning);
fl_color_print(data.output.stream, data.context.set.notable, "%s", path_file);
fl_color_print(data.output.stream, data.context.set.warning, "' has an invalid content '");
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the setting '");
+ fl_color_print(f_type_warning, data.context.set.warning, "%sthe setting '", fll_error_print_warning);
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);
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(f_type_warning, data.context.set.warning, "WARNING: the %s object '", label);
+ fl_color_print(f_type_warning, data.context.set.warning, "%sthe %s object '", fll_error_print_warning, 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);
if (status == F_false) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The path '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string);
fl_color_print(data.error.to.stream, data.context.set.error, "' exists but is not a directory.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The path '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe path '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string);
fl_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]);
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The file '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe file '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s", path.string);
fl_color_print(data.error.to.stream, data.context.set.error, "' could not be created, a parent directory does not exist.%c", f_string_eol[0]);
}
fll_program_print_help_option(file, context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, " Decrease verbosity beyond normal output.");
fll_program_print_help_option(file, context, f_console_standard_short_normal, f_console_standard_long_normal, f_console_symbol_short_disable, f_console_symbol_long_disable, " Set verbosity to normal output.");
fll_program_print_help_option(file, context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output.");
-
- #ifdef _en_firewall_debug_
- fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output.");
- #endif // _en_firewall_debug_
-
+ fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(file, context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number.");
- #ifdef _en_firewall_debug_
- fll_program_print_help_option(file, context, f_console_standard_short_debug, f_console_standard_long_debug, f_console_symbol_short_disable, f_console_symbol_long_disable, " Enable debugging.");
- #endif // _en_firewall_debug_
-
printf("%c%c", f_string_eol[0], f_string_eol[0]);
fl_color_print(f_type_output, context.set.important, " Available Commands: ");
f_status_t status = F_none;
{
- const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
+ const f_console_parameters_t parameters = f_macro_console_parameters_t_initialize(data->parameters, firewall_total_parameters);
{
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);
status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context);
// 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 };
+ const f_console_parameter_ids_t choices = f_macro_console_parameter_ids_t_initialize(ids, 4);
f_console_parameter_id_t choice = 0;
status = f_console_parameter_prioritize_right(parameters, choices, &choice);
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(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]);
+ fl_color_print(f_type_warning, data->context.set.warning, "%s'%s' is not a valid show option%c", fll_error_print_warning, 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(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
firewall_delete_local_data(&local);
firewall_delete_data(data);
return status;
status = F_status_set_fine(status);
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_iptables, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_data_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Could not find any network devices%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCould not find any network devices%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_failure) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to read the device directory '%s'%c", network_devices, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to read the device directory '%s'%c", fll_error_print_error, network_devices, f_string_eol[0]);
}
firewall_delete_local_data(&local);
return status;
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform lock request because the lock instructions are missing from: %s.%c", network_path firewall_file_other, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform lock request because the lock instructions are missing from: %s.%c", fll_error_print_error, network_path firewall_file_other, f_string_eol[0]);
firewall_delete_local_data(&local);
firewall_delete_data(data);
}
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform stop request because the lock instructions are missing from: %s.", network_path firewall_file_other, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform stop request because the lock instructions are missing from: %s.", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
firewall_delete_local_data(&local);
firewall_delete_data(data);
return status;
firewall_delete_local_data(&local);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You did not pass a command%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou did not pass a command%c", fll_error_print_error, f_string_eol[0]);
status = F_status_set_error(F_parameter);
}
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_verbosity_debug,
firewall_parameter_version,
firewall_action_none_id,
};
- #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, 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_lock, 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 14
- #else
- #define firewall_console_parameter_t_initialize \
- { \
- 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_lock, 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 13
- #endif // _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, 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_lock, 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 14
#endif // _di_firewall_defines_
#ifndef _di_firewall_data_t_
if (length >= firewall_chain_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_chain, length, firewall_chain_length) == F_equal_to) {
if (chain == firewall_chain_custom_id) {
// custom chains can only apply to themselves, so silently ignore chain commands specified within a custom chain.
- fprintf(f_type_warning, "WARNING: At line %i, the chain option is meaningle ss inside of a custom chain.", i);
+ fprintf(f_type_warning, "%sAt line %i, the chain option is meaningle ss inside of a custom chain.", fll_error_print_warning, i);
continue;
}
else if (length < firewall_rule_length || fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string_t) firewall_rule, length, firewall_rule_length) == F_equal_to_not) {
if (length > 0) {
fl_color_print_code(f_type_warning, data.context.warning);
- fprintf(f_type_warning, "WARNING: At line %i, the object '", i);
+ fprintf(f_type_warning, "%sAt line %i, the object '", fll_error_print_warning, i);
f_print(f_type_warning, local.buffer.string + local.rule_objects.array[i].start, length);
fprintf(f_type_warning, "' is invalid");
fl_color_print_code(f_type_warning, data.context.reset);
}
else {
- fprintf(f_type_warning, "WARNING: At line %i, the object is missing", i);
+ fprintf(f_type_warning, "%sAt line %i, the object is missing", fll_error_print_warning, i);
}
fprintf(f_type_warning, "\n");
if (length > 0) {
fl_color_print_code(f_type_warning, data.context.warning);
- fprintf(f_type_warning, "WARNING: At line %i, the object '", i);
+ fprintf(f_type_warning, "%sAt line %i, the object '", fll_error_print_warning, i);
f_print(f_type_warning, local.buffer.string + local.rule_objects.array[i].start, length);
fprintf(f_type_warning, "' has invalid content '");
f_print(f_type_warning, local.buffer.string + local.rule_contents.array[i].array[0].start, firewall_macro_structure_size(local.rule_contents.array[i], 0));
fprintf(f_type_warning, "\n");
}
else {
- 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]);
+ fl_color_print(f_type_warning, data.context.set.warning, "%sAt line %i, the object has no content%c", fll_error_print_warning, i, f_string_eol[0]);
}
continue;
length = firewall_macro_structure_size(local.rule_objects, i);
fl_color_print_code(f_type_warning, data.context.warning);
- fprintf(f_type_warning, "WARNING: At line %i, the object '", i);
+ fprintf(f_type_warning, "%sAt line %i, the object '", fll_error_print_warning, i);
f_print(f_type_warning, local.buffer.string + local.rule_objects.array[i].start, length);
fprintf(f_type_warning, "' has no content");
fl_color_print_code(f_type_warning, data.context.reset);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
// the file does not have to exist
- 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]);
+ fl_color_print(f_type_warning, data.context.set.warning, "%sCannot find the file '%.*s'%c", fll_error_print_warning, file_path.used, file_path.string, f_string_eol[0]);
status = F_none;
}
else if (status == F_file_open) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to open the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to open the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol[0]);
}
else if (status == F_file_descriptor) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFile descriptor error while trying to open the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, status, f_string_eol[0]);
}
if (status != F_file_found_not) {
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read()%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling f_file_read()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_number_overflow) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInteger overflow while trying to buffer the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol[0]);
}
else if (status == F_file_closed) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: The file '%.*s' is no longer open%c", file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe file '%.*s' is no longer open%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol[0]);
}
else if (status == F_file_seek) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sA seek error occurred while accessing the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol[0]);
}
else if (status == F_file_read) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A read error occurred while accessing the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sA read error occurred while accessing the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read()%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read()%c", fll_error_print_error, status, f_string_eol[0]);
}
status = F_status_set_error(status);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_read() for the file '%.*s'%c", file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_fss_basic_read() for the file '%.*s'%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_read() for the file '%.*s'%c", status, file_path.used, file_path.string, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_read() for the file '%.*s'%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
break;
}
firewall_macro_append_argument_to_arguments(status, arguments, ip_argument)
if (F_status_is_error(status)) break;
- // print command when debugging.
- #ifdef _en_firewall_debug_
- if (data.parameters[firewall_parameter_debug].result == f_console_result_found) {
- fl_color_print_code(f_type_debug, data.context.warning);
- fprintf(f_type_debug, "%s ", current_tool);
+ if (data.error.verbosity == f_console_verbosity_debug) {
+ fl_color_print_code(f_type_debug, data.context.warning);
+ fprintf(f_type_debug, "%s ", current_tool);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
+ for (f_string_length_t i = 0; i < arguments.used; i++) {
+ fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
+ } // for
- fl_color_print_code(f_type_debug, data.context.reset);
- fprintf(f_type_debug, "\n");
- }
- #endif // _en_firewall_debug_
+ fl_color_print_code(f_type_debug, data.context.reset);
+ fprintf(f_type_debug, "\n");
+ }
status = fll_execute_program((f_string_t) current_tool, arguments, 0, &return_code);
if (status == F_failure) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", current_tool, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol[0]);
// remove ip_argument from arguments string.
f_macro_string_dynamic_t_delete_simple(arguments.array[arguments.used]);
if (status == F_failure || status == F_parameter) break;
}
else {
- // print command when debugging.
- #ifdef _en_firewall_debug_
- if (data.parameters[firewall_parameter_debug].result == f_console_result_found) {
- fl_color_print_code(f_type_debug, data.context.warning);
- fprintf(f_type_debug, "%s ", current_tool);
-
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- fl_color_print_code(f_type_debug, data.context.reset);
- fprintf(f_type_debug, "\n");
- }
- #endif // _en_firewall_debug_
+ if (data.error.verbosity == f_console_verbosity_debug) {
+ fl_color_print_code(f_type_debug, data.context.warning);
+ fprintf(f_type_debug, "%s ", current_tool);
+
+ for (f_string_length_t i = 0; i < arguments.used; i++) {
+ fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
+ } // for
+
+ fl_color_print_code(f_type_debug, data.context.reset);
+ fprintf(f_type_debug, "\n");
+ }
status = fll_execute_program(current_tool, arguments, 0, &return_code);
if (status == F_failure) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", current_tool, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol[0]);
break;
}
}
}
if (create_chain) {
- // print command when debugging.
- #ifdef _en_firewall_debug_
- if (data->parameters[firewall_parameter_debug].result == f_console_result_found) {
+ if (data->error.verbosity == f_console_verbosity_debug) {
+ fl_color_print_code(f_type_debug, data->context.warning);
+ fprintf(f_type_debug, "%s ", firewall_tool_iptables);
+
+ for (f_string_length_t i = 0; i < arguments.used; i++) {
+ fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
+ } // for
+
+ fl_color_print_code(f_type_debug, data->context.reset);
+ fprintf(f_type_debug, "\n");
+ }
+
+ tool = firewall_program_iptables;
+ status = fll_execute_program((f_string_t) firewall_tool_iptables, arguments, 0, &return_code);
+
+ if (F_status_is_error_not(status)) {
+ if (data->error.verbosity == f_console_verbosity_debug) {
fl_color_print_code(f_type_debug, data->context.warning);
- fprintf(f_type_debug, "%s ", firewall_tool_iptables);
+ fprintf(f_type_debug, "%s ", firewall_tool_ip6tables);
for (f_string_length_t i = 0; i < arguments.used; i++) {
fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
fl_color_print_code(f_type_debug, data->context.reset);
fprintf(f_type_debug, "\n");
}
- #endif // _en_firewall_debug_
-
- tool = firewall_program_iptables;
- status = fll_execute_program((f_string_t) firewall_tool_iptables, arguments, 0, &return_code);
-
- if (F_status_is_error_not(status)) {
- // print command when debugging.
- #ifdef _en_firewall_debug_
- if (data->parameters[firewall_parameter_debug].result == f_console_result_found) {
- fl_color_print_code(f_type_debug, data->context.warning);
- fprintf(f_type_debug, "%s ", firewall_tool_ip6tables);
-
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- fl_color_print_code(f_type_debug, data->context.reset);
- fprintf(f_type_debug, "\n");
- }
- #endif // _en_firewall_debug_
tool = firewall_program_ip6tables;
status = fll_execute_program((f_string_t) firewall_tool_ip6tables, arguments, 0, &return_code);
if (status == F_failure) {
if (tool == firewall_program_iptables) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_iptables, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_iptables, f_string_eol[0]);
}
else if (tool == firewall_program_ip6tables) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Failed to perform requested %s operation:%c", firewall_tool_ip6tables, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_ip6tables, f_string_eol[0]);
}
fprintf(f_type_error, " ");
fprintf(f_type_error, "\n");
}
else if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol[0]);
}
f_macro_string_dynamics_t_delete_simple(arguments);
arguments.size = 1;
arguments.used = 1;
- // print command when debugging.
- #ifdef _en_firewall_debug_
- if (data.parameters[firewall_parameter_debug].result == f_console_result_found) {
- fl_color_print_code(f_type_debug, data.context.warning);
- fprintf(f_type_debug, "%s ", tools[i]);
+ if (data.error.verbosity == f_console_verbosity_debug) {
+ fl_color_print_code(f_type_debug, data.context.warning);
+ fprintf(f_type_debug, "%s ", tools[i]);
- for (f_string_length_t i = 0; i < arguments.used; i++) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
+ for (f_string_length_t i = 0; i < arguments.used; i++) {
+ fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
+ } // for
- fl_color_print_code(f_type_debug, data.context.reset);
- fprintf(f_type_debug, "\n");
- }
- #endif // _en_firewall_debug_
+ fl_color_print_code(f_type_debug, data.context.reset);
+ fprintf(f_type_debug, "\n");
+ }
status = fll_execute_program(tools[i], arguments, 0, &return_code);
status = F_status_set_fine(status);
if (status == F_failure) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[i], f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol[0]);
}
return status;
arguments.size = 1;
arguments.used = 1;
- // print command when debugging.
- #ifdef _en_firewall_debug_
- if (data.parameters[firewall_parameter_debug].result == f_console_result_found) {
- fl_color_print_code(f_type_debug, data.context.warning);
- fprintf(f_type_debug, "%s ", tools[i]);
+ if (data.error.verbosity == f_console_verbosity_debug) {
+ fl_color_print_code(f_type_debug, data.context.warning);
+ fprintf(f_type_debug, "%s ", tools[i]);
- for (f_string_length_t j = 0; j < arguments.used; j++) {
- fprintf(f_type_debug, "%.*s ", arguments.array[j].used, arguments.array[j].string);
- } // for
+ for (f_string_length_t j = 0; j < arguments.used; j++) {
+ fprintf(f_type_debug, "%.*s ", arguments.array[j].used, arguments.array[j].string);
+ } // for
- fl_color_print_code(f_type_debug, data.context.reset);
- fprintf(f_type_debug, "\n");
- }
- #endif // _en_firewall_debug_
+ fl_color_print_code(f_type_debug, data.context.reset);
+ fprintf(f_type_debug, "\n");
+ }
status = fll_execute_program(tools[i], arguments, 0, &return_code);
status = F_status_set_fine(status);
if (status == F_failure) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[i], f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol[0]);
}
return status;
int return_code = 0;
// print command when debugging.
- #ifdef _en_firewall_debug_
- if (data.parameters[firewall_parameter_debug].result == f_console_result_found) {
- fl_color_print_code(f_type_debug, data.context.warning);
- fprintf(f_type_debug, "%s ", tools[j]);
+ if (data.error.verbosity == f_console_verbosity_debug) {
+ fl_color_print_code(f_type_debug, data.context.warning);
+ fprintf(f_type_debug, "%s ", tools[j]);
- for (f_string_length_t k = 0; k < arguments.used; k++) {
- fprintf(f_type_debug, "%.*s ", arguments.array[k].used, arguments.array[k].string);
- } // for
+ for (f_string_length_t k = 0; k < arguments.used; k++) {
+ fprintf(f_type_debug, "%.*s ", arguments.array[k].used, arguments.array[k].string);
+ } // for
- fl_color_print_code(f_type_debug, data.context.reset);
- fprintf(f_type_debug, "\n");
- }
- #endif // _en_firewall_debug_
+ fl_color_print_code(f_type_debug, data.context.reset);
+ fprintf(f_type_debug, "\n");
+ }
status = fll_execute_program(tools[j], arguments, 0, &return_code);
status = F_status_set_fine(status);
if (status == F_failure) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Failed to perform requested %s operation:%c", tools[j], f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol[0]);
}
return status;
if (optional) {
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol[0]);
}
else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol[0]);
}
} else {
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_file_open) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_file_descriptor) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol[0]);
}
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read().%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_read().%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_number_overflow) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInteger overflow while trying to buffer the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_file_closed) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe file '%s' is no longer open.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_file_seek) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sA seek error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_file_read) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: A read error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sA read error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read().%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read().%c", fll_error_print_error, status, f_string_eol[0]);
}
return status;
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: No relevant data was found within the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sNo relevant data was found within the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", status, filename, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_failure) {
// the error message has already been displayed.
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling firewall_perform_commands().%c", fll_error_print_error, status, f_string_eol[0]);
}
f_macro_fss_objects_t_delete_simple(local->rule_objects);
# fss-0000
-
-_en_firewall_debug_ Enable '++debug' parameter for outputting firewall commands as they are being executed.
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_at);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_list_read_parameter_depth].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_list_read_parameter_line].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_list_read_parameter_name].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line);
}
if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_additional) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_total);
f_string_length_t original_size = data->quantity.total;
status = fss_basic_list_read_main_preprocess_depth(arguments, *data, &depths);
+
if (F_status_is_error(status)) {
macro_fss_basic_list_read_depths_t_delete_simple(depths);
fss_basic_list_read_delete_data(data);
}
if (data->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]);
file.id = f_type_descriptor_input;
status = f_file_read(file, &data->buffer);
+
if (F_status_is_error(status)) {
- fss_basic_list_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_file);
macro_fss_basic_list_read_depths_t_delete_simple(depths);
fss_basic_list_read_delete_data(data);
}
status = fss_basic_list_read_main_process_file(arguments, data, "-", depths);
+
if (F_status_is_error(status)) {
macro_fss_basic_list_read_depths_t_delete_simple(depths);
fss_basic_list_read_delete_data(data);
data->quantity.total = original_size;
if (F_status_is_error(status)) {
- fss_basic_list_read_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);
macro_fss_basic_list_read_depths_t_delete_simple(depths);
fss_basic_list_read_delete_data(data);
if (!data->quantity.total) {
status = f_file_size_by_id(file.id, &data->quantity.total);
if (F_status_is_error(status)) {
- fss_basic_list_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
f_file_close(&file.id);
f_file_close(&file.id);
if (F_status_is_error(status)) {
- fss_basic_list_read_print_file_error(data->context, "f_file_read_until", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
+
macro_fss_basic_list_read_depths_t_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
}
status = fss_basic_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths);
+
if (F_status_is_error(status)) {
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(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol[0]);
status = F_status_set_error(F_parameter);
}
extern "C" {
#endif
-#ifndef _di_fss_basic_list_read_print_file_error_
- 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(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_basic_list_read_print_file_error_
-
-#ifndef _di_fss_basic_list_read_print_number_argument_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(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- else if (status == F_number) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_underflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_overflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_negative) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_positive) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' contains a '");
- fl_color_print(data.error.to.stream, context.set.notable, "+");
- fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_data_not) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
- }
- else {
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' with the value '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_basic_list_read_print_number_argument_error_
-
#ifndef _di_fss_basic_list_read_main_preprocess_depth_
f_return_status fss_basic_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_basic_list_read_data_t data, fss_basic_list_read_depths_t *depths) {
f_status_t status = F_none;
}
macro_fss_basic_list_read_depths_t_new(status, (*depths), depth_size);
+
if (F_status_is_error(status)) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
return status;
}
const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth]));
status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range);
+
if (F_status_is_error(status)) {
- fss_basic_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_depth, arguments.argv[position_depth]);
return status;
}
}
const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at]));
status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range);
+
if (F_status_is_error(status)) {
- fss_basic_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_at, arguments.argv[depths->array[i].index_at]);
return status;
}
} // for
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status_code == f_string_length_t_size) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_trim);
fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]);
}
function = "fl_string_rip";
}
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code);
fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling ");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function);
}
if (!depths->array[i].value_name.used) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_name);
fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_list_read_long_depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()");
fl_color_print(data->error.to.stream, data->context.set.error, " for the file '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_incomplete_utf_stop) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at stop position (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status);
fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling ");
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()");
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range);
if (F_status_is_error(status)) {
- fss_basic_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_select, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_select, arguments.argv[index]);
return status;
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range);
if (F_status_is_error(status)) {
- fss_basic_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_line, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_line, arguments.argv[index]);
return status;
}
}
#endif // _di_fss_basic_list_read_depths_t_
/**
- * Print file error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param file_name
- * The name of the file with the error.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_basic_list_read_print_file_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_basic_list_read_print_file_error_
-
-/**
- * Print number parameter argument error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param parameter_name
- * The name of the parameter responsible for the error.
- * @param argument
- * The value of the argument that is invalid.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_basic_list_read_print_number_argument_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_basic_list_read_print_number_argument_error_
-
-/**
* Pre-process the parameters, parsing out and handling the depth and depth related parameters.
*
* Will handle depth-sensitive parameter conflicts, such as --name being used with --at (which is not allowed).
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else if (status == F_file_open) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else if (status == F_file_descriptor) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'%c", fll_error_print_error, arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_write()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_write) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to write to the file '%s'%c", fll_error_print_error, arguments.argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]], f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_write()%c", fll_error_print_error, status, f_string_eol[0]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
if (data->remaining.used > 0 || data->process_pipe) {
if (data->parameters[fss_basic_read_parameter_at].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_at);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_read_parameter_depth].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_read_parameter_line].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_read_parameter_name].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]);
}
if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line);
}
if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_additional) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_total);
}
if (data->parameters[fss_basic_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]);
status = f_file_read(file, &data->buffer);
if (F_status_is_error(status)) {
- fss_basic_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_file);
macro_fss_basic_read_depths_t_delete_simple(depths);
fss_basic_read_delete_data(data);
data->quantity.total = original_size;
if (F_status_is_error(status)) {
- fss_basic_read_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);
macro_fss_basic_read_depths_t_delete_simple(depths);
fss_basic_read_delete_data(data);
status = f_file_size_by_id(file.id, &data->quantity.total);
if (F_status_is_error(status)) {
- fss_basic_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
f_file_close(&file.id);
f_file_close(&file.id);
if (F_status_is_error(status)) {
- fss_basic_read_print_file_error(data->context, "f_file_read_until", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
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(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol[0]);
status = F_status_set_error(F_parameter);
}
extern "C" {
#endif
-#ifndef _di_fss_basic_read_print_file_error_
- 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(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_basic_read_print_file_error_
-
-#ifndef _di_fss_basic_read_print_number_argument_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(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- else if (status == F_number) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_underflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_overflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_negative) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_positive) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' contains a '");
- fl_color_print(data.error.to.stream, context.set.notable, "+");
- fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_data_not) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
- }
- else {
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' with the value '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_basic_read_print_number_argument_error_
-
#ifndef _di_fss_basic_read_main_preprocess_depth_
f_return_status fss_basic_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_basic_read_data_t data, fss_basic_read_depths_t *depths) {
f_status_t status = F_none;
macro_fss_basic_read_depths_t_new(status, (*depths), depth_size);
if (F_status_is_error(status)) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
return status;
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range);
if (F_status_is_error(status)) {
- fss_basic_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_depth, arguments.argv[position_depth]);
return status;
}
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range);
if (F_status_is_error(status)) {
- fss_basic_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_at, arguments.argv[depths->array[i].index_at]);
return status;
}
} // for
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status_code == f_string_length_t_size) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_trim);
fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]);
}
function = "fl_string_rip";
}
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code);
fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling ");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function);
}
if (!depths->array[i].value_name.used) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_name);
fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_basic_read_long_depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()");
fl_color_print(data->error.to.stream, data->context.set.error, " for the file '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_incomplete_utf_stop) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at stop position (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status);
fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling ");
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_basic_list_read()");
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range);
if (F_status_is_error(status)) {
- fss_basic_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_select, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_select, arguments.argv[index]);
return status;
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range);
if (F_status_is_error(status)) {
- fss_basic_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_line, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_read_long_line, arguments.argv[index]);
return status;
}
}
#endif // _di_fss_basic_read_depths_t_
/**
- * Print file error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param file_name
- * The name of the file with the error.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_basic_read_print_file_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_basic_read_print_file_error_
-
-/**
- * Print number parameter argument error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param parameter_name
- * The name of the parameter responsible for the error.
- * @param argument
- * The value of the argument that is invalid.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_basic_read_print_number_argument_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_basic_read_print_number_argument_error_
-
-/**
* Pre-process the parameters, parsing out and handling the depth and depth related parameters.
*
* Will handle depth-sensitive parameter conflicts, such as --name being used with --at (which is not allowed).
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else if (status == F_file_open) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else if (status == F_file_descriptor) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'%c", fll_error_print_error, arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_write()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_write) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to write to the file '%s'%c", fll_error_print_error, arguments.argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]], f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_write()%c", fll_error_print_error, status, f_string_eol[0]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_at);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_list_read_parameter_depth].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_list_read_parameter_line].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_list_read_parameter_name].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line);
}
if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_additional) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_total);
}
if (data->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]);
status = f_file_read(file, &data->buffer);
if (F_status_is_error(status)) {
- fss_extended_list_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_file);
macro_fss_extended_list_read_depths_t_delete_simple(depths);
fss_extended_list_read_delete_data(data);
data->quantity.total = original_size;
if (F_status_is_error(status)) {
- fss_extended_list_read_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);
macro_fss_extended_list_read_depths_t_delete_simple(depths);
fss_extended_list_read_delete_data(data);
if (!data->quantity.total) {
status = f_file_size_by_id(file.id, &data->quantity.total);
if (F_status_is_error(status)) {
- fss_extended_list_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
f_file_close(&file.id);
f_file_close(&file.id);
if (F_status_is_error(status)) {
- fss_extended_list_read_print_file_error(data->context, "f_file_read_until", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
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(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol[0]);
status = F_status_set_error(F_parameter);
}
extern "C" {
#endif
-#ifndef _di_fss_extended_list_read_print_file_error_
- 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(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_extended_list_read_print_file_error_
-
-#ifndef _di_fss_extended_list_read_print_number_argument_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(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- else if (status == F_number) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_underflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_overflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_negative) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_positive) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' contains a '");
- fl_color_print(data.error.to.stream, context.set.notable, "+");
- fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_data_not) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
- }
- else {
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' with the value '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_extended_list_read_print_number_argument_error_
-
#ifndef _di_fss_extended_list_read_main_preprocess_depth_
f_return_status fss_extended_list_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_list_read_data_t data, fss_extended_list_read_depths_t *depths) {
f_status_t status = F_none;
macro_fss_extended_list_read_depths_t_new(status, (*depths), depth_size);
if (F_status_is_error(status)) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
return status;
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range);
if (F_status_is_error(status)) {
- fss_extended_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_depth, arguments.argv[position_depth]);
return status;
}
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range);
if (F_status_is_error(status)) {
- fss_extended_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at]);
return status;
}
} // for
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status_code == f_string_length_t_size) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_trim);
fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]);
}
function = "fl_string_rip";
}
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code);
fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling ");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function);
}
if (!depths->array[i].value_name.used) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_name);
fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_list_read_long_depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_list_read()");
fl_color_print(data->error.to.stream, data->context.set.error, " for the file '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_incomplete_utf_stop) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at stop position (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status);
fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling ");
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_list_read()");
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range);
if (F_status_is_error(status)) {
- fss_extended_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_select, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_select, arguments.argv[index]);
return status;
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range);
if (F_status_is_error(status)) {
- fss_extended_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_line, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_read_long_line, arguments.argv[index]);
return status;
}
}
#endif // _di_fss_extended_list_read_depths_t_
/**
- * Print file error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param file_name
- * The name of the file with the error.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_extended_list_read_print_file_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_print_file_error_
-
-/**
- * Print number parameter argument error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param parameter_name
- * The name of the parameter responsible for the error.
- * @param argument
- * The value of the argument that is invalid.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_extended_list_read_print_number_argument_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_list_read_print_number_argument_error_
-
-/**
* Pre-process the parameters, parsing out and handling the depth and depth related parameters.
*
* Will handle depth-sensitive parameter conflicts, such as --name being used with --at (which is not allowed).
if (data->remaining.used > 0 || data->process_pipe) {
if (data->parameters[fss_extended_read_parameter_at].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_at);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_read_parameter_depth].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_read_parameter_line].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_read_parameter_name].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]);
}
if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line);
}
if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_additional) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select);
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(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_total);
}
if (data->parameters[fss_extended_read_parameter_select].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_select);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter requires a positive number.%c", f_string_eol[0]);
status = f_file_read(file, &data->buffer);
if (F_status_is_error(status)) {
- fss_extended_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "read", fll_error_file_type_file);
macro_fss_extended_read_depths_t_delete_simple(depths);
fss_extended_read_delete_data(data);
data->quantity.total = original_size;
if (F_status_is_error(status)) {
- fss_extended_read_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);
macro_fss_extended_read_depths_t_delete_simple(depths);
fss_extended_read_delete_data(data);
status = f_file_size_by_id(file.id, &data->quantity.total);
if (F_status_is_error(status)) {
- fss_extended_read_print_file_error(data->context, "f_file_size_by_id", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
f_file_close(&file.id);
f_file_close(&file.id);
if (F_status_is_error(status)) {
- fss_extended_read_print_file_error(data->context, "f_file_read_until", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status));
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[counter]], "read", fll_error_file_type_file);
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(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify one or more files.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol[0]);
status = F_status_set_error(F_parameter);
}
extern "C" {
#endif
-#ifndef _di_fss_extended_read_print_file_error_
- 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(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_extended_read_print_file_error_
-
-#ifndef _di_fss_extended_read_print_number_argument_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(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- else if (status == F_number) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_underflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_overflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_negative) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_positive) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' contains a '");
- fl_color_print(data.error.to.stream, context.set.notable, "+");
- fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_data_not) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
- }
- else {
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function_name);
- fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter_name);
- fl_color_print(data.error.to.stream, context.set.error, "' with the value '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- }
-#endif // _di_fss_extended_read_print_number_argument_error_
-
#ifndef _di_fss_extended_read_main_preprocess_depth_
f_return_status fss_extended_read_main_preprocess_depth(const f_console_arguments_t arguments, const fss_extended_read_data_t data, fss_extended_read_depths_t *depths) {
f_status_t status = F_none;
}
macro_fss_extended_read_depths_t_new(status, (*depths), depth_size);
+
if (F_status_is_error(status)) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
return status;
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range);
if (F_status_is_error(status)) {
- fss_extended_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_depth, arguments.argv[position_depth]);
return status;
}
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range);
if (F_status_is_error(status)) {
- fss_extended_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_at, arguments.argv[depths->array[i].index_at]);
return status;
}
} // for
// @todo: move error printing into common function.
if (status_code == F_memory_allocation || status_code == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status_code == f_string_length_t_size) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to process '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to process '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_trim);
fl_color_print(data.error.to.stream, data.context.set.error, "' because the maximum buffer size was reached.%c", f_string_eol[0]);
}
function = "fl_string_rip";
}
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%u", status_code);
fl_color_print(data.error.to.stream, data.context.set.error, ") has occurred while calling ");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s()", function);
}
if (!depths->array[i].value_name.used) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_name);
fl_color_print(data.error.to.stream, data.context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
for (f_array_length_t j = i + 1; j < depths->used; j++) {
if (depths->array[i].depth == depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The value '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe value '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may only be specified once for the parameter '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The parameter '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "%s%s", f_console_symbol_long_enable, fss_extended_read_long_depth);
fl_color_print(data.error.to.stream, data.context.set.error, "' may not have the value '");
fl_color_print(data.error.to.stream, data.context.set.notable, "%llu", depths->array[i].depth);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_read()");
fl_color_print(data->error.to.stream, data->context.set.error, " for the file '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s", filename);
fl_color_print(data->error.to.stream, data->context.set.error, "'.%c", f_string_eol[0]);
}
else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data->error.to.stream, data->context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_incomplete_utf_stop) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at stop position (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at stop position (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else if (status == F_incomplete_utf_eos) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ENCODING ERROR: Error occurred on invalid UTF-8 character at end of string (at ");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sError occurred on invalid UTF-8 character at end of string (at ", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%d", input.start);
fl_color_print(data->error.to.stream, data->context.set.error, ").%c", f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%u", status);
fl_color_print(data->error.to.stream, data->context.set.error, ") has occurred while calling ");
fl_color_print(data->error.to.stream, data->context.set.notable, "fll_fss_extended_read()");
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range);
if (F_status_is_error(status)) {
- fss_extended_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_select, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_select, arguments.argv[index]);
return status;
}
}
status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range);
if (F_status_is_error(status)) {
- fss_extended_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_line, arguments.argv[index], F_status_set_fine(status));
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_line, arguments.argv[index]);
return status;
}
}
#endif // _di_fss_extended_read_depths_t_
/**
- * Print file error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param file_name
- * The name of the file with the error.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_extended_read_print_file_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_read_print_file_error_
-
-/**
- * Print number parameter argument error messages.
- *
- * @param context
- * The color context information to use when printing.
- * @param function_name
- * The name of the function responsible for the error.
- * @param parameter_name
- * The name of the parameter responsible for the error.
- * @param argument
- * The value of the argument that is invalid.
- * @param status
- * The status code representing the error.
- */
-#ifndef _di_fss_extended_read_print_number_argument_error_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_fss_extended_read_print_number_argument_error_
-
-/**
* Pre-process the parameters, parsing out and handling the depth and depth related parameters.
*
* Will handle depth-sensitive parameter conflicts, such as --name being used with --at (which is not allowed).
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else if (status == F_file_open) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else if (status == F_file_descriptor) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", "-", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'%c", fll_error_print_error, "-", f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_found_not) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to find the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to find the file '%s'%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "ERROR: Unable to open the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to open the file '%s'%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "ERROR: File descriptor error while trying to open the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFile descriptor error while trying to open the file '%s'%c", fll_error_print_error, arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_write()%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sInvalid parameter when calling f_file_write()%c", fll_error_print_error, f_string_eol[0]);
}
else if (status == F_file_write) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Unable to write to the file '%s'%c", arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sUnable to write to the file '%s'%c", fll_error_print_error, arguments.argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]], f_string_eol[0]);
}
else {
- fl_color_print(data->error.to.stream, data->context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_write()%c", status, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_write()%c", fll_error_print_error, status, f_string_eol[0]);
}
f_macro_string_dynamic_t_delete_simple(buffer);
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error);
fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter ");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning);
return F_status_set_error(status);
}
else if (data->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_error);
fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter ");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine);
}
}
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_warning);
fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter ");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, fss_status_code_long_is_fine);
}
if (data->remaining.used == 0 && !data->process_pipe) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify an error code.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify an error code.%c", fll_error_print_error, f_string_eol[0]);
fss_status_code_delete_data(data);
return F_status_set_error(F_parameter);
data->error.notable = data->context.set.notable;
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);
+ fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
if (data->error.verbosity == f_console_verbosity_verbose) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
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);
+ fll_error_print(data->error, F_status_set_fine(status), "f_console_parameter_prioritize_right", F_true);
iki_read_delete_data(data);
return status;
if (data->parameters[iki_read_parameter_at].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
status = 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]);
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_at, arguments.argv[index]);
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) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_at);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
if (data->parameters[iki_read_parameter_line].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_line);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a positive number.%c", f_string_eol[0]);
}
status = 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]);
+ fll_error_parameter_integer_print(data->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_line, arguments.argv[index]);
status = F_status_set_error(F_parameter);
}
if (data->parameters[iki_read_parameter_name].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_name);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires a string.%c", f_string_eol[0]);
}
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) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute);
fl_color_print(data->error.to.stream, data->context.set.error, "' requires 3 strings.%c", f_string_eol[0]);
}
if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_substitute);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
if (data->parameters[iki_read_parameter_object].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object);
if (data->parameters[iki_read_parameter_content].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content);
if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_literal);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
if (data->parameters[iki_read_parameter_content].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_content);
if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
if (data->parameters[iki_read_parameter_total].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Cannot specify the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sCannot specify the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_whole);
fl_color_print(data->error.to.stream, data->context.set.error, "' parameter with the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_read_long_total);
status = f_file_read(file, &data->buffer);
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);
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read", F_true, "-", "process", fll_error_file_type_file);
}
else {
status = iki_read_process_buffer(arguments, "-", data);
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->error.verbosity, F_status_set_fine(status), "f_file_open", arguments.argv[data->remaining.array[i]], "process", F_true, F_true);
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[data->remaining.array[i]], "process", fll_error_file_type_file);
break;
}
status = f_file_size_by_id(file.id, &total);
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);
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments.argv[data->remaining.array[i]], "process", fll_error_file_type_file);
f_file_close(&file.id);
break;
f_file_close(&file.id);
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);
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments.argv[data->remaining.array[i]], "process", fll_error_file_type_file);
break;
}
else {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: you failed to specify one or more files.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%syou failed to specify one or more files.%c", fll_error_print_error, f_string_eol[0]);
}
status = F_status_set_error(F_parameter);
extern "C" {
#endif
-#ifndef _di_iki_read_print_error_
- f_return_status iki_read_print_error(const f_color_context_t context, const uint8_t verbosity, const f_status_t status, const f_string_t function, const bool fallback) {
-
- if (status == F_parameter) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid parameter when calling function ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (status == F_memory_allocation || status == F_memory_reallocation) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Unable to allocate memory in function ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (status == F_buffer_too_large) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum buffer limit reached while processing ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (status == F_string_too_large) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum string limit reached while processing ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") in function ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_unknown;
- }
-#endif // _di_iki_read_print_error_
-
-#ifndef _di_iki_read_print_error_file_
- bool iki_read_print_error_file(const f_color_context_t context, const uint8_t verbosity, 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 (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to find %s '", file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_file_found) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The %s '", file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "' already exists.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_parameter) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "() for the %s '", file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_name) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid %s name '", file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_memory_out) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_number_overflow) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_directory) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_access_denied) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_loop) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Loop while trying to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_prohibited) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (is_file) {
- if (status == F_directory_found_not) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
- }
- else {
- if (status == F_directory_found_not) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_failure) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
- }
-
- if (iki_read_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") occurred while trying to %s %s '", operation, file_or_directory);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_true;
- }
-#endif // _di_iki_read_print_error_file_
-
-#ifndef _di_iki_read_print_error_number_argument_
- 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(data.error.to.stream, "%c", f_string_eol[0]);
-
- if (status == F_parameter) {
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function);
- fl_color_print(data.error.to.stream, context.set.error, ".%c", f_string_eol[0]);
- }
- else if (status == F_number) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is not a valid number for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_underflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too small for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_overflow) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is too large for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_negative) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' is negative, which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_number_positive) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The argument '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "' contains a '");
- fl_color_print(data.error.to.stream, context.set.notable, "+");
- fl_color_print(data.error.to.stream, context.set.error, "', which is not allowed for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- else if (status == F_data_not) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(data.error.to.stream, context.set.error, "' must not be an empty string.%c", f_string_eol[0]);
- }
- else {
- fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") has occurred while calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s()", function);
- fl_color_print(data.error.to.stream, context.set.error, "' for the parameter '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s%s", f_console_symbol_long_enable, parameter);
- fl_color_print(data.error.to.stream, context.set.error, "' with the value '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", argument);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
- }
-#endif // _di_iki_read_print_error_number_argument_
-
#ifndef _di_iki_read_process_at_
f_return_status iki_read_process_at(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_string_range_t *range) {
if (data->parameters[iki_read_parameter_line].result != f_console_result_additional) return F_false;
status = fl_iki_read(&data->buffer, buffer_range, variable, vocabulary, content);
if (F_status_is_error(status)) {
- iki_read_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "iki_read_process_buffer_ranges_whole", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "fl_iki_read", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true);
+ fll_error_print(data->error, F_status_set_fine(status), "fl_string_append_nulless", F_true);
f_macro_string_dynamic_t_delete_simple(name);
return status;
#endif
/**
- * Print generic error messages.
- *
- * @param context
- * The color context.
- * @param verbosity
- * The verbosity level, which determines if and what should be printed.
- * @param status
- * The status code representing an error.
- * @param function
- * The name of the function where the error happened.
- * @param fallback
- * Set to F_true to print the fallback error message for unknown errors.
- *
- * @return
- * F_none is returned on successful print of known errors.
- * F_unknown is returned if the status code has no print message.
- */
-#ifndef _di_iki_read_print_error_
- extern f_return_status iki_read_print_error(const f_color_context_t context, const uint8_t verbosity, const f_status_t status, const f_string_t function, const bool fallback) f_gcc_attribute_visibility_internal;
-#endif // _di_iki_read_print_error_
-
-/**
- * Print file/directory error messages.
- *
- * @todo the fll_file_error_print() needs to be reviewed and possibly changed.
- *
- * @param context
- * The color context.
- * @param verbosity
- * The verbosity level, which determines if and what should be printed.
- * @param status
- * The error status code to report on.
- * @param function
- * The function call that returned the error.
- * @param name
- * The name of the file or directory.
- * @param operation
- * The operation that fails, such as 'create' or 'access'.
- * @param is_file
- * Set to TRUE if this is a file and FALSE if this is a directory.
- * @param fallback
- * Set to F_true to print the fallback error message for unknown errors.
- *
- * @return
- * F_true is returned if the status code has no print message.
- * F_false is returned on successful print of known errors.
- */
-#ifndef _di_iki_read_print_error_file_
- extern bool iki_read_print_error_file(const f_color_context_t context, const uint8_t verbosity, 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_iki_read_print_error_file_
-
-/**
- * Print number argument errors.
- *
- * @param context
- * The color context.
- * @param verbosity
- * The verbosity level, which determines if and what should be printed.
- * @param status
- * The error status code to report on.
- * @param function
- * The function call that returned the error.
- * @param parameter
- * The parameter name.
- * @param argument
- * The argument value.
- *
- * @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_iki_read_print_error_number_argument_
- extern 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) f_gcc_attribute_visibility_internal;
-#endif // _di_iki_read_print_error_number_argument_
-
-/**
* Determine the range based on the --at parameter.
*
* If the --at parameter is not specified in the console arguments, then range is untouched.
data->error.notable = data->context.set.notable;
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) {
+ if (data->error.verbosity != f_console_verbosity_quiet) {
+ fll_error_print(data->error, F_status_set_fine(status), "fll_program_parameter_process", F_true);
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
}
if (data->parameters[iki_write_parameter_file].result == f_console_result_additional) {
if (data->parameters[iki_write_parameter_file].additional.used > 1) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file);
fl_color_print(data->error.to.stream, data->context.set.error, "' may only be specified once.%c", f_string_eol[0]);
}
status = f_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->error.verbosity, F_status_set_fine(status), "f_file_open", arguments.argv[location], "open", 0, F_true);
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_open", F_true, arguments.argv[location], "open", fll_error_file_type_file);
}
}
}
else if (data->parameters[iki_write_parameter_file].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_file);
fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
}
if (F_status_is_fine(status) && data->parameters[iki_write_parameter_object].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
}
if (F_status_is_fine(status) && data->parameters[iki_write_parameter_content].result == f_console_result_found) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content);
fl_color_print(data->error.to.stream, data->context.set.error, "' was specified, but no value was given.%c", f_string_eol[0]);
}
if (data->parameters[iki_write_parameter_object].result != f_console_result_additional && data->parameters[iki_write_parameter_content].result != f_console_result_additional) {
if (data->error.verbosity != f_console_verbosity_quiet) {
fprintf(data->error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: No data provided, either pipe the data or use the '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sNo data provided, either pipe the data or use the '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object);
fl_color_print(data->error.to.stream, data->context.set.error, "' and the '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content);
if (F_status_is_fine(status)) {
if (data->parameters[iki_write_parameter_object].additional.used != data->parameters[iki_write_parameter_content].additional.used) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameters '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameters '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_content);
fl_color_print(data->error.to.stream, data->context.set.error, "' and '");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, iki_write_long_object);
status_pipe = f_file_read(file, &buffer);
if (F_status_is_error(status_pipe)) {
- iki_write_print_error_file(data->context, data->error.verbosity, F_status_set_fine(status_pipe), "f_file_read_to", "-", "read", 2, F_true);
+ fll_error_file_print(data->error, F_status_set_fine(status), "f_file_read_to", F_true, "-", "read", fll_error_file_type_pipe);
status = F_status_set_error(F_pipe);
break;
if (!buffer.used) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The pipe has no content.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe pipe has no content.%c", fll_error_print_error, 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->error.verbosity, F_status_set_fine(status), "fl_string_dynamic_seek_line", F_true);
+ fll_error_print(data->error, 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->error.verbosity, F_parameter, "fl_string_dynamic_seek_line", F_true);
+
+ fll_error_print(data->error, F_parameter, "fl_string_dynamic_seek_line", F_true);
break;
}
if (object_ended && previous == range.start) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The pipe has incorrectly placed newlines.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe pipe has incorrectly placed newlines.%c", fll_error_print_error, 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->error.verbosity, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
+ fll_error_print(data->error, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
break;
}
}
status = fl_string_dynamic_partial_append_nulless(buffer, range, &object);
if (F_status_is_error(status)) {
- iki_write_print_error(data->context, data->error.verbosity, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
+ fll_error_print(data->error, F_status_set_fine(status), "fl_string_dynamic_partial_append_nulless", F_true);
break;
}
if (F_status_is_fine(status) && object_ended) {
if (data->error.verbosity != f_console_verbosity_quiet) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The pipe has an object without content.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe pipe has an object without content.%c", fll_error_print_error, f_string_eol[0]);
}
status = F_status_set_error(F_parameter);
extern "C" {
#endif
-#ifndef _di_iki_write_print_error_
- f_return_status iki_write_print_error(const f_color_context_t context, const uint8_t verbosity, const f_status_t status, const f_string_t function, const bool fallback) {
-
- if (status == F_parameter) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid parameter when calling function ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (status == F_memory_allocation || status == F_memory_reallocation) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Unable to allocate memory in function ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (status == F_buffer_too_large) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum buffer limit reached while processing ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (status == F_string_too_large) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Maximum string limit reached while processing ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_none;
- }
-
- if (fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") in function ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "().%c", f_string_eol[0]);
- }
-
- return F_unknown;
- }
-#endif // _di_iki_write_print_error_
-
-#ifndef _di_iki_write_print_error_file_
- bool iki_write_print_error_file(const f_color_context_t context, const uint8_t verbosity, const f_status_t status, const f_string_t function, const f_string_t name, const f_string_t operation, const uint8_t type, const bool fallback) {
- f_string_t type_name = "file";
-
- if (type == 1) {
- type_name = "directory";
- }
- else if (type == 2) {
- type_name = "pipe";
- }
-
- if (status == F_file_found_not) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to find %s '", type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_file_closed) {
- if (verbosity != f_console_verbosity_quiet) {
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: The %s '", type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "' is no longer open.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_file_seek) {
- if (verbosity != f_console_verbosity_quiet) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: A seek error occurred while accessing the file '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_file_read) {
- if (verbosity != f_console_verbosity_quiet) {
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: A read error occurred while accessing the file '");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_file_found) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: The %s '", type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "' already exists.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_parameter) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: Invalid parameter when calling ");
- fl_color_print(data.error.to.stream, context.set.notable, "%s", function);
- fl_color_print(data.error.to.stream, context.set.error, "() for the %s '", type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_name) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid %s name '", type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_memory_out) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory, while trying to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_number_overflow) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Overflow while trying to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_directory) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Invalid directory while trying to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_access_denied) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Access denied while trying to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_loop) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Loop while trying to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_prohibited) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Prohibited by system while trying to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (!type) {
- if (status == F_directory_found_not) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
- }
- else if (type == 1) {
- if (status == F_directory_found_not) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "' due to an invalid directory in the path.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
-
- if (status == F_failure) {
- if (verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "ERROR: Failed to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_false;
- }
- }
-
- if (iki_write_print_error(context, verbosity, status, function, F_false) == F_unknown && fallback && verbosity != f_console_verbosity_quiet) {
- fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, context.set.error, "UNKNOWN ERROR: (");
- fl_color_print(data.error.to.stream, context.set.notable, "%llu", status);
- fl_color_print(data.error.to.stream, context.set.error, ") occurred while trying to %s %s '", operation, type_name);
- fl_color_print(data.error.to.stream, context.set.notable, "%s", name);
- fl_color_print(data.error.to.stream, context.set.error, "'.%c", f_string_eol[0]);
- }
-
- return F_true;
- }
-#endif // _di_iki_write_print_error_file_
-
#ifndef _di_iki_write_process_
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.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The object is missing, it must not have a length of ");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe object is missing, it must not have a length of ", fll_error_print_error);
fl_color_print(data.error.to.stream, data.context.set.notable, "0");
fl_color_print(data.error.to.stream, data.context.set.error, ".%c", f_string_eol[0]);
}
if (status == F_false) {
if (data.error.verbosity != f_console_verbosity_quiet) {
fprintf(data.error.to.stream, "%c", f_string_eol[0]);
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: The object '");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe object '", fll_error_print_error);
fl_color_print_code(f_type_error, data.context.notable);
f_print_dynamic(f_type_error, object);
return F_status_set_error(F_failure);
}
else if (F_status_is_error(status)) {
- iki_write_print_error(data.context, data.error.verbosity, F_status_set_fine(status), "f_iki_object_is", F_true);
-
+ fll_error_print(data.error, 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.error.verbosity, F_status_set_fine(status), "fll_iki_content_escape", F_true);
+ fll_error_print(data.error, 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);
#endif
/**
- * Print generic error messages.
- *
- * @param context
- * The color context.
- * @param verbosity
- * The verbosity level, which determines if and what should be printed.
- * @param status
- * The status code representing an error.
- * @param function
- * The name of the function where the error happened.
- * @param fallback
- * Set to F_true to print the fallback error message for unknown errors.
- *
- * @return
- * F_none is returned on successful print of known errors.
- * F_unknown is returned if the status code has no print message.
- */
-#ifndef _di_iki_write_print_error_
- extern f_return_status iki_write_print_error(const f_color_context_t context, const uint8_t verbosity, const f_status_t status, const f_string_t function, const bool fallback) f_gcc_attribute_visibility_internal;
-#endif // _di_iki_write_print_error_
-
-/**
- * Print file/directory error messages.
- *
- * @param context
- * The color context.
- * @param verbosity
- * The verbosity level, which determines if and what should be printed.
- * @param status
- * The error status code to report on.
- * @param function
- * The function call that returned the error.
- * @param name
- * The name of the file or directory.
- * @param operation
- * The operation that fails, such as 'create' or 'access'.
- * @param type
- * Set to 0 for "file", 1 for "directory", and 2 for "pipe".
- * @param fallback
- * Set to F_true to print the fallback error message for unknown errors.
- *
- * @return
- * F_true is returned if the status code has no print message.
- * F_false is returned on successful print of known errors.
- */
-#ifndef _di_iki_write_print_error_file_
- extern bool iki_write_print_error_file(const f_color_context_t context, const uint8_t verbosity, const f_status_t status, const f_string_t function, const f_string_t name, const f_string_t operation, const uint8_t type, const bool fallback) f_gcc_attribute_visibility_internal;
-#endif // _di_iki_write_print_error_file_
-
-/**
* Process a given object and content, printing the IKI if valid or an error if invalid.
*
* @param data
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(data->error.to.stream, data->context.set.error, "ERROR: Failed to clone services process (errno = %i).%c", errno, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to clone services process (errno = %i).%c", fll_error_print_error, 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(data->error.to.stream, data->context.set.error, "ERROR: Failed to clone control via file process (errno = %i).%c", errno, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sFailed to clone control via file process (errno = %i).%c", fll_error_print_error, errno, f_string_eol[0]);
}
*/
continue;
}
else if (errno != EINTR) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: sigwaitinfo() failed (errno = %i).%c", errno, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%ssigwaitinfo() failed (errno = %i).%c", fll_error_print_error, errno, f_string_eol[0]);
signal_problem_count++;
if (signal_problem_count > problem_count_max_signal_size) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: Max signal problem count has been reached, sleeping for a period of time.%c", errno, f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sMax signal problem count has been reached, sleeping for a period of time.%c", fll_error_print_error, errno, f_string_eol[0]);
sleep(init_panic_signal_sleep_seconds);
signal_problem_count = 0;
}
if (optional) {
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol[0]);
} else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol[0]);
}
} else {
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_open().%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol[0]);
} else if (status == F_file_found_not) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to find the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to find the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_file_open) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Unable to open the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_file_descriptor) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: File descriptor error while trying to open the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sFile descriptor error while trying to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open().%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol[0]);
}
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling f_file_read_until().%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling f_file_read_until().%c", fll_error_print_error, f_string_eol[0]);
} else if (status == F_number_overflow) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: Integer overflow while trying to buffer the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInteger overflow while trying to buffer the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_file_closed) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: The file '%s' is no longer open.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sThe file '%s' is no longer open.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_file_seek) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A seek error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sA seek error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_file_read) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: A read error occurred while accessing the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sA read error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
} else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_read_until().%c", status, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read_until().%c", fll_error_print_error, status, f_string_eol[0]);
}
return F_status_set_error(status);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.%c", filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sNo relevant data was found within the file '%s'.%c", fll_error_print_error, filename, f_string_eol[0]);
} else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.%c", f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol[0]);
} else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", status, filename, f_string_eol[0]);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.%c", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.", fll_error_print_error);
} else if (status == F_failure) {
// the error message has already been displayed.
} else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling firewall_perform_commands().", fll_error_print_error, status);
}
f_macro_fss_objects_t_delete_simple(local->rule_objects);
status = F_status_set_fine(status);
if (status == F_parameter) {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: Invalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", init_rule_core_file);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sInvalid parameter when calling fll_fss_basic_list_read() for the file '%s'.", fll_error_print_error, init_rule_core_file);
} else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
- fl_color_print(data.error.to.stream, data.context.set.error, "ERROR: No relevant data was found within the file '%s'.", init_rule_core_file);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sNo relevant data was found within the file '%s'.", fll_error_print_error, init_rule_core_file);
} else if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.", fll_error_print_error);
} else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.", status, init_rule_core_file);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_fss_basic_list_read() for the file '%s'.", fll_error_print_error, 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(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.", fll_error_print_error);
}
else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling init_load_main_rule().", fll_error_print_error, status);
}
// @todo: init_delete_data((*data));
status = F_status_set_fine(status);
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sUnable to allocate memory.", fll_error_print_error);
} else if (status == F_failure) {
// the error message has already been displayed.
} else {
- fl_color_print(data.error.to.stream, data.context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
+ fl_color_print(data.error.to.stream, data.context.set.error, "%sAn unhandled error (%u) has occurred while calling firewall_perform_commands().", fll_error_print_error, status);
}
f_macro_fss_objects_t_delete_simple((*rule_objects));
}
else {
if (status == F_memory_allocation || status == F_memory_reallocation) {
- fl_color_print(data.error.to.stream, context.set.error, "CRITICAL ERROR: Unable to allocate memory.");
+ fl_color_print(data.error.to.stream, context.set.error, "%sUnable to allocate memory.", fll_error_print_error);
}
else {
- fl_color_print(data.error.to.stream, context.set.error, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling init_load_main_rule().", status);
+ fl_color_print(data.error.to.stream, context.set.error, "%sAn unhandled error (%u) has occurred while calling init_load_main_rule().", fll_error_print_error, status);
}
}
#ifndef _di_status_code_print_help_
f_return_status status_code_print_help(const f_file_t file, const f_color_context_t context) {
+
fll_program_print_help_header(file, context, status_code_name_long, status_code_version);
fll_program_print_help_option(file, context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message.");
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error);
fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter ");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning);
return F_status_set_error(status);
}
else if (data->parameters[status_code_parameter_is_fine].result == f_console_result_found) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_error);
fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter ");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine);
}
}
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(data->error.to.stream, data->context.set.error, "ERROR: The parameter '");
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sThe parameter '", fll_error_print_error);
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_warning);
fl_color_print(data->error.to.stream, data->context.set.error, "' cannot be used with the parameter ");
fl_color_print(data->error.to.stream, data->context.set.notable, "%s%s", f_console_symbol_long_enable, status_code_long_is_fine);
}
if (data->remaining.used == 0 && !data->process_pipe) {
- fl_color_print(data->error.to.stream, data->context.set.error, "ERROR: You failed to specify a status code.%c", f_string_eol[0]);
+ fl_color_print(data->error.to.stream, data->context.set.error, "%sYou failed to specify a status code.%c", fll_error_print_error, f_string_eol[0]);
status_code_delete_data(data);
return F_status_set_error(F_parameter);
if (data->remaining.used > 0) {
for (f_array_length_t i = 0; i < data->remaining.used; i++) {
+
status2 = status_code_process_number(*data, arguments.argv[data->remaining.array[i]]);
if (F_status_is_error(status2) && status == F_none) {
f_string_length_t i = 0;
while (i < status_code_total_parameters) {
+
f_macro_string_lengths_t_delete_simple(data->parameters[i].locations);
f_macro_string_lengths_t_delete_simple(data->parameters[i].additional);
i++;