Convert firewall and the fss read programs.
Update byte_dump, contoller, and fake.
Add -O2 optimization by default.
fll_program_print_help_usage(output, context, byte_dump_name, "filename(s)");
- f_print_terminated(" When using the ", output.stream);
- fl_print_format("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_text, context.set.notable);
- f_print_terminated(" option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.", output.stream);
+ fl_print_format(" When using the %[%s%s%] option, some UTF-8 characters may be replaced by your instance and cause display alignment issues.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_text, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- f_print_character(f_string_eol_s[0], output.stream);
- f_print_character(f_string_eol_s[0], output.stream);
-
- f_print_terminated(" Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the ", output.stream);
- fl_print_format("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_placeholder, context.set.notable);
- f_print_terminated(" option is used).", output.stream);
-
- f_print_character(f_string_eol_s[0], output.stream);
- f_print_character(f_string_eol_s[0], output.stream);
+ fl_print_format(" Special UTF-8 characters and non-spacing UTF-8 characters may be replaced with a space (or a placeholder when the %[%s%s%] option is used).%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_placeholder, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- f_print_terminated(" UTF-8 \"Combining\" characters might have a space appended to allow a proper display but this may cause copy and paste issues.", output.stream);
+ fl_print_format(" UTF-8 \"Combining\" characters might have a space appended to allow a proper display but this may cause copy and paste issues.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- f_print_character(f_string_eol_s[0], output.stream);
- f_print_character(f_string_eol_s[0], output.stream);
+ fl_print_format(" When %[%s%s%] is used, any UTF-8 sequences will still be printed in full should any part is found within the requested range.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- f_print_terminated(" When ", output.stream);
- fl_print_format("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last, context.set.notable);
- f_print_terminated(" is used, any UTF-8 sequences will still be printed in full should any part is found within the requested range.", output.stream);
-
- f_print_character(f_string_eol_s[0], output.stream);
- f_print_character(f_string_eol_s[0], output.stream);
-
- f_print_terminated(" When using the ", output.stream);
- fl_print_format("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_unicode, context.set.notable);
- f_print_terminated(" option, invalid Unicode will fallback to being displayed using one of the other modes.", output.stream);
-
- f_print_character(f_string_eol_s[0], output.stream);
- f_print_character(f_string_eol_s[0], output.stream);
+ fl_print_format(" When using the %[%s%s%] option, invalid Unicode will fallback to being displayed using one of the other modes.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_unicode, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
funlockfile(output.stream);
fll_program_print_help_usage(output, context, controller_name, "entry");
- f_print_terminated(" When both the ", output.stream);
- fl_print_format("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, controller_long_simulate, context.set.notable);
- f_print_terminated(" parameter and the ", output.stream);
- fl_print_format("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, controller_long_validate, context.set.notable);
- f_print_terminated(" parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.", output.stream);
- f_print_character(f_string_eol_s[0], output.stream);
+ fl_print_format(" When both the %[%s%s%] parameter and the", output.stream, context.set.notable, f_console_symbol_long_enable_s, controller_long_simulate, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, controller_long_validate, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
funlockfile(output.stream);
fll_program_print_help_usage(output, context, fake_name, "operation");
- f_print_terminated(" When performing the ", output.stream);
- fl_print_format("%[%s%]", output.stream, context.set.notable, fake_other_operation_build, context.set.notable);
- f_print_terminated(" operation, the ", output.stream);
- fl_print_format("%[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_mode, context.set.notable);
- fl_print_format(" parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global.%c", output.stream, f_string_eol_s[0]);
-
- f_print_terminated(" For example, when a ", output.stream);
- fl_print_format("%[%s%]", output.stream, context.set.notable, fake_make_parameter_variable_mode, context.set.notable);
+ fl_print_format(" When performing the %[%s%] operation, the", output.stream, context.set.notable, fake_other_operation_build, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter specifies a name (limited to alpha-numeric, underscore, and dash) to be used in addition to the global.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_mode, context.set.notable, f_string_eol_s[0]);
+
+ fl_print_format(" For example, when a %[%s%]", output.stream, context.set.notable, fake_make_parameter_variable_mode, context.set.notable);
fl_print_format(" of 'fll_monolithic' is specified, build libraries from both 'build_libraries' and 'build_libraries-fll_monolithic' are used (but not 'build_libraries-fll_level').%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- f_print_terminated(" When specifying the ", output.stream);
- fl_print_format("%[%s%]", output.stream, context.set.notable, fake_make_parameter_variable_fakefile, context.set.notable);
- f_print_terminated(" or the ", output.stream);
- fl_print_format("%[%s%]", output.stream, context.set.notable, fake_make_parameter_variable_settings, context.set.notable);
+ fl_print_format(" When specifying the %[%s%] or the %[%s%]", output.stream, context.set.notable, fake_make_parameter_variable_fakefile, context.set.notable, context.set.notable, fake_make_parameter_variable_settings, context.set.notable);
fl_print_format(" parameters, the filenames are relative to the data build directory, unless a path is used.%c", output.stream, f_string_eol_s[0]);
- f_print_terminated(" For example, with '", output.stream);
- fl_print_format("%[%s%s my_fakefile%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile, context.set.notable);
- f_print_terminated("' the fakefile at '", output.stream);
- fl_print_format("%[./%s%smy_fakefile%]", output.stream, context.set.notable, fake_default_path_data, fake_default_path_build, context.set.notable);
- f_print_terminated("' would be used, however with '", output.stream);
- fl_print_format("%[%s%s ./my_fakefile%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile, context.set.notable);
- f_print_terminated("' the fakefile at '", output.stream);
- fl_print_format("%[./my_fakefile%]", output.stream, context.set.notable, context.set.notable);
- fl_print_format("' would be used.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" For example, with '%[%s%s my_fakefile%]' the fakefile at", output.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile, context.set.notable);
+ fl_print_format(" '%[./%s%smy_fakefile%]' would be used, however with", output.stream, context.set.notable, fake_default_path_data, fake_default_path_build, context.set.notable);
+ fl_print_format(" '%[%s%s ./my_fakefile%]' the fakefile at", output.stream, context.set.notable, f_console_symbol_long_enable_s, fake_long_fakefile, context.set.notable);
+ fl_print_format(" '%[./my_fakefile%]' would be used.%c%c", output.stream, context.set.notable, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
funlockfile(output.stream);
#ifndef _di_firewall_print_help_
f_status_t firewall_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, firewall_name_long, firewall_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c%c", f_string_eol_s[0], f_string_eol_s[0]);
- f_color_print(output.stream, context.set.important, " Available Commands: ");
-
- fprintf(output.stream, "%c ", f_string_eol_s[0]);
- f_color_print(output.stream, context.set.standout, firewall_command_start);
- fprintf(output.stream, " Turn on the firewall");
-
- fprintf(output.stream, "%c ", f_string_eol_s[0]);
- f_color_print(output.stream, context.set.standout, firewall_command_stop);
- fprintf(output.stream, " Turn off the firewall");
-
- fprintf(output.stream, "%c ", f_string_eol_s[0]);
- f_color_print(output.stream, context.set.standout, firewall_command_restart);
- fprintf(output.stream, " Turn off and then turn on the firewall");
-
- fprintf(output.stream, "%c ", f_string_eol_s[0]);
- f_color_print(output.stream, context.set.standout, firewall_command_lock);
- fprintf(output.stream, " Prevent all communication");
-
- fprintf(output.stream, "%c ", f_string_eol_s[0]);
- f_color_print(output.stream, context.set.standout, firewall_command_show);
- fprintf(output.stream, " Show active firewall settings");
+ fl_print_format("%c%c %[Available Commands:%] ", output.stream, f_string_eol_s[0], f_string_eol_s[0], context.set.important, context.set.important);
+ fl_print_format("%c %[%s%] Turn on the firewall.", output.stream, context.set.standout, firewall_command_start, context.set.standout);
+ fl_print_format("%c %[%s%] Turn off the firewall.", output.stream, context.set.standout, firewall_command_stop, context.set.standout);
+ fl_print_format("%c %[%s%] Turn off and then turn on the firewall.", output.stream, context.set.standout, firewall_command_restart, context.set.standout);
+ fl_print_format("%c %[%s%] Prevent all communication.", output.stream, context.set.standout, firewall_command_lock, context.set.standout);
+ fl_print_format("%c %[%s%] Show active firewall settings.", output.stream, context.set.standout, firewall_command_show, context.set.standout);
fll_program_print_help_usage(output, context, firewall_name, "command");
+ funlockfile(output.stream);
+
return F_none;
}
#endif // _di_firewall_print_help_
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == firewall_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == firewall_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == firewall_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == firewall_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
if (strncmp("nat", arguments.argv[main->remaining.array[counter]], 4) != 0) {
if (strncmp("mangle", arguments.argv[main->remaining.array[counter]], 7) != 0) {
if (strncmp("ports", arguments.argv[main->remaining.array[counter]], 6) != 0) {
- f_color_print(f_type_warning, main->context.set.warning, "%s'%s' is not a valid show option%c", fll_error_print_warning, arguments.argv[main->remaining.array[counter]], f_string_eol_s[0]);
+ flockfile(main->warning.to.stream);
+
+ fl_print_format("%c%[%S'%]", main->warning.to.stream, f_string_eol_s[0], main->warning.context, main->warning.prefix, main->warning.context);
+ fl_print_format("%[%S%]", main->warning.to.stream, main->warning.notable, arguments.argv[main->remaining.array[counter]], main->warning.notable);
+ fl_print_format("%[' is not a valid show option.%]%c", main->warning.to.stream, main->warning.context, main->warning.context, f_string_eol_s[0]);
+
+ funlockfile(main->warning.to.stream);
+ fflush(main->warning.to.stream);
}
else {
show_ports = F_true;
macro_f_string_dynamics_t_resize(status, parameters, 7);
if (F_status_is_error(status)) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main->error);
firewall_delete_local_data(&local);
firewall_main_delete(main);
}
if (show_nat) {
- f_color_print(main->output.stream, main->context.set.standout, "=========================== ");
- f_color_print(main->output.stream, main->context.set.title, "NAT");
- f_color_print(main->output.stream, main->context.set.standout, " ============================%c", f_string_eol_s[0]);
+ fll_print_format("%[===========================%] %[NAT%] %[============================%]%c", main->output.stream, main->context.set.standout, main->context.set.standout, main->context.set.title, main->context.set.title, main->context.set.standout, main->context.set.standout, f_string_eol_s[0]);
fflush(main->output.stream);
parameters.used = 6;
exit(return_code);
}
- fprintf(main->output.stream, "\n");
+ fll_print_character(f_string_eol_s[0], main->output.stream);
fflush(main->output.stream);
}
if (F_status_is_error_not(status) && show_mangle) {
- f_color_print(main->output.stream, main->context.set.standout, "========================== ");
- f_color_print(main->output.stream, main->context.set.title, "MANGLE");
- f_color_print(main->output.stream, main->context.set.standout, " ==========================%c", f_string_eol_s[0]);
+ fll_print_format("%[==========================%] %[MANGLE%] %[==========================%]%c", main->output.stream, main->context.set.standout, main->context.set.standout, main->context.set.title, main->context.set.title, main->context.set.standout, main->context.set.standout, f_string_eol_s[0]);
fflush(main->output.stream);
parameters.used = 6;
exit(return_code);
}
- fprintf(main->output.stream, "\n");
+ fll_print_character(f_string_eol_s[0], main->output.stream);
fflush(main->output.stream);
}
if (F_status_is_error_not(status) && show_ports) {
- f_color_print(main->output.stream, main->context.set.standout, "========================== ");
- f_color_print(main->output.stream, main->context.set.title, "FILTER");
- f_color_print(main->output.stream, main->context.set.standout, " ==========================%c", f_string_eol_s[0]);
+ fll_print_format("%[==========================%] %[FILTER%] %[==========================%]%c", main->output.stream, main->context.set.standout, main->context.set.standout, main->context.set.title, main->context.set.title, main->context.set.standout, main->context.set.standout, f_string_eol_s[0]);
fflush(main->output.stream);
parameters.used = 4;
exit(return_code);
}
- fprintf(main->output.stream, "\n");
+ fll_print_character(f_string_eol_s[0], main->output.stream);
fflush(main->output.stream);
}
status = F_status_set_fine(status);
if (status == F_memory_not) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main->error);
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_iptables, f_string_eol_s[0]);
- fprintf(f_type_error, " ");
-
- f_array_length_t i = 0;
-
- f_color_print_code(f_type_error, main->context.error);
-
- fprintf(f_type_error, "%s ", firewall_tool_iptables);
- for (; i < parameters.used; ++i) {
- fprintf(f_type_error, "%s ", parameters.array[i].string);
- } // for
-
- f_color_print_code(f_type_error, main->context.reset);
- fprintf(f_type_error, "\n");
+ firewall_print_error_on_operation(main->error, firewall_tool_iptables, parameters);
}
status = F_status_set_error(status);
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if (status == F_memory_not) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else if (status == F_data_not) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCould not find any network devices%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else if (status == F_failure) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to read the device directory '%s'%c", fll_error_print_error, network_devices, f_string_eol_s[0]);
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ if (status == F_memory_not) {
+ firewall_print_error_on_allocation_failure(main->error);
+ }
+ else if (status == F_data_not) {
+ fll_print_format("%c%[%sCould not find any network devices.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_failure) {
+ fll_print_format("%c%[%sFailed to read the device directory '%s'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, network_devices, main->error.context, f_string_eol_s[0]);
+ }
}
firewall_delete_local_data(&local);
f_array_length_t i = 0;
for (; i < main->devices.used; ++i) {
+
if (fl_string_compare((f_string_t) firewall_device_loop, main->devices.array[i].string, firewall_device_loop_length + 1, main->devices.array[i].used) == F_equal_to) {
f_string_dynamic_t swap_string = main->devices.array[i];
return status;
}
else {
- f_color_print(main->error.to.stream, main->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_s[0]);
+
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ fll_print_format("%c%[%sFailed to perform lock request because the lock instructions are missing from: %s.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, network_path firewall_file_other, main->error.context, f_string_eol_s[0]);
+ }
firewall_delete_local_data(&local);
firewall_main_delete(main);
}
}
else {
- f_color_print(main->error.to.stream, main->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_s[0]);
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ fll_print_format("%c%[%sFailed to perform stop request because the lock instructions are missing from: %s.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, network_path firewall_file_other, main->error.context, f_string_eol_s[0]);
+ }
firewall_delete_local_data(&local);
firewall_main_delete(main);
macro_f_string_dynamic_t_resize(status, file_path, network_path_length + main->devices.array[i].used + firewall_file_suffix_length + 1);
if (F_status_is_error(status)) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main->error);
+
firewall_delete_local_data(&local);
firewall_main_delete(main);
return status;
firewall_delete_local_data(&local);
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou did not pass a command%c", fll_error_print_error, f_string_eol_s[0]);
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ fll_print_format("%c%[%sYou did not pass a command.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
+ }
+
status = F_status_set_error(F_parameter);
}
// fll-1 includes
#include <fll/level_1/console.h>
#include <fll/level_1/string.h>
+#include <fll/level_1/print.h>
// fll-2 includes
#include <fll/level_2/error.h>
#include <fll/level_2/fss_basic.h>
#include <fll/level_2/fss_basic_list.h>
#include <fll/level_2/fss_extended.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#ifdef __cplusplus
firewall_parameter_verbosity_normal,
firewall_parameter_verbosity_verbose,
firewall_parameter_verbosity_debug,
-
firewall_parameter_version,
firewall_parameter_command_start,
f_console_parameter_t_initialize(f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_normal_s, f_console_standard_long_normal_s, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, 0, f_console_type_inverse), \
- f_console_parameter_t_initialize(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, 0, f_console_type_inverse), \
f_console_parameter_t_initialize(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, 0, f_console_type_inverse), \
+ f_console_parameter_t_initialize(f_console_standard_short_version_s, f_console_standard_long_version_s, 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_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_string_dynamics_t chains;
f_string_dynamics_t devices;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
f_color_context_t_initialize, \
extern "C" {
#endif
+void firewall_print_debug_tool(const fll_error_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) {
+
+ if (output.verbosity != f_console_verbosity_debug) return;
+
+ flockfile(output.to.stream);
+
+ fl_print_format("%[%s", output.to.stream, output.context, tool);
+
+ for (f_array_length_t i = 0; i < arguments.used; ++i) {
+ fl_print_format(" %Q", output.to.stream, arguments.array[i]);
+ } // for
+
+ fl_print_format("%]%c", output.to.stream, output.context, f_string_eol_s[0]);
+
+ funlockfile(output.to.stream);
+}
+
+void firewall_print_error_on_allocation_failure(const fll_error_print_t output) {
+
+ if (output.verbosity == f_console_verbosity_quiet) return;
+
+ fll_print_format("%c%[%sUnable to allocate memory.%]%c", output.to.stream, f_string_eol_s[0], output.context, output.prefix, output.context, f_string_eol_s[0]);
+}
+
+void firewall_print_error_on_invalid_parameter(const fll_error_print_t output, const f_string_t function) {
+
+ if (output.verbosity == f_console_verbosity_quiet) return;
+
+ fll_print_format("%c%[%sInvalid parameter when calling %S().%]%c", output.to.stream, f_string_eol_s[0], output.context, output.prefix, function, output.context, f_string_eol_s[0]);
+}
+
+void firewall_print_error_on_invalid_parameter_for_file(const fll_error_print_t output, const f_string_t function, const f_string_t filename) {
+
+ if (output.verbosity == f_console_verbosity_quiet) return;
+
+ fll_print_format("%c%[%sInvalid parameter when calling %S() for the file '%S'.%]%c", output.to.stream, f_string_eol_s[0], output.context, output.prefix, function, filename, output.context, f_string_eol_s[0]);
+}
+
+void firewall_print_error_on_operation(const fll_error_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) {
+
+ if (output.verbosity == f_console_verbosity_quiet) return;
+
+ flockfile(output.to.stream);
+
+ fl_print_format("%c%[%sFailed to perform requested %s operation:%]", output.to.stream, f_string_eol_s[0], output.context, output.prefix, tool, output.context);
+ fl_print_format("%c %[%s", output.to.stream, f_string_eol_s[0], output.context, tool);
+
+ for (f_array_length_t i = 0; i < arguments.used; ++i) {
+ fl_print_format(" %Q", output.to.stream, arguments.array[i]);
+ } // for
+
+ fl_print_format("%]%c", output.to.stream, output.context, f_string_eol_s[0]);
+
+ funlockfile(output.to.stream);
+}
+
+void firewall_print_error_on_unhandled(const fll_error_print_t output, const f_string_t function, const f_status_t status) {
+
+ if (output.verbosity == f_console_verbosity_quiet) return;
+
+ fll_print_format("%c%[%sAn unhandled error (%ui) has occurred while calling %S().%]%c", output.to.stream, f_string_eol_s[0], output.context, output.prefix, status, function, output.context, f_string_eol_s[0]);
+}
+
+void firewall_print_error_on_unhandled_for_file(const fll_error_print_t output, const f_string_t function, const f_status_t status, const f_string_t filename) {
+
+ if (output.verbosity == f_console_verbosity_quiet) return;
+
+ fll_print_format("%c%[%sAn unhandled error (%ui) has occurred while calling %S() for the file '%S'.%]%c", output.to.stream, f_string_eol_s[0], output.context, output.prefix, status, function, filename, output.context, f_string_eol_s[0]);
+}
+
#ifdef __cplusplus
} // extern "C"
#endif
\
macro_f_string_dynamic_t_clear(argument);
+/**
+ * Print debug information about tool execution.
+ *
+ * @param output
+ * The output to print to.
+ * @param tool
+ * The iptables tool.
+ * @param arguments
+ * The arguments passed to the tool.
+ */
+extern void firewall_print_debug_tool(const fll_error_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) f_attribute_visibility_internal;
+
+/**
+ * Print an memory allocation error.
+ *
+ * @param output
+ * The output to print to.
+ */
+extern void firewall_print_error_on_allocation_failure(const fll_error_print_t output) f_attribute_visibility_internal;
+
+/**
+ * Print an invalid parameter error for the given function.
+ *
+ * @param output
+ * The output to print to.
+ * @param function
+ * The function that failed.
+ */
+extern void firewall_print_error_on_invalid_parameter(const fll_error_print_t output, const f_string_t function) f_attribute_visibility_internal;
+
+/**
+ * Print an invalid parameter error for the given function.
+ *
+ * @param output
+ * The output to print to.
+ * @param function
+ * The function that failed.
+ * @param filename
+ * The name of the file.
+ */
+extern void firewall_print_error_on_invalid_parameter_for_file(const fll_error_print_t output, const f_string_t function, const f_string_t filename) f_attribute_visibility_internal;
+
+/**
+ * Print an error about the given operation failed.
+ *
+ * @param output
+ * The output to print to.
+ * @param tool
+ * The iptables tool that failed.
+ * @param arguments
+ * The arguments passed to the tool.
+ */
+extern void firewall_print_error_on_operation(const fll_error_print_t output, const f_string_t tool, const f_string_dynamics_t arguments) f_attribute_visibility_internal;
+
+/**
+ * Print an unhandled error for the given function.
+ *
+ * @param output
+ * The output to print to.
+ * @param function
+ * The function that failed.
+ * @param status
+ * The failure status code.
+ */
+extern void firewall_print_error_on_unhandled(const fll_error_print_t output, const f_string_t function, const f_status_t status) f_attribute_visibility_internal;
+
+/**
+ * Print an unhandled error for the given function for some given file.
+ *
+ * @param output
+ * The output to print to.
+ * @param function
+ * The function that failed.
+ * @param status
+ * The failure status code.
+ * @param filename
+ * The name of the file.
+ */
+extern void firewall_print_error_on_unhandled_for_file(const fll_error_print_t output, const f_string_t function, const f_status_t status, const f_string_t filename) f_attribute_visibility_internal;
+
#ifdef __cplusplus
} // extern "C"
#endif
// process chain rule
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, "%sAt line %llu, the chain option is meaningle ss inside of a custom chain.", fll_error_print_warning, i);
+ fll_print_format("%c%[%sAt line %ul, the chain option is meaningless inside of a custom chain.%]%c", main.warning.to.stream, f_string_eol_s[0], main.warning.context, main.warning.prefix, i, main.warning.context, f_string_eol_s[0]);
continue;
}
}
// process rule rule, if the remaining rule does not match as firewall_rule, then it is an invalid rule.
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) {
- f_color_print_code(f_type_warning, main.context.warning);
- fprintf(f_type_warning, "%sAt line %llu, 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");
- f_color_print_code(f_type_warning, main.context.reset);
+ if (length) {
+ flockfile(main.warning.to.stream);
+
+ fl_print_format("%c%[%sAt line %ul, the object '%]%[", main.warning.to.stream, f_string_eol_s[0], main.warning.context, main.warning.prefix, i, main.warning.context, main.warning.notable);
+ f_print(local.buffer.string + local.rule_objects.array[i].start, length, main.warning.to.stream);
+ fl_print_format("%]%[' is invalid.%]%c", main.warning.to.stream, main.warning.notable, main.warning.context, main.warning.context, f_string_eol_s[0]);
+
+ funlockfile(main.warning.to.stream);
}
else {
- fprintf(f_type_warning, "%sAt line %llu, the object is missing", fll_error_print_warning, i);
+ fll_print_format("%c%[%sAt line %ul, the object is missing.%]%c", main.warning.to.stream, f_string_eol_s[0], main.warning.context, main.warning.prefix, i, main.warning.context, f_string_eol_s[0]);
}
- fprintf(f_type_warning, "\n");
continue;
}
if (invalid) {
length = macro_firewall_structure_size(local.rule_objects, i);
- if (length > 0) {
- f_color_print_code(f_type_warning, main.context.warning);
- fprintf(f_type_warning, "%sAt line %llu, 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, macro_firewall_structure_size(local.rule_contents.array[i], 0));
- fprintf(f_type_warning, "'");
- f_color_print_code(f_type_warning, main.context.reset);
- fprintf(f_type_warning, "\n");
+ if (length) {
+ flockfile(main.warning.to.stream);
+
+ fl_print_format("%c%[%sAt line %ul, the object '%]%[", main.warning.to.stream, f_string_eol_s[0], main.warning.context, main.warning.prefix, i, main.warning.context, main.warning.notable);
+ f_print(local.buffer.string + local.rule_objects.array[i].start, length, main.warning.to.stream);
+ fl_print_format("%]%[' has invalid content '%]%[", main.warning.to.stream, main.warning.notable, main.warning.context, main.warning.context, main.warning.notable);
+ f_print(local.buffer.string + local.rule_contents.array[i].array[0].start, macro_firewall_structure_size(local.rule_contents.array[i], 0), main.warning.to.stream);
+ fl_print_format("%]%['.%]%c", main.warning.to.stream, main.warning.notable, main.warning.context, main.warning.context, f_string_eol_s[0]);
+
+ funlockfile(main.warning.to.stream);
}
else {
- f_color_print(f_type_warning, main.context.set.warning, "%sAt line %llu, the object has no content%c", fll_error_print_warning, i, f_string_eol_s[0]);
+ fll_print_format("%c%[%sAt line %ul, the object has no content.%]%c", main.warning.to.stream, f_string_eol_s[0], main.warning.context, main.warning.prefix, i, main.warning.context, f_string_eol_s[0]);
}
continue;
else {
length = macro_firewall_structure_size(local.rule_objects, i);
- f_color_print_code(f_type_warning, main.context.warning);
- fprintf(f_type_warning, "%sAt line %llu, 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");
- f_color_print_code(f_type_warning, main.context.reset);
- fprintf(f_type_warning, "\n");
+ flockfile(main.warning.to.stream);
+
+ fl_print_format("%c%[%sAt line %ul, the object '%]%[", main.warning.to.stream, f_string_eol_s[0], main.warning.context, main.warning.prefix, i, main.warning.context, main.warning.notable);
+ f_print(local.buffer.string + local.rule_objects.array[i].start, length, main.warning.to.stream);
+ fl_print_format("%]%[' has no content.%]%c", main.warning.to.stream, main.warning.notable, main.warning.context, main.warning.context, f_string_eol_s[0]);
+
+ funlockfile(main.warning.to.stream);
break;
}
status = F_status_set_fine(status);
if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling f_file_open()%c", fll_error_print_error, f_string_eol_s[0]);
+ if (main.error.verbosity != f_console_verbosity_quiet) {
+ firewall_print_error_on_invalid_parameter(main.error, "f_file_open");
+ }
}
else if (status == F_file_found_not) {
+
// the file does not have to exist
- f_color_print(f_type_warning, main.context.set.warning, "%sCannot find the file '%.*s'%c", fll_error_print_warning, file_path.used, file_path.string, f_string_eol_s[0]);
+ if (main.error.verbosity != f_console_verbosity_verbose || main.error.verbosity == f_console_verbosity_debug) {
+ fll_print_format("%c%[%sCannot find the file '%Q'.%]%c", main.warning.to.stream, f_string_eol_s[0], main.warning.context, main.warning.prefix, file_path, main.warning.context, f_string_eol_s[0]);
+ }
+
status = F_none;
}
else if (status == F_file_open) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to open the file '%.*s'%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]);
+ if (main.error.verbosity != f_console_verbosity_quiet) {
+ fll_print_format("%c%[%sUnable to open the file '%Q'.%]%c", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, file_path, main.error.context, f_string_eol_s[0]);
+ }
}
else if (status == F_file_descriptor) {
- f_color_print(main.error.to.stream, main.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_s[0]);
+ if (main.error.verbosity != f_console_verbosity_quiet) {
+ fll_print_format("%c%[%sFile descriptor error while trying to open the file '%Q'.%]%c", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, file_path, main.error.context, f_string_eol_s[0]);
+ }
}
else if (status == F_memory_not) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main.error);
}
else {
- f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open()%c", fll_error_print_error, status, f_string_eol_s[0]);
+ firewall_print_error_on_unhandled(main.error, "f_file_open", status);
}
if (status != F_file_found_not) {
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling f_file_read()%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else if (status == F_number_overflow) {
- f_color_print(main.error.to.stream, main.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_s[0]);
- }
- else if (status == F_file_closed) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sThe file '%.*s' is no longer open%c", fll_error_print_error, file_path.used, file_path.string, f_string_eol_s[0]);
- }
- else if (status == F_file_seek) {
- f_color_print(main.error.to.stream, main.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_s[0]);
- }
- else if (status == F_file_read) {
- f_color_print(main.error.to.stream, main.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_s[0]);
- }
- else if (status == F_memory_not) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else {
- f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read()%c", fll_error_print_error, status, f_string_eol_s[0]);
+ if (main.error.verbosity != f_console_verbosity_quiet) {
+ if (status == F_parameter) {
+ firewall_print_error_on_invalid_parameter(main.error, "f_file_read");
+ }
+ else if (status == F_number_overflow) {
+ fll_print_format("%c%[%sInteger overflow while trying to buffer the file '%Q'.%]%c", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, file_path, main.error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_closed) {
+ fll_print_format("%c%[%sThe file '%Q' is no longer open.%]%c", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, file_path, main.error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_seek) {
+ fll_print_format("%c%[%sA seek error occurred while accessing the file '%Q'.%]%c", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, file_path, main.error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_read) {
+ fll_print_format("%c%[%sA read error occurred while accessing the file '%Q'.%]%c", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, file_path, main.error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_memory_not) {
+ firewall_print_error_on_allocation_failure(main.error);
+ }
+ else {
+ firewall_print_error_on_unhandled(main.error, "f_file_read", status);
+ }
}
status = F_status_set_error(status);
status = F_status_set_fine(status);
if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.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_s[0]);
+ firewall_print_error_on_invalid_parameter_for_file(main.error, "fll_fss_basic_read", file_path.used ? file_path.string : "");
}
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_not) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main.error);
}
else {
- f_color_print(main.error.to.stream, main.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_s[0]);
+ firewall_print_error_on_unhandled_for_file(main.error, "fll_fss_basic_read", status, file_path.used ? file_path.string : "");
}
status = F_status_set_error(status);
}
if (F_status_is_error(status)) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main.error);
macro_f_string_dynamic_t_delete_simple(ip_list_action);
}
macro_f_string_dynamic_t_resize(status, ip_argument, ip_length);
if (F_status_is_error(status)) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main.error);
+
break;
}
macro_firewall_append_argument_to_arguments(status, arguments, ip_argument)
if (F_status_is_error(status)) break;
- if (main.error.verbosity == f_console_verbosity_debug) {
- f_color_print_code(f_type_debug, main.context.warning);
- fprintf(f_type_debug, "%s ", current_tool);
-
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_debug, main.context.reset);
- fprintf(f_type_debug, "\n");
- }
+ firewall_print_debug_tool(main.warning, current_tool, arguments);
status = fll_execute_program((f_string_t) current_tool, arguments, 0, 0, (void *) &return_code);
}
if (status == F_failure) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, current_tool, f_string_eol_s[0]);
- fprintf(f_type_error, " ");
-
- f_color_print_code(f_type_error, main.context.error);
-
- fprintf(f_type_error, "%s ", current_tool);
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_error, main.context.reset);
- fprintf(f_type_error, "\n");
+ firewall_print_error_on_operation(main.error, current_tool, arguments);
// remove ip_argument from arguments string.
macro_f_string_dynamic_t_delete_simple(arguments.array[arguments.used--]);
break;
}
else if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_invalid_parameter(main.error, "fll_execute_program");
// remove ip_argument from arguments string.
macro_f_string_dynamic_t_delete_simple(arguments.array[arguments.used--]);
if (status == F_failure || status == F_parameter) break;
}
else {
- if (main.error.verbosity == f_console_verbosity_debug) {
- f_color_print_code(f_type_debug, main.context.warning);
- fprintf(f_type_debug, "%s ", current_tool);
-
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_debug, main.context.reset);
- fprintf(f_type_debug, "\n");
- }
+ firewall_print_debug_tool(main.warning, current_tool, arguments);
status = fll_execute_program(current_tool, arguments, 0, 0, (void *) &return_code);
}
if (status == F_failure) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, current_tool, f_string_eol_s[0]);
- fprintf(f_type_error, " ");
- f_color_print_code(f_type_error, main.context.error);
-
- fprintf(f_type_error, "%s ", current_tool);
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_error, main.context.reset);
- fprintf(f_type_error, "\n");
+ firewall_print_error_on_operation(main.error, current_tool, arguments);
break;
}
else if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_invalid_parameter(main.error, "fll_execute_program");
+
break;
}
}
status = f_string_dynamics_resize(2, &arguments);
if (F_status_is_error(status)) return status;
- status = f_string_dynamic_resize(firewall_chain_create_command_length, &arguments.array[0]);
+ status = f_string_dynamic_resize(firewall_chain_create_command_length + 1, &arguments.array[0]);
if (F_status_is_error(status)) {
macro_f_string_dynamics_t_delete_simple(arguments);
macro_firewall_concat_string(arguments.array[0].string, firewall_chain_create_command, firewall_chain_create_command_length);
arguments.array[0].used = firewall_chain_create_command_length;
+ arguments.array[0].string[firewall_chain_create_command_length] = 0;
status = f_string_dynamic_increase(f_memory_default_allocation_small, &arguments.array[1]);
arguments.array[1].used = 0;
if (length > arguments.array[1].size) {
- macro_f_string_dynamic_t_resize(status, arguments.array[1], length);
+ macro_f_string_dynamic_t_resize(status, arguments.array[1], length + 1);
if (F_status_is_error(status)) {
macro_f_string_dynamics_t_delete_simple(arguments);
}
}
- macro_f_string_dynamic_t_resize(status, main->chains.array[main->chains.used], length);
+ macro_f_string_dynamic_t_resize(status, main->chains.array[main->chains.used], length + 1);
if (F_status_is_error(status)) {
macro_f_string_dynamics_t_delete_simple(arguments);
main->chains.array[main->chains.used].used = 0;
local->chain_ids.array[i] = main->chains.used;
- arguments.array[1].used = 0;
j = local->chain_objects.array[i].start;
// copy the string character by character, ignoring placeholders.
++j;
} // while
+ arguments.array[1].string[arguments.array[1].used] = 0;
+ main->chains.array[main->chains.used].string[main->chains.array[main->chains.used].used] = 0;
+
if (fl_string_compare(arguments.array[1].string, firewall_chain_forward, arguments.array[1].used, firewall_chain_forward_length) == F_equal_to) {
create_chain = F_false;
}
}
if (create_chain) {
- if (main->error.verbosity == f_console_verbosity_debug) {
- f_color_print_code(f_type_debug, main->context.warning);
- fprintf(f_type_debug, "%s ", firewall_tool_iptables);
-
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_debug, main->context.reset);
- fprintf(f_type_debug, "\n");
- }
+ firewall_print_debug_tool(main->warning, firewall_tool_iptables, arguments);
tool = firewall_program_iptables;
status = fll_execute_program((f_string_t) firewall_tool_iptables, arguments, 0, 0, (void *) &return_code);
}
if (F_status_is_error_not(status)) {
- if (main->error.verbosity == f_console_verbosity_debug) {
- f_color_print_code(f_type_debug, main->context.warning);
- fprintf(f_type_debug, "%s ", firewall_tool_ip6tables);
-
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_debug, main->context.reset);
- fprintf(f_type_debug, "\n");
- }
+ firewall_print_debug_tool(main->warning, firewall_tool_ip6tables, arguments);
tool = firewall_program_ip6tables;
status = fll_execute_program((f_string_t) firewall_tool_ip6tables, arguments, 0, 0, (void *) &return_code);
status = F_status_set_fine(status);
if (status == F_failure) {
- if (tool == firewall_program_iptables) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_iptables, f_string_eol_s[0]);
- }
- else if (tool == firewall_program_ip6tables) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, firewall_tool_ip6tables, f_string_eol_s[0]);
- }
-
- fprintf(f_type_error, " ");
- f_color_print_code(f_type_error, main->context.error);
-
- if (tool == firewall_program_iptables) {
- fprintf(f_type_error, "%s ", firewall_tool_iptables);
- }
- else if (tool == firewall_program_ip6tables) {
- fprintf(f_type_error, "%s ", firewall_tool_ip6tables);
- }
-
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_error, main->context.reset);
- fprintf(f_type_error, "\n");
+ firewall_print_error_on_operation(main->error, tool == firewall_program_iptables ? firewall_tool_iptables : firewall_tool_ip6tables, arguments);
}
else if (status == F_parameter) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_invalid_parameter(main->error, "fll_execute_program");
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]);
+ firewall_print_error_on_unhandled(main->error, "fll_execute_program", status);
}
macro_f_string_dynamics_t_delete_simple(arguments);
arguments.size = 1;
arguments.used = 1;
- if (main.error.verbosity == f_console_verbosity_debug) {
- f_color_print_code(f_type_debug, main.context.warning);
- fprintf(f_type_debug, "%s ", tools[i]);
-
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_debug, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_debug, main.context.reset);
- fprintf(f_type_debug, "\n");
- }
+ firewall_print_debug_tool(main.warning, tools[i], arguments);
status = fll_execute_program(tools[i], arguments, 0, 0, (void *) &return_code);
status = F_status_set_fine(status);
if (status == F_failure) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[i], f_string_eol_s[0]);
-
- fprintf(f_type_error, " ");
- f_color_print_code(f_type_error, main.context.error);
-
- fprintf(f_type_error, "%s ", tools[i]);
- for (f_array_length_t i = 0; i < arguments.used; ++i) {
- fprintf(f_type_error, "%.*s ", arguments.array[i].used, arguments.array[i].string);
- } // for
-
- f_color_print_code(f_type_error, main.context.reset);
- fprintf(f_type_error, "\n");
+ firewall_print_error_on_operation(main.error, tools[i], arguments);
}
else if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_invalid_parameter(main.error, "fll_execute_program");
}
else {
- f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]);
+ firewall_print_error_on_unhandled(main.error, "fll_execute_program", status);
}
return status;
arguments.size = 1;
arguments.used = 1;
- if (main.error.verbosity == f_console_verbosity_debug) {
- f_color_print_code(f_type_debug, main.context.warning);
- fprintf(f_type_debug, "%s ", tools[i]);
-
- for (f_array_length_t j = 0; j < arguments.used; ++j) {
- fprintf(f_type_debug, "%.*s ", arguments.array[j].used, arguments.array[j].string);
- } // for
-
- f_color_print_code(f_type_debug, main.context.reset);
- fprintf(f_type_debug, "\n");
- }
+ firewall_print_debug_tool(main.warning, tools[i], arguments);
status = fll_execute_program(tools[i], arguments, 0, 0, (void *) &return_code);
status = F_status_set_fine(status);
if (status == F_failure) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[i], f_string_eol_s[0]);
-
- fprintf(f_type_error, " ");
- f_color_print_code(f_type_error, main.context.error);
-
- fprintf(f_type_error, "%s ", tools[i]);
- for (f_array_length_t j = 0; j < arguments.used; ++j) {
- fprintf(f_type_error, "%.*s ", arguments.array[j].used, arguments.array[j].string);
- } // for
-
- f_color_print_code(f_type_error, main.context.reset);
- fprintf(f_type_error, "\n");
+ firewall_print_error_on_operation(main.error, tools[i], arguments);
}
else if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_invalid_parameter(main.error, "fll_execute_program");
}
else {
- f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]);
+ firewall_print_error_on_unhandled(main.error, "fll_execute_program", status);
}
return status;
for (f_array_length_t j = 0; j < 2; ++j) {
int return_code = 0;
- // print command when debugging.
- if (main.error.verbosity == f_console_verbosity_debug) {
- f_color_print_code(f_type_debug, main.context.warning);
- fprintf(f_type_debug, "%s ", tools[j]);
-
- for (f_array_length_t k = 0; k < arguments.used; k++) {
- fprintf(f_type_debug, "%.*s ", arguments.array[k].used, arguments.array[k].string);
- } // for
-
- f_color_print_code(f_type_debug, main.context.reset);
- fprintf(f_type_debug, "\n");
- }
+ firewall_print_debug_tool(main.warning, tools[j], arguments);
status = fll_execute_program(tools[j], arguments, 0, 0, (void *) &return_code);
status = F_status_set_fine(status);
if (status == F_failure) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sFailed to perform requested %s operation:%c", fll_error_print_error, tools[j], f_string_eol_s[0]);
-
- fprintf(f_type_error, " ");
- f_color_print_code(f_type_error, main.context.error);
-
- fprintf(f_type_error, "%s ", tools[j]);
- for (f_array_length_t k = 0; k < arguments.used; k++) {
- fprintf(f_type_error, "%.*s ", arguments.array[k].used, arguments.array[k].string);
- } // for
-
- f_color_print_code(f_type_error, main.context.reset);
- fprintf(f_type_error, "\n");
+ firewall_print_error_on_operation(main.error, tools[j], arguments);
}
else if (status == F_parameter) {
- f_color_print(main.error.to.stream, main.context.set.error, "%sInvalid parameter when calling fll_execute_program()%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_invalid_parameter(main.error, "fll_execute_program");
}
else {
- f_color_print(main.error.to.stream, main.context.set.error, "%sAn unhandled error (%u) has occurred while calling fll_execute_program()%c", fll_error_print_error, status, f_string_eol_s[0]);
+ firewall_print_error_on_unhandled(main.error, "fll_execute_program", status);
}
return status;
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if (optional) {
- if (status == F_parameter) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol_s[0]);
- }
- } else {
- if (status == F_parameter) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling f_file_open().%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else if (status == F_file_found_not) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to find the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else if (status == F_file_open) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else if (status == F_file_descriptor) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sFile descriptor error while trying to open the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_open().%c", fll_error_print_error, status, f_string_eol_s[0]);
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ if (optional) {
+ if (status == F_parameter) {
+ firewall_print_error_on_invalid_parameter(main->error, "f_file_open");
+ }
+ else if (status != F_file_found_not && status != F_file_open && status != F_file_descriptor) {
+ firewall_print_error_on_unhandled(main->error, "f_file_open", status);
+ }
+ } else {
+ if (status == F_parameter) {
+ firewall_print_error_on_invalid_parameter(main->error, "f_file_open");
+ }
+ else if (status == F_file_found_not) {
+ fll_print_format("%c%[%sUnable to find the file '%S'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_open) {
+ fll_print_format("%c%[%sUnable to open the file '%S'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_descriptor) {
+ fll_print_format("%c%[%sFile descriptor error while trying to open the file '%S'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else {
+ firewall_print_error_on_unhandled(main->error, "f_file_open", status);
+ }
}
}
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if (status == F_parameter) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sInvalid parameter when calling f_file_read().%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else if (status == F_number_overflow) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sInteger overflow while trying to buffer the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else if (status == F_file_closed) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe file '%s' is no longer open.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else if (status == F_file_seek) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sA seek error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else if (status == F_file_read) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sA read error occurred while accessing the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else if (status == F_memory_not) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling f_file_read().%c", fll_error_print_error, status, f_string_eol_s[0]);
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ if (status == F_parameter) {
+ firewall_print_error_on_invalid_parameter(main->error, "f_file_read");
+ }
+ else if (status == F_number_overflow) {
+ fll_print_format("%c%[%sInteger overflow while trying to buffer the file '%S'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_closed) {
+ fll_print_format("%c%[%sThe file '%S' is no longer open.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_seek) {
+ fll_print_format("%c%[%sA seek error occurred while accessing the file '%S'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_file_read) {
+ fll_print_format("%c%[%sA read error occurred while accessing the file '%S'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_memory_not) {
+ firewall_print_error_on_allocation_failure(main->error);
+ }
+ else {
+ firewall_print_error_on_unhandled(main->error, "f_file_read", status);
+ }
}
return status;
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if (status == F_parameter) {
- f_color_print(main->error.to.stream, main->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_s[0]);
- }
- else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sNo relevant main was found within the file '%s'.%c", fll_error_print_error, filename, f_string_eol_s[0]);
- }
- else if (status == F_memory_not) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
- }
- else {
- f_color_print(main->error.to.stream, main->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_s[0]);
+ if (main->error.verbosity != f_console_verbosity_quiet) {
+ if (status == F_parameter) {
+ firewall_print_error_on_invalid_parameter_for_file(main->error, "fll_fss_basic_list_read", filename);
+ }
+ else if (status == F_data_not_eos || status == F_data_not || status == F_data_not_stop) {
+ fll_print_format("%c%[%sNo relevant main was found within the file '%s'.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, filename, main->error.context, f_string_eol_s[0]);
+ }
+ else if (status == F_memory_not) {
+ firewall_print_error_on_allocation_failure(main->error);
+ }
+ else {
+ firewall_print_error_on_unhandled_for_file(main->error, "fll_fss_basic_read", status, filename);
+ }
}
}
else {
status = F_status_set_fine(status);
if (status == F_memory_not) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sUnable to allocate memory.%c", fll_error_print_error, f_string_eol_s[0]);
+ firewall_print_error_on_allocation_failure(main->error);
}
else if (status == F_failure) {
// the error message has already been displayed.
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sAn unhandled error (%u) has occurred while calling firewall_perform_commands().%c", fll_error_print_error, status, f_string_eol_s[0]);
+ firewall_print_error_on_unhandled(main->error, "firewall_perform_commands", status);
}
macro_f_fss_objects_t_delete_simple(local->rule_objects);
*
* Status codes (with error bit) are returned on any problem.
*/
-f_status_t firewall_perform_commands(const firewall_local_data_t local, const firewall_main_t main) f_attribute_visibility_internal;
+extern f_status_t firewall_perform_commands(const firewall_local_data_t local, const firewall_main_t main) f_attribute_visibility_internal;
/**
* Create custom chains.
*
* Status codes (with error bit) are returned on any problem.
*/
-f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal;
+extern f_status_t firewall_create_custom_chains(firewall_reserved_chains_t *reserved, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal;
/**
* Deallocate chains.
*
* Status codes (with error bit) are returned on any problem.
*/
-f_status_t firewall_delete_chains(const firewall_main_t main) f_attribute_visibility_internal;
+extern f_status_t firewall_delete_chains(const firewall_main_t main) f_attribute_visibility_internal;
/**
* Lock the firewall.
*
* Status codes (with error bit) are returned on any problem.
*/
-f_status_t firewall_default_lock(const firewall_main_t main) f_attribute_visibility_internal;
+extern f_status_t firewall_default_lock(const firewall_main_t main) f_attribute_visibility_internal;
/**
* Buffer firewall rules.
*
* Status codes (with error bit) are returned on any problem.
*/
-f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal;
+extern f_status_t firewall_buffer_rules(const f_string_t filename, const bool optional, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal;
/**
* Process buffered rules.
*
* Status codes (with error bit) are returned on any problem.
*/
-f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal;
+extern f_status_t firewall_process_rules(f_string_range_t *range, firewall_local_data_t *local, firewall_main_t *main) f_attribute_visibility_internal;
/**
* Delete allocated local data.
*
* Status codes (with error bit) are returned on any problem.
*/
-f_status_t firewall_delete_local_data(firewall_local_data_t *local) f_attribute_visibility_internal;
+extern f_status_t firewall_delete_local_data(firewall_local_data_t *local) f_attribute_visibility_internal;
#ifdef __cplusplus
} // extern "C"
fl_conversion
fl_environment
fl_fss
+fl_print
fl_status
fl_string
fll_error
fll_execute
fll_fss
+fll_print
fll_program
build_indexer ar
build_language c
build_libraries -lc -lcap
-build_libraries-individual -lfll_error -lfll_execute -lfll_fss -lfll_program -lfl_console -lfl_control_group -lfl_conversion -lfl_environment -lfl_fss -lfl_status -lfl_string -lf_account -lf_capability -lf_color -lf_console -lf_control_group -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_limit -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_string -lf_thread -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_execute -lfll_fss -lfll_print -lfll_program -lfl_console -lfl_control_group -lfl_conversion -lfl_environment -lfl_fss -lfl_print -lfl_status -lfl_string -lf_account -lf_capability -lf_color -lf_console -lf_control_group -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_limit -lf_memory -lf_path -lf_pipe -lf_print -lf_signal -lf_string -lf_thread -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library firewall.c private-common.c private-firewall.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -pthread -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -pthread -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC
#ifndef _di_fss_basic_list_read_print_help_
f_status_t fss_basic_list_read_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, fss_basic_list_read_name_long, fss_basic_list_read_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], output.stream);
fll_program_print_help_option(output, context, fss_basic_list_read_short_at, fss_basic_list_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
fll_program_print_help_option(output, context, fss_basic_list_read_short_content, fss_basic_list_read_long_content, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
fll_program_print_help_usage(output, context, fss_basic_list_read_name, "filename(s)");
- f_color_print(output.stream, context.set.important, " Notes:");
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " This program will print the Content associated with the given Object and Content main based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " All numeric positions (indexes) start at 0 instead of 1.%c", f_string_eol_s[0]);
- fprintf(output.stream, " For example, a file of 17 lines would range from 0 to 16.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" %[Notes:%]%c", output.stream, context.set.important, context.set.important, f_string_eol_s[0]);
- fprintf(output.stream, " When using the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth);
- fprintf(output.stream, " option, an order of operations is enforced on the parameters.%c", f_string_eol_s[0]);
+ fl_print_format(" This program will print the Content associated with the given Object and Content main based on the FSS-0002 Basic List standard.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", f_string_eol_s[0]);
+ fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_at);
- fprintf(output.stream, ": An Object index at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" When using the %[%s%s%] option, an order of operations is enforced on the parameters.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth);
- fprintf(output.stream, ": A new depth within the specified depth, indexed from the root.%c", f_string_eol_s[0]);
+ fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name);
- fprintf(output.stream, ": An Object name at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object index at the specified depth.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: A new depth within the specified depth, indexed from the root.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object name at the specified depth.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] must be in numeric order, but values in between may be skipped.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth);
- fprintf(output.stream, " must be in numeric order, but values in between may be skipped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] selects a Content column.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" Specify both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object, context.set.notable);
+ fl_print_format(" and the %[%s%s%] parameters to get the total objects.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select);
- fprintf(output.stream, " selects a Content column.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " Specify both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_object);
- fprintf(output.stream, " and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_total);
- fprintf(output.stream, " parameters to get the total objects.%c", f_string_eol_s[0]);
+ fl_print_format(" When both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at, context.set.notable);
+ fl_print_format(" and %[%s%s%] parameters are specified (at the same depth),", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name, context.set.notable);
+ fl_print_format(" the %[%s%s%] parameter value will be treated as a position relative to the specified", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter value.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" This program may support parameters, such as %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth, context.set.notable);
+ fl_print_format(" or %[%s%s%], even if not supported by the standard.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" This is done to help ensure consistency for scripting.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_at);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name);
- fprintf(output.stream, " parameters are specified (at the same depth), the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_at);
- fprintf(output.stream, " parameter value will be treated as a position relative to the specified ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name);
- fprintf(output.stream, " parameter value.%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth, context.set.notable);
+ fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select, context.set.notable);
+ fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " This program may support parameters, such as ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth);
- fprintf(output.stream, " or ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select);
- fprintf(output.stream, ", even if not supported by the standard.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is done to help ensure consistency for scripting.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_trim, context.set.notable);
+ fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" When specifying both the %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object, context.set.notable);
+ fl_print_format(" parameter and the %[%s%s%] parameter, the entire Object and Content are printed, including the formatting.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_content, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content printed are already escaped.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content are separated by an EOL.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth);
- fprintf(output.stream, ", if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] accepts the following:%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Do not apply delimits.%c", output.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: (default) Apply all delimits.%c", output.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Apply delimits for Objects.%c", output.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_object, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", output.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_greater, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c%c", output.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_lesser, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select);
- fprintf(output.stream, ", if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit, context.set.notable);
+ fl_print_format(" values %[%s%]", output.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none, context.set.notable);
+ fl_print_format(" and %[%s%],", output.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all, context.set.notable);
+ fl_print_format(" overrule all other delimit values.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_trim);
- fprintf(output.stream, " will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameters %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns, context.set.notable);
+ fl_print_format(" and %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select, context.set.notable);
+ fl_print_format(" refer to a Content column.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" This is not to be confused with a depth.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " When specifying both the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_object);
- fprintf(output.stream, " parameter and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_content);
- fprintf(output.stream, " parameter, the entire Object and Content are printed, including the formatting.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content printed are already escaped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content are separated by an EOL.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit);
- fprintf(output.stream, " accepts the following:%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_list_read_delimit_mode_name_none);
- fprintf(output.stream, ": Do not apply delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_list_read_delimit_mode_name_all);
- fprintf(output.stream, ": (default) Apply all delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_list_read_delimit_mode_name_object);
- fprintf(output.stream, ": Apply delimits for Objects.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater: apply delimits for Content at the specified depth.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_list_read_delimit_mode_name_greater);
- fprintf(output.stream, ": (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_list_read_delimit_mode_name_lesser);
- fprintf(output.stream, ": (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit);
- fprintf(output.stream, " parameter may be specified multiple times to customize the delimit behavior.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit);
- fprintf(output.stream, " values ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_list_read_delimit_mode_name_none);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_list_read_delimit_mode_name_all);
- fprintf(output.stream, ", overrule all other delimit values.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameters ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_columns);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select);
- fprintf(output.stream, " refer to a Content column.%c", f_string_eol_s[0]);
- fprintf(output.stream, " The word \"column\" is being loosely defined to refer to a specific Content.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is not to be confused with a depth.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ funlockfile(output.stream);
return F_none;
}
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == fss_basic_list_read_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == fss_basic_list_read_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == fss_basic_list_read_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == fss_basic_list_read_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters[parameter_code[i]].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a %s.%c", parameter_message[i], f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' requires a %s.%]%c", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters[parameter_code[i]].result == parameter_match[i]) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_columns);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) {
if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_total);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
else if (main->parameters[fss_basic_list_read_parameter_line].result == f_console_result_additional) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_line);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_line, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
length = strnlen(arguments->argv[location], f_console_parameter_size);
if (!length) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit, main->error.notable);
+ fl_print_format("%[' must not be empty.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
}
if (F_status_is_error_not(status) && main->parameters[fss_basic_list_read_parameter_select].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_select);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select, main->error.notable);
+ fl_print_format("%[' parameter requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
fss_basic_list_read_depths_resize(0, &data.depths);
fss_basic_list_read_data_delete_simple(&data);
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
#include <fll/level_2/error.h>
#include <fll/level_2/file.h>
#include <fll/level_2/fss_basic_list.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#ifdef __cplusplus
f_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_color_context_t context;
} fss_basic_list_read_main_t;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_color_context_t_initialize, \
}
#endif // _di_fss_basic_list_read_main_t_
if (!data->depths.array[i].value_name.used) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_name);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name, main->error.notable);
+ fl_print_format("%[' must not be an empty string.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
if (data->depths.array[i].depth == data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once for the parameter '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
}
else if (data->depths.array[i].depth > data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_list_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may not have the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' before the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[j].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth, main->error.notable);
+ fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
}
else if (status == F_data_not_stop || status == F_data_not_eos) {
if (data->option & fss_basic_list_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_basic_list_read_print_zero(main);
+ funlockfile(main->output.stream);
+
return F_none;
}
}
if ((data->option & fss_basic_list_read_data_option_object) || (data->option & fss_basic_list_read_data_option_content) && (data->contents.array[at].used || (data->option & fss_basic_list_read_data_option_empty))) {
+ flockfile(main->output.stream);
+
if (data->option & fss_basic_list_read_data_option_object) {
if (data->option & fss_basic_list_read_data_option_trim) {
- fl_print_trim_except_in_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object, data->comments);
+ fl_print_trim_except_in_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, data->comments, main->output.stream);
}
else {
- f_print_except_in_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object, data->comments);
+ f_print_except_in_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, data->comments, main->output.stream);
}
fss_basic_list_read_print_object_end(main);
if (data->option & fss_basic_list_read_data_option_content) {
if (data->contents.array[at].used) {
fss_basic_list_read_print_content_ignore(main);
- f_print_except_in_dynamic_partial(main->output.stream, data->buffer, data->contents.array[at].array[0], delimits_content, data->comments);
+
+ f_print_except_in_dynamic_partial(data->buffer, data->contents.array[at].array[0], delimits_content, data->comments, main->output.stream);
+
fss_basic_list_read_print_content_ignore(main);
}
}
fss_basic_list_read_print_set_end(main);
+
+ funlockfile(main->output.stream);
}
}
#endif // _di_fss_basic_list_read_print_at_
}
if (data->option & fss_basic_list_read_data_option_trim) {
- fl_print_trim_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
else {
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
fss_basic_list_read_print_object_end(main);
void fss_basic_list_read_print_content_ignore(fss_basic_list_read_main_t * const main) {
if (main->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_basic_list_read_pipe_content_ignore);
+ f_print_character(fss_basic_list_read_pipe_content_ignore, main->output.stream);
}
}
#endif // _di_fss_basic_list_read_print_content_ignore_
void fss_basic_list_read_print_object_end(fss_basic_list_read_main_t * const main) {
if (main->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_basic_list_read_pipe_content_start);
+ f_print_character(fss_basic_list_read_pipe_content_start, main->output.stream);
}
else {
if (main->parameters[fss_basic_list_read_parameter_content].result == f_console_result_found) {
- fprintf(main->output.stream, "%c%c", f_fss_basic_list_open, f_fss_basic_list_open_end);
+ f_print_character(f_fss_basic_list_open, main->output.stream);
+ f_print_character(f_fss_basic_list_open_end, main->output.stream);
}
else {
- fprintf(main->output.stream, "%c", f_fss_eol);
+ f_print_character(f_fss_eol, main->output.stream);
}
}
}
void fss_basic_list_read_print_set_end(fss_basic_list_read_main_t * const main) {
if (main->parameters[fss_basic_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_basic_list_read_pipe_content_end);
+ f_print_character(fss_basic_list_read_pipe_content_end, main->output.stream);
}
}
#endif // _di_fss_basic_list_read_print_set_end_
#ifndef _di_fss_basic_list_read_print_one_
void fss_basic_list_read_print_one(fss_basic_list_read_main_t * const main) {
- fprintf(main->output.stream, "1%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_1_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_basic_list_read_print_one_
#ifndef _di_fss_basic_list_read_print_zero_
void fss_basic_list_read_print_zero(fss_basic_list_read_main_t * const main) {
- fprintf(main->output.stream, "0%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_0_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_basic_list_read_print_zero_
// This standard does not support multiple content groups.
if ((data->option & fss_basic_list_read_data_option_select) && data->select) {
if (main->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
+ flockfile(main->output.stream);
+
fss_basic_list_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
if (data->depths.array[0].value_at >= data->objects.used) {
if (data->option & (fss_basic_list_read_data_option_columns | fss_basic_list_read_data_option_total)) {
+ flockfile(main->output.stream);
+
fss_basic_list_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
if (status == F_success) return F_none;
}
else if (data->option & fss_basic_list_read_data_option_columns) {
- fprintf(main->output.stream, "%llu%c", data->contents.array[i].used, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, data->contents.array[i].used, f_string_eol_s[0]);
}
else if (data->option & fss_basic_list_read_data_option_total) {
+ flockfile(main->output.stream);
+
if (data->contents.array[i].used) {
fss_basic_list_read_print_one(main);
}
else {
fss_basic_list_read_print_zero(main);
}
+
+ funlockfile(main->output.stream);
}
else {
fss_basic_list_read_print_at(i, *delimits_object, *delimits_content, main, data);
} // for
if (data->option & fss_basic_list_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_basic_list_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
f_status_t fss_basic_list_read_process_columns(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) {
if (!(data->option & fss_basic_list_read_data_option_content)) {
+ flockfile(main->output.stream);
+
fss_basic_list_read_print_zero(main);
+ funlockfile(main->output.stream);
+
return F_none;
}
}
} // for
- fprintf(main->output.stream, "%llu%c", max, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, max, f_string_eol_s[0]);
return F_none;
}
if (data->option & fss_basic_list_read_data_option_object) {
if (*line == data->line) {
+ flockfile(main->output.stream);
+
if (data->option & fss_basic_list_read_data_option_total) {
fss_basic_list_read_print_one(main);
}
fss_basic_list_read_print_at_object(main, data, at, delimits_object);
}
+ funlockfile(main->output.stream);
+
return F_success;
}
if (*line == data->line) {
range.stop = i;
+ flockfile(main->output.stream);
+
if (data->option & fss_basic_list_read_data_option_total) {
fss_basic_list_read_print_one(main);
}
else {
- f_print_except_in_dynamic_partial(main->output.stream, data->buffer, range, delimits_content, data->comments);
+ f_print_except_in_dynamic_partial(data->buffer, range, delimits_content, data->comments, main->output.stream);
}
+ funlockfile(main->output.stream);
+
return F_success;
}
++(*line);
if (*line == data->line) {
+ flockfile(main->output.stream);
+
if (data->option & fss_basic_list_read_data_option_total) {
fss_basic_list_read_print_one(main);
}
else {
range.stop = data->contents.array[at].array[0].stop;
- f_print_except_in_dynamic_partial(main->output.stream, data->buffer, range, delimits_content, data->comments);
- fprintf(main->output.stream, "%c", f_string_eol_s[0]);
+ //f_print_except_in_dynamic_partial(main->output.stream, data->buffer, range, delimits_content, data->comments);
+ //f_print_character(f_string_eol_s[0], main->output.stream);
+ fl_print_format("%/:;Q%c", main->output.stream, data->buffer, range, delimits_content, data->comments, f_string_eol_s[0]);
}
+ funlockfile(main->output.stream);
+
return F_success;
}
}
}
} // for
+ flockfile(main->output.stream);
+
if (data->option & fss_basic_list_read_data_option_line) {
if (data->line < total) {
fss_basic_list_read_print_one(main);
}
}
else {
- fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]);
+ fl_print_format("%ul%c", main->output.stream, total, f_string_eol_s[0]);
}
+ funlockfile(main->output.stream);
+
return F_none;
}
#endif // _di_fss_basic_list_read_process_total_
fll_error
fll_file
fll_fss
+fll_print
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_list_read.c private-common.c private-fss_basic_list_read.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC
#ifndef _di_fss_basic_read_print_help_
f_status_t fss_basic_read_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, fss_basic_read_name_long, fss_basic_read_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], output.stream);
fll_program_print_help_option(output, context, fss_basic_read_short_at, fss_basic_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
fll_program_print_help_option(output, context, fss_basic_read_short_content, fss_basic_read_long_content, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
fll_program_print_help_usage(output, context, fss_basic_read_name, "filename(s)");
- f_color_print(output.stream, context.set.important, " Notes:");
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " This program will print the Content associated with the given Object and Content main based on the FSS-0000 Basic standard.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " All numeric positions (indexes) start at 0 instead of 1.%c", f_string_eol_s[0]);
- fprintf(output.stream, " For example, a file of 17 lines would range from 0 to 16.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" %[Notes:%]%c", output.stream, context.set.important, context.set.important, f_string_eol_s[0]);
- fprintf(output.stream, " When using the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth);
- fprintf(output.stream, " option, an order of operations is enforced on the parameters.%c", f_string_eol_s[0]);
+ fl_print_format(" This program will print the Content associated with the given Object and Content main based on the FSS-0000 Basic standard.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", f_string_eol_s[0]);
+ fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_at);
- fprintf(output.stream, ": An Object index at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" When using the %[%s%s%] option, an order of operations is enforced on the parameters.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth);
- fprintf(output.stream, ": A new depth within the specified depth, indexed from the root.%c", f_string_eol_s[0]);
+ fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name);
- fprintf(output.stream, ": An Object name at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object index at the specified depth.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: A new depth within the specified depth, indexed from the root.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object name at the specified depth.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] must be in numeric order, but values in between may be skipped.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth);
- fprintf(output.stream, " must be in numeric order, but values in between may be skipped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] selects a Content column.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" Specify both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_object, context.set.notable);
+ fl_print_format(" and the %[%s%s%] parameters to get the total objects.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_total, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select);
- fprintf(output.stream, " selects a Content column.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " Specify both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_object);
- fprintf(output.stream, " and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_total);
- fprintf(output.stream, " parameters to get the total objects.%c", f_string_eol_s[0]);
+ fl_print_format(" When both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at, context.set.notable);
+ fl_print_format(" and %[%s%s%] parameters are specified (at the same depth),", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name, context.set.notable);
+ fl_print_format(" the %[%s%s%] parameter value will be treated as a position relative to the specified", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_at, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter value.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" This program may support parameters, such as %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth, context.set.notable);
+ fl_print_format(" or %[%s%s%], even if not supported by the standard.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" This is done to help ensure consistency for scripting.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_at);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name);
- fprintf(output.stream, " parameters are specified (at the same depth), the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_at);
- fprintf(output.stream, " parameter value will be treated as a position relative to the specified ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name);
- fprintf(output.stream, " parameter value.%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth, context.set.notable);
+ fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select, context.set.notable);
+ fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " This program may support parameters, such as ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth);
- fprintf(output.stream, " or ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select);
- fprintf(output.stream, ", even if not supported by the standard.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is done to help ensure consistency for scripting.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_trim, context.set.notable);
+ fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" When specifying both the %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_object, context.set.notable);
+ fl_print_format(" parameter and the %[%s%s%] parameter, the entire Object and Content are printed, including the formatting.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_content, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content printed are already escaped.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content are separated by a space.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth);
- fprintf(output.stream, ", if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] accepts the following:%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Do not apply delimits.%c", output.stream, context.set.notable, fss_basic_read_delimit_mode_name_none, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: (default) Apply all delimits.%c", output.stream, context.set.notable, fss_basic_read_delimit_mode_name_all, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Apply delimits for Objects.%c", output.stream, context.set.notable, fss_basic_read_delimit_mode_name_object, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", output.stream, context.set.notable, fss_basic_read_delimit_mode_name_greater, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c%c", output.stream, context.set.notable, fss_basic_read_delimit_mode_name_lesser, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select);
- fprintf(output.stream, ", if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit, context.set.notable);
+ fl_print_format(" values %[%s%]", output.stream, context.set.notable, fss_basic_read_delimit_mode_name_none, context.set.notable);
+ fl_print_format(" and %[%s%],", output.stream, context.set.notable, fss_basic_read_delimit_mode_name_all, context.set.notable);
+ fl_print_format(" overrule all other delimit values.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_trim);
- fprintf(output.stream, " will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameters %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_columns, context.set.notable);
+ fl_print_format(" and %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select, context.set.notable);
+ fl_print_format(" refer to a Content column.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" This is not to be confused with a depth.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " When specifying both the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_object);
- fprintf(output.stream, " parameter and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_content);
- fprintf(output.stream, " parameter, the entire Object and Content are printed, including the formatting.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content printed are already escaped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content are separated by a space.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit);
- fprintf(output.stream, " accepts the following:%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_read_delimit_mode_name_none);
- fprintf(output.stream, ": Do not apply delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_read_delimit_mode_name_all);
- fprintf(output.stream, ": (default) Apply all delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_read_delimit_mode_name_object);
- fprintf(output.stream, ": Apply delimits for Objects.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater: apply delimits for Content at the specified depth.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_read_delimit_mode_name_greater);
- fprintf(output.stream, ": (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_read_delimit_mode_name_lesser);
- fprintf(output.stream, ": (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit);
- fprintf(output.stream, " parameter may be specified multiple times to customize the delimit behavior.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit);
- fprintf(output.stream, " values ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_read_delimit_mode_name_none);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s", fss_basic_read_delimit_mode_name_all);
- fprintf(output.stream, ", overrule all other delimit values.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameters ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_columns);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select);
- fprintf(output.stream, " refer to a Content column.%c", f_string_eol_s[0]);
- fprintf(output.stream, " The word \"column\" is being loosely defined to refer to a specific Content.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is not to be confused with a depth.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ funlockfile(output.stream);
return F_none;
}
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == fss_basic_read_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == fss_basic_read_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == fss_basic_read_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == fss_basic_read_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters[parameter_code[i]].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a %s.%c", parameter_message[i], f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' requires a %s.%]%c", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters[parameter_code[i]].result == parameter_match[i]) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_columns);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_columns, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) {
if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_total);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_total, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
else if (main->parameters[fss_basic_read_parameter_line].result == f_console_result_additional) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_line);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_line, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
length = strnlen(arguments->argv[location], f_console_parameter_size);
if (!length) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_delimit);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit, main->error.notable);
+ fl_print_format("%[' must not be empty.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
}
if (F_status_is_error_not(status) && main->parameters[fss_basic_read_parameter_select].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_select);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select, main->error.notable);
+ fl_print_format("%[' parameter requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
fss_basic_read_depths_resize(0, &data.depths);
fss_basic_read_data_delete_simple(&data);
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
#include <fll/level_2/error.h>
#include <fll/level_2/file.h>
#include <fll/level_2/fss_basic.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#ifdef __cplusplus
f_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_color_context_t context;
} fss_basic_read_main_t;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_color_context_t_initialize, \
}
#endif // _di_fss_basic_read_main_t_
if (!data->depths.array[i].value_name.used) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_name);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_name, main->error.notable);
+ fl_print_format("%[' must not be an empty string.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
if (data->depths.array[i].depth == data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once for the parameter '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
}
else if (data->depths.array[i].depth > data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_basic_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may not have the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' before the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[j].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth, main->error.notable);
+ fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
}
if ((data->option & fss_basic_read_data_option_object) || (data->option & fss_basic_read_data_option_content) && (data->contents.array[at].used || (data->option & fss_basic_read_data_option_empty))) {
+ flockfile(main->output.stream);
+
if (data->option & fss_basic_read_data_option_object) {
if (data->option & fss_basic_read_data_option_trim) {
- fl_print_trim_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
else {
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
if (data->option & fss_basic_read_data_option_content) {
}
if ((data->option & fss_basic_read_data_option_content) && data->contents.array[at].used) {
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->contents.array[at].array[0], delimits_content);
+ f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[0], delimits_content, main->output.stream);
}
fss_basic_read_print_set_end(main);
+
+ funlockfile(main->output.stream);
}
}
#endif // _di_fss_basic_read_print_at_
void fss_basic_read_print_object_end(fss_basic_read_main_t * const main) {
if (main->parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_basic_read_pipe_content_start);
+ f_print_character(fss_basic_read_pipe_content_start, main->output.stream);
}
else {
- fprintf(main->output.stream, "%c", f_fss_space);
+ f_print_character(f_fss_space, main->output.stream);
}
}
#endif // _di_fss_basic_read_print_object_end_
#ifndef _di_fss_basic_read_print_one_
void fss_basic_read_print_one(fss_basic_read_main_t * const main) {
- fprintf(main->output.stream, "1%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_1_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_basic_read_print_one_
void fss_basic_read_print_set_end(fss_basic_read_main_t * const main) {
if (main->parameters[fss_basic_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_basic_read_pipe_content_end);
+ f_print_character(fss_basic_read_pipe_content_end, main->output.stream);
}
else {
- fprintf(main->output.stream, "%c", f_fss_eol);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
}
#endif // _di_fss_basic_read_print_set_end_
#ifndef _di_fss_basic_read_print_zero_
void fss_basic_read_print_zero(fss_basic_read_main_t * const main) {
- fprintf(main->output.stream, "0%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_0_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_basic_read_print_zero_
fll_error
fll_file
fll_fss
+fll_print
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_basic_read.c private-common.c private-fss_basic_read.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC
#ifndef _di_fss_embedded_list_read_print_help_
f_status_t fss_embedded_list_read_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, fss_embedded_list_read_name_long, fss_embedded_list_read_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], output.stream);
fll_program_print_help_option(output, context, fss_embedded_list_read_short_at, fss_embedded_list_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
fll_program_print_help_option(output, context, fss_embedded_list_read_short_content, fss_embedded_list_read_long_content, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
fll_program_print_help_usage(output, context, fss_embedded_list_read_name, "filename(s)");
- f_color_print(output.stream, context.set.important, " Notes:");
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " This program will print the Content associated with the given Object and Content main based on the FSS-0002 Basic List standard.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " All numeric positions (indexes) start at 0 instead of 1.%c", f_string_eol_s[0]);
- fprintf(output.stream, " For example, a file of 17 lines would range from 0 to 16.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " When using the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- fprintf(output.stream, " option, an order of operations is enforced on the parameters.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_at);
- fprintf(output.stream, ": An Object index at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" %[Notes:%]%c", output.stream, context.set.important, context.set.important, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- fprintf(output.stream, ": A new depth within the specified depth, indexed from the root.%c", f_string_eol_s[0]);
+ fl_print_format(" This program will print the Content associated with the given Object and Content main based on the FSS-0008 Embedded List standard.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_name);
- fprintf(output.stream, ": An Object name at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" When using the %[%s%s%] option, an order of operations is enforced on the parameters.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- fprintf(output.stream, " must be in numeric order, but values in between may be skipped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c", f_string_eol_s[0]);
+ fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object index at the specified depth.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: A new depth within the specified depth, indexed from the root.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object name at the specified depth.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- fprintf(output.stream, " selects a Content column.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] must be in numeric order, but values in between may be skipped.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] selects a Content column.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " Specify both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_object);
- fprintf(output.stream, " and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total);
- fprintf(output.stream, " parameters to get the total objects.%c", f_string_eol_s[0]);
+ fl_print_format(" Specify both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_object, context.set.notable);
+ fl_print_format(" and the %[%s%s%] parameters to get the total objects.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" When both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at, context.set.notable);
+ fl_print_format(" and %[%s%s%] parameters are specified (at the same depth),", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name, context.set.notable);
+ fl_print_format(" the %[%s%s%] parameter value will be treated as a position relative to the specified", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter value.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_at);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_name);
- fprintf(output.stream, " parameters are specified (at the same depth), the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_at);
- fprintf(output.stream, " parameter value will be treated as a position relative to the specified ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_name);
- fprintf(output.stream, " parameter value.%c", f_string_eol_s[0]);
+ fl_print_format(" This program may support parameters, such as %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, context.set.notable);
+ fl_print_format(" or %[%s%s%], even if not supported by the standard.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" This is done to help ensure consistency for scripting.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, context.set.notable);
+ fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, " This program may support parameters, such as ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- fprintf(output.stream, " or ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- fprintf(output.stream, ", even if not supported by the standard.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is done to help ensure consistency for scripting.%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select, context.set.notable);
+ fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_trim, context.set.notable);
+ fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- fprintf(output.stream, ", if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" When specifying both the %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_object, context.set.notable);
+ fl_print_format(" parameter and the %[%s%s%] parameter, the entire Object and Content are printed, including the formatting.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_content, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content printed are already escaped.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content are separated by an EOL.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- fprintf(output.stream, ", if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] accepts the following:%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Do not apply delimits.%c", output.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_none, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: (default) Apply all delimits.%c", output.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_all, context.set.notable, f_string_eol_s[0]);
+ // @todo
+ //fl_print_format(" - %[%s%]: Apply delimits for Objects.%c", output.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_object, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", output.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_greater, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c%c", output.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_lesser, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_trim);
- fprintf(output.stream, " will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit, context.set.notable);
+ fl_print_format(" values %[%s%]", output.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_none, context.set.notable);
+ fl_print_format(" and %[%s%],", output.stream, context.set.notable, fss_embedded_list_read_delimit_mode_name_all, context.set.notable);
+ fl_print_format(" overrule all other delimit values.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When specifying both the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_object);
- fprintf(output.stream, " parameter and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_content);
- fprintf(output.stream, " parameter, the entire Object and Content are printed, including the formatting.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content printed are already escaped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content are separated by an EOL.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameters %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns, context.set.notable);
+ fl_print_format(" and %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select, context.set.notable);
+ fl_print_format(" refer to a Content column.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" This is not to be confused with a depth.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit);
- fprintf(output.stream, " accepts the following:%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_none);
- fprintf(output.stream, ": Do not apply delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_all);
- fprintf(output.stream, ": (default) Apply all delimits.%c", f_string_eol_s[0]);
- // @todo
- //fprintf(output.stream, " - ");
- //f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_object);
- //fprintf(output.stream, ": Apply delimits for Objects.%c", f_string_eol_s[0]);
- //fprintf(output.stream, " - A number, 0 or greater: apply delimits for Content at the specified depth.%c", f_string_eol_s[0]);
- //fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_greater);
- fprintf(output.stream, ": (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_lesser);
- fprintf(output.stream, ": (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit);
- fprintf(output.stream, " parameter may be specified multiple times to customize the delimit behavior.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit);
- fprintf(output.stream, " values ");
- f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_none);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s", fss_embedded_list_read_delimit_mode_name_all);
- fprintf(output.stream, ", overrule all other delimit values.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameters ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- fprintf(output.stream, " refer to a Content column.%c", f_string_eol_s[0]);
- fprintf(output.stream, " The word \"column\" is being loosely defined to refer to a specific Content.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is not to be confused with a depth.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ funlockfile(output.stream);
return F_none;
}
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == fss_embedded_list_read_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == fss_embedded_list_read_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == fss_embedded_list_read_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == fss_embedded_list_read_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) {
if (main->parameters[fss_embedded_list_read_parameter_columns].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (main->remaining.used > 0 || main->process_pipe) {
if (main->parameters[fss_embedded_list_read_parameter_at].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_at);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at, main->error.notable);
+ fl_print_format("%[' requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_depth].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, main->error.notable);
+ fl_print_format("%[' requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_line);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line, main->error.notable);
+ fl_print_format("%[' requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_name].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_name);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a string.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name, main->error.notable);
+ fl_print_format("%[' requires a string.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select, main->error.notable);
+ fl_print_format("%[' requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) {
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_line);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (main->parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) {
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_total);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_total, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status)) {
if (main->parameters[fss_embedded_list_read_parameter_delimit].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a value.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit, main->error.notable);
+ fl_print_format("%[' requires a value.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
f_array_length_t length = strnlen(arguments.argv[location], f_console_parameter_size);
if (length == 0) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit, main->error.notable);
+ fl_print_format("%[' must not be empty.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
}
if (F_status_is_error_not(status) && main->parameters[fss_embedded_list_read_parameter_select].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_select);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select, main->error.notable);
+ fl_print_format("%[' parameter requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
macro_f_fss_comments_t_delete_simple(comments);
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
#include <fll/level_2/error.h>
#include <fll/level_2/file.h>
#include <fll/level_2/fss_embedded_list.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#ifdef __cplusplus
f_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_string_dynamic_t buffer;
f_fss_nest_t nest;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_string_dynamic_t_initialize, \
f_fss_nest_t_initialize, \
f_string_quantity_t_initialize, \
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fss_embedded_list_read_main_preprocess_depth", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main.error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_depth, arguments.argv[values_order[i]]);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "fl_string_rip", F_true);
+
return status;
}
}
if (F_status_is_error(status)) {
fll_error_print(main.error, F_status_set_fine(status), "f_string_append", F_true);
+
return status;
}
}
for (j = i + 1; j < depths->used; ++j) {
if (depths->array[i].depth == depths->array[j].depth) {
- fprintf(main.error.to.stream, "%c", f_string_eol_s[0]);
- f_color_print(main.error.to.stream, main.context.set.error, "%sThe value '", fll_error_print_error);
- f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth);
- f_color_print(main.error.to.stream, main.context.set.error, "' may only be specified once for the parameter '");
- f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main.error.to.stream);
+
+ fl_print_format("%c%[%sThe value '%]", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, main.error.context);
+ fl_print_format("%[%ul%]", main.error.to.stream, main.error.notable, depths->array[i].depth, main.error.notable);
+ fl_print_format("%[' may only be specified once for the parameter '%]", main.error.to.stream, main.error.notable, main.error.notable);
+ fl_print_format("%[%s%s%]", main.error.to.stream, main.error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, main.error.notable);
+ fl_print_format("%['.%]%c", main.error.to.stream, main.error.context, main.error.context, f_string_eol_s[0]);
+
+ funlockfile(main.error.to.stream);
return F_status_set_error(F_parameter);
}
else if (depths->array[i].depth > depths->array[j].depth) {
- fprintf(main.error.to.stream, "%c", f_string_eol_s[0]);
- f_color_print(main.error.to.stream, main.context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main.error.to.stream, main.context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth);
- f_color_print(main.error.to.stream, main.context.set.error, "' may not have the value '");
- f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[i].depth);
- f_color_print(main.error.to.stream, main.context.set.error, "' before the value '");
- f_color_print(main.error.to.stream, main.context.set.notable, "%llu", depths->array[j].depth);
- f_color_print(main.error.to.stream, main.context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main.error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main.error.to.stream, f_string_eol_s[0], main.error.context, main.error.prefix, main.error.context);
+ fl_print_format("%[%s%s%]", main.error.to.stream, main.error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth, main.error.notable);
+ fl_print_format("%[' may not have the value '%]", main.error.to.stream, main.error.notable, main.error.notable);
+ fl_print_format("%[%ul%]", main.error.to.stream, main.error.notable, depths->array[i].depth, main.error.notable);
+ fl_print_format("%[' before the value '%]", main.error.to.stream, main.error.notable, main.error.notable);
+ fl_print_format("%[%ul%]", main.error.to.stream, main.error.notable, depths->array[j].depth, main.error.notable);
+ fl_print_format("%['.%]%c", main.error.to.stream, main.error.context, main.error.context, f_string_eol_s[0]);
+
+ funlockfile(main.error.to.stream);
return F_status_set_error(F_parameter);
}
macro_f_string_dynamic_t_delete_simple(main->buffer);
if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) {
- fprintf(main->output.stream, "0%c", f_string_eol_s[0]);
+ fll_print_format("0%c", main->output.stream, f_string_eol_s[0]);
+
return F_none;
}
// Requested depths cannot be greater than contents depth.
if (depths.used > main->nest.used) {
if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) {
- fprintf(main->output.stream, "0%c", f_string_eol_s[0]);
+ fll_print_format("0%c", main->output.stream, f_string_eol_s[0]);
+
return F_none;
}
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_select, arguments.argv[index]);
+
return status;
}
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_line, arguments.argv[index]);
+
return status;
}
}
++total;
} // for
- fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]);
+ fl_print_format("%lu%c", main->output.stream, total, f_string_eol_s[0]);
return F_none;
}
- f_status_t (*print_object)(FILE *, const f_string_static_t, const f_string_range_t, const f_array_lengths_t) = &f_print_except_dynamic_partial;
+ f_status_t (*print_object)(const f_string_static_t, const f_string_range_t, const f_array_lengths_t, FILE *) = &f_print_except_dynamic_partial;
if (main->parameters[fss_embedded_list_read_parameter_trim].result == f_console_result_found) {
print_object = &fl_print_trim_except_dynamic_partial;
}
+ flockfile(main->output.stream);
+
for (i = 0; i < items->used; ++i) {
if (skip[i]) continue;
- print_object(main->output.stream, main->buffer, items->array[i].object, *objects_delimits);
+ print_object(main->buffer, items->array[i].object, *objects_delimits, main->output.stream);
if (main->parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) {
fss_embedded_list_read_print_object_end(*main);
if (items->array[i].content.used) {
- f_print_except_dynamic_partial(main->output.stream, main->buffer, items->array[i].content.array[0], *contents_delimits);
+ f_print_except_dynamic_partial(main->buffer, items->array[i].content.array[0], *contents_delimits, main->output.stream);
}
}
fss_embedded_list_read_print_set_end(*main);
} // for
+ funlockfile(main->output.stream);
+
return F_none;
}
} // for
} // for
- fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]);
+ fll_print_format("%lu%c", main->output.stream, total, f_string_eol_s[0]);
+
return F_none;
}
if (main->parameters[fss_embedded_list_read_parameter_line].result == f_console_result_additional) {
f_array_length_t line_current = 0;
+ flockfile(main->output.stream);
+
for (; i < items->used; ++i) {
if (skip[i]) continue;
if (!main->buffer.string[j]) continue;
if (main->buffer.string[j] == f_string_eol_s[0]) {
- fprintf(main->output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], main->output.stream);
break;
}
- fprintf(main->output.stream, "%c", main->buffer.string[j]);
+ f_print_character(main->buffer.string[j], main->output.stream);
} // for
break;
}
} // for
+ funlockfile(main->output.stream);
+
return F_none;
}
+ flockfile(main->output.stream);
+
for (i = 0; i < items->used; ++i) {
if (skip[i]) continue;
continue;
}
- f_print_except_dynamic_partial(main->output.stream, main->buffer, items->array[i].content.array[0], *contents_delimits);
+ f_print_except_dynamic_partial(main->buffer, items->array[i].content.array[0], *contents_delimits, main->output.stream);
if (main->parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_embedded_list_read_pipe_content_end);
+ f_print_character(fss_embedded_list_read_pipe_content_end, main->output.stream);
}
} // for
+ funlockfile(main->output.stream);
+
return F_none;
}
#endif // _di_fss_embedded_list_read_main_process_for_depth_
void fss_embedded_list_read_print_object_end(const fss_embedded_list_read_main_t main) {
if (main.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main.output.stream, "%c", fss_embedded_list_read_pipe_content_start);
+ f_print_character(fss_embedded_list_read_pipe_content_start, main.output.stream);
}
else {
if (main.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) {
- fprintf(main.output.stream, "%c%c", f_fss_embedded_list_open, f_fss_embedded_list_open_end);
+ f_print_character(f_fss_embedded_list_open, main.output.stream);
+ f_print_character(f_fss_embedded_list_open_end, main.output.stream);
}
else {
- fprintf(main.output.stream, "%c", f_fss_eol);
+ f_print_character(f_fss_eol, main.output.stream);
}
}
}
void fss_embedded_list_read_print_content_ignore(const fss_embedded_list_read_main_t main) {
if (main.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main.output.stream, "%c", fss_embedded_list_read_pipe_content_ignore);
+ f_print_character(fss_embedded_list_read_pipe_content_ignore, main.output.stream);
}
}
#endif // _di_fss_embedded_list_read_print_content_ignore_
void fss_embedded_list_read_print_set_end(const fss_embedded_list_read_main_t main) {
if (main.parameters[fss_embedded_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main.output.stream, "%c", fss_embedded_list_read_pipe_content_end);
+ f_print_character(fss_embedded_list_read_pipe_content_end, main.output.stream);
}
else {
if (main.parameters[fss_embedded_list_read_parameter_object].result == f_console_result_found && main.parameters[fss_embedded_list_read_parameter_content].result == f_console_result_found) {
- fprintf(main.output.stream, "%c%c", f_fss_embedded_list_close, f_fss_embedded_list_close_end);
+ f_print_character(f_fss_embedded_list_close, main.output.stream);
+ f_print_character(f_fss_embedded_list_close_end, main.output.stream);
}
else {
- fprintf(main.output.stream, "%c", f_fss_eol);
+ f_print_character(f_fss_eol, main.output.stream);
}
}
}
fll_error
fll_file
fll_fss
+fll_print
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_embedded_list_read.c private-common.c private-fss_embedded_list_read.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC
#ifndef _di_fss_extended_list_read_print_help_
f_status_t fss_extended_list_read_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, fss_extended_list_read_name_long, fss_extended_list_read_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], output.stream);
fll_program_print_help_option(output, context, fss_extended_list_read_short_at, fss_extended_list_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
fll_program_print_help_option(output, context, fss_extended_list_read_short_content, fss_extended_list_read_long_content, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
fll_program_print_help_usage(output, context, fss_extended_list_read_name, "filename(s)");
- f_color_print(output.stream, context.set.important, " Notes:");
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " This program will print the Content associated with the given Object and Content main based on the FSS-0003 Extended List standard.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " All numeric positions (indexes) start at 0 instead of 1.%c", f_string_eol_s[0]);
- fprintf(output.stream, " For example, a file of 17 lines would range from 0 to 16.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" %[Notes:%]%c", output.stream, context.set.important, context.set.important, f_string_eol_s[0]);
- fprintf(output.stream, " When using the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth);
- fprintf(output.stream, " option, an order of operations is enforced on the parameters.%c", f_string_eol_s[0]);
+ fl_print_format(" This program will print the Content associated with the given Object and Content main based on the FSS-0003 Extended List standard.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", f_string_eol_s[0]);
+ fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_at);
- fprintf(output.stream, ": An Object index at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" When using the %[%s%s%] option, an order of operations is enforced on the parameters.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth);
- fprintf(output.stream, ": A new depth within the specified depth, indexed from the root.%c", f_string_eol_s[0]);
+ fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name);
- fprintf(output.stream, ": An Object name at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object index at the specified depth.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: A new depth within the specified depth, indexed from the root.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object name at the specified depth.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] must be in numeric order, but values in between may be skipped.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth);
- fprintf(output.stream, " must be in numeric order, but values in between may be skipped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] selects a Content column.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" Specify both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_object, context.set.notable);
+ fl_print_format(" and the %[%s%s%] parameters to get the total objects.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_total, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select);
- fprintf(output.stream, " selects a Content column.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " Specify both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_object);
- fprintf(output.stream, " and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_total);
- fprintf(output.stream, " parameters to get the total objects.%c", f_string_eol_s[0]);
+ fl_print_format(" When both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at, context.set.notable);
+ fl_print_format(" and %[%s%s%] parameters are specified (at the same depth),", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name, context.set.notable);
+ fl_print_format(" the %[%s%s%] parameter value will be treated as a position relative to the specified", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_at, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter value.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" This program may support parameters, such as %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth, context.set.notable);
+ fl_print_format(" or %[%s%s%], even if not supported by the standard.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" This is done to help ensure consistency for scripting.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_at);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name);
- fprintf(output.stream, " parameters are specified (at the same depth), the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_at);
- fprintf(output.stream, " parameter value will be treated as a position relative to the specified ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name);
- fprintf(output.stream, " parameter value.%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth, context.set.notable);
+ fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select, context.set.notable);
+ fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " This program may support parameters, such as ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth);
- fprintf(output.stream, " or ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select);
- fprintf(output.stream, ", even if not supported by the standard.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is done to help ensure consistency for scripting.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_trim, context.set.notable);
+ fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" When specifying both the %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_object, context.set.notable);
+ fl_print_format(" parameter and the %[%s%s%] parameter, the entire Object and Content are printed, including the formatting.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_content, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content printed are already escaped.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content are separated by an EOL.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth);
- fprintf(output.stream, ", if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] accepts the following:%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Do not apply delimits.%c", output.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_none, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: (default) Apply all delimits.%c", output.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_all, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Apply delimits for Objects.%c", output.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_object, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", output.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_greater, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c%c", output.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_lesser, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select);
- fprintf(output.stream, ", if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit, context.set.notable);
+ fl_print_format(" values %[%s%]", output.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_none, context.set.notable);
+ fl_print_format(" and %[%s%],", output.stream, context.set.notable, fss_extended_list_read_delimit_mode_name_all, context.set.notable);
+ fl_print_format(" overrule all other delimit values.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_trim);
- fprintf(output.stream, " will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameters %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns, context.set.notable);
+ fl_print_format(" and %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select, context.set.notable);
+ fl_print_format(" refer to a Content column.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" This is not to be confused with a depth.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " When specifying both the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_object);
- fprintf(output.stream, " parameter and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_content);
- fprintf(output.stream, " parameter, the entire Object and Content are printed, including the formatting.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content printed are already escaped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content are separated by an EOL.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit);
- fprintf(output.stream, " accepts the following:%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_list_read_delimit_mode_name_none);
- fprintf(output.stream, ": Do not apply delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_list_read_delimit_mode_name_all);
- fprintf(output.stream, ": (default) Apply all delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_list_read_delimit_mode_name_object);
- fprintf(output.stream, ": Apply delimits for Objects.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater: apply delimits for Content at the specified depth.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_list_read_delimit_mode_name_greater);
- fprintf(output.stream, ": (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_list_read_delimit_mode_name_lesser);
- fprintf(output.stream, ": (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit);
- fprintf(output.stream, " parameter may be specified multiple times to customize the delimit behavior.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit);
- fprintf(output.stream, " values ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_list_read_delimit_mode_name_none);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_list_read_delimit_mode_name_all);
- fprintf(output.stream, ", overrule all other delimit values.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameters ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_columns);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select);
- fprintf(output.stream, " refer to a Content column.%c", f_string_eol_s[0]);
- fprintf(output.stream, " The word \"column\" is being loosely defined to refer to a specific Content.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is not to be confused with a depth.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ funlockfile(output.stream);
return F_none;
}
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == fss_extended_list_read_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == fss_extended_list_read_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == fss_extended_list_read_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == fss_extended_list_read_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters[parameter_code[i]].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a %s.%c", parameter_message[i], f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' requires a %s.%]%c", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters[parameter_code[i]].result == parameter_match[i]) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_columns);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) {
if (main->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_total);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_total, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
else if (main->parameters[fss_extended_list_read_parameter_line].result == f_console_result_additional) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_line);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_line, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
length = strnlen(arguments->argv[location], f_console_parameter_size);
if (!length) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit, main->error.notable);
+ fl_print_format("%[' must not be empty.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
}
if (F_status_is_error_not(status) && main->parameters[fss_extended_list_read_parameter_select].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_select);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select, main->error.notable);
+ fl_print_format("%[' parameter requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
fss_extended_list_read_depths_resize(0, &data.depths);
fss_extended_list_read_data_delete_simple(&data);
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
#include <fll/level_2/error.h>
#include <fll/level_2/file.h>
#include <fll/level_2/fss_extended_list.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#ifdef __cplusplus
f_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_color_context_t context;
} fss_extended_list_read_main_t;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_color_context_t_initialize, \
}
#endif // _di_fss_extended_list_read_main_t_
if (!data->depths.array[i].value_name.used) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_name);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_name, main->error.notable);
+ fl_print_format("%[' must not be an empty string.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
if (data->depths.array[i].depth == data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once for the parameter '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
}
else if (data->depths.array[i].depth > data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_list_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may not have the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' before the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[j].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth, main->error.notable);
+ fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
}
if ((data->option & fss_extended_list_read_data_option_object) || ((data->option & fss_extended_list_read_data_option_content) && (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop || (data->option & fss_extended_list_read_data_option_empty)))) {
+ flockfile(main->output.stream);
+
if (data->option & fss_extended_list_read_data_option_object) {
if (data->option & fss_extended_list_read_data_option_trim) {
- fl_print_trim_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
else {
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
fss_extended_list_read_print_object_end(main, data);
if (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop) {
if (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop) {
fss_extended_list_read_print_content_ignore(main);
- f_print_except_in_dynamic_partial(main->output.stream, data->buffer, data->contents.array[at].array[0], delimits_content, data->comments);
+
+ f_print_except_in_dynamic_partial(data->buffer, data->contents.array[at].array[0], delimits_content, data->comments, main->output.stream);
+
fss_extended_list_read_print_content_ignore(main);
}
}
}
fss_extended_list_read_print_set_end(main, data);
+
+ funlockfile(main->output.stream);
}
}
#endif // _di_fss_extended_list_read_print_at_
}
if (data->option & fss_extended_list_read_data_option_trim) {
- fl_print_trim_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
else {
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
fss_extended_list_read_print_object_end(main, data);
void fss_extended_list_read_print_content_ignore(fss_extended_list_read_main_t * const main) {
if (main->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_extended_list_read_pipe_content_ignore);
+ f_print_character(fss_extended_list_read_pipe_content_ignore, main->output.stream);
}
}
#endif // _di_fss_extended_list_read_print_content_ignore_
void fss_extended_list_read_print_object_end(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data) {
if (main->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_extended_list_read_pipe_content_start);
+ f_print_character(fss_extended_list_read_pipe_content_start, main->output.stream);
}
else {
if ((data->option & fss_extended_list_read_data_option_object) && (data->option & fss_extended_list_read_data_option_content)) {
- fprintf(main->output.stream, "%c%c", f_fss_extended_list_open, f_fss_extended_list_open_end);
+ f_print_character(f_fss_extended_list_open, main->output.stream);
+ f_print_character(f_fss_extended_list_open_end, main->output.stream);
}
}
}
void fss_extended_list_read_print_set_end(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t * const data) {
if (main->parameters[fss_extended_list_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_extended_list_read_pipe_content_end);
+ f_print_character(fss_extended_list_read_pipe_content_end, main->output.stream);
}
else {
if (data->option & fss_extended_list_read_data_option_object) {
if (data->option & fss_extended_list_read_data_option_content) {
- fprintf(main->output.stream, "%c%c", f_fss_extended_list_close, f_fss_extended_list_close_end);
+ f_print_character(f_fss_extended_list_close, main->output.stream);
+ f_print_character(f_fss_extended_list_close_end, main->output.stream);
}
else if (!(data->option & fss_extended_list_read_data_option_content)) {
- fprintf(main->output.stream, "%c", f_fss_eol);
+ f_print_character(f_fss_eol, main->output.stream);
}
}
}
#ifndef _di_fss_extended_list_read_print_one_
void fss_extended_list_read_print_one(fss_extended_list_read_main_t * const main) {
- fprintf(main->output.stream, "1%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_1_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_extended_list_read_print_one_
#ifndef _di_fss_extended_list_read_print_zero_
void fss_extended_list_read_print_zero(fss_extended_list_read_main_t * const main) {
- fprintf(main->output.stream, "0%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_0_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_extended_list_read_print_zero_
fss_extended_list_read_print_one(main);
}
else {
- f_print_except_in_dynamic_partial(main->output.stream, data->buffer, range, delimits_content, data->comments);
+ f_print_except_in_dynamic_partial(data->buffer, range, delimits_content, data->comments, main->output.stream);
}
return F_success;
else {
range.stop = data->contents.array[at].array[0].stop;
- f_print_except_in_dynamic_partial(main->output.stream, data->buffer, range, delimits_content, data->comments);
+ f_print_except_in_dynamic_partial(data->buffer, range, delimits_content, data->comments, main->output.stream);
fprintf(main->output.stream, "%c", f_string_eol_s[0]);
}
fll_error
fll_file
fll_fss
+fll_print
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_list_read.c private-common.c private-fss_extended_list_read.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC
#ifndef _di_fss_extended_read_print_help_
f_status_t fss_extended_read_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, fss_extended_read_name_long, fss_extended_read_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], output.stream);
fll_program_print_help_option(output, context, fss_extended_read_short_at, fss_extended_read_long_at, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
fll_program_print_help_option(output, context, fss_extended_read_short_content, fss_extended_read_long_content, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
fll_program_print_help_usage(output, context, fss_extended_read_name, "filename(s)");
- f_color_print(output.stream, context.set.important, " Notes:");
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " This program will print the Content associated with the given Object and Content main based on the FSS-0001 Extended standard.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " All numeric positions (indexes) start at 0 instead of 1.%c", f_string_eol_s[0]);
- fprintf(output.stream, " For example, a file of 17 lines would range from 0 to 16.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" %[Notes:%]%c", output.stream, context.set.important, context.set.important, f_string_eol_s[0]);
- fprintf(output.stream, " When using the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth);
- fprintf(output.stream, " option, an order of operations is enforced on the parameters.%c", f_string_eol_s[0]);
+ fl_print_format(" This program will print the Content associated with the given Object and Content main based on the FSS-0001 Extended standard.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", f_string_eol_s[0]);
+ fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_at);
- fprintf(output.stream, ": An Object index at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" When using the %[%s%s%] option, an order of operations is enforced on the parameters.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth);
- fprintf(output.stream, ": A new depth within the specified depth, indexed from the root.%c", f_string_eol_s[0]);
+ fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, " ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name);
- fprintf(output.stream, ": An Object name at the specified depth.%c", f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object index at the specified depth.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: A new depth within the specified depth, indexed from the root.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object name at the specified depth.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] must be in numeric order, but values in between may be skipped.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth);
- fprintf(output.stream, " must be in numeric order, but values in between may be skipped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", f_string_eol_s[0]);
- fprintf(output.stream, " ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] selects a Content column.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" Specify both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_object, context.set.notable);
+ fl_print_format(" and the %[%s%s%] parameters to get the total objects.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_total, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select);
- fprintf(output.stream, " selects a Content column.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " Specify both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_object);
- fprintf(output.stream, " and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_total);
- fprintf(output.stream, " parameters to get the total objects.%c", f_string_eol_s[0]);
+ fl_print_format(" When both %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at, context.set.notable);
+ fl_print_format(" and %[%s%s%] parameters are specified (at the same depth),", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name, context.set.notable);
+ fl_print_format(" the %[%s%s%] parameter value will be treated as a position relative to the specified", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_at, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter value.%c%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" This program may support parameters, such as %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth, context.set.notable);
+ fl_print_format(" or %[%s%s%], even if not supported by the standard.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" This is done to help ensure consistency for scripting.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " When both ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_at);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name);
- fprintf(output.stream, " parameters are specified (at the same depth), the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_at);
- fprintf(output.stream, " parameter value will be treated as a position relative to the specified ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name);
- fprintf(output.stream, " parameter value.%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth, context.set.notable);
+ fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", output.stream, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" For parameters like %[%s%s%],", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select, context.set.notable);
+ fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " This program may support parameters, such as ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth);
- fprintf(output.stream, " or ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select);
- fprintf(output.stream, ", even if not supported by the standard.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is done to help ensure consistency for scripting.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_trim, context.set.notable);
+ fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" When specifying both the %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_object, context.set.notable);
+ fl_print_format(" parameter and the %[%s%s%] parameter, the entire Object and Content are printed, including the formatting.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_content, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content printed are already escaped.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" Both the Object and Content are separated by a space.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth);
- fprintf(output.stream, ", if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] accepts the following:%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Do not apply delimits.%c", output.stream, context.set.notable, fss_extended_read_delimit_mode_name_none, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: (default) Apply all delimits.%c", output.stream, context.set.notable, fss_extended_read_delimit_mode_name_all, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - %[%s%]: Apply delimits for Objects.%c", output.stream, context.set.notable, fss_extended_read_delimit_mode_name_object, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater: apply delimits for Content at the specified depth.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", output.stream, context.set.notable, fss_extended_read_delimit_mode_name_greater, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c%c", output.stream, context.set.notable, fss_extended_read_delimit_mode_name_lesser, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " For parameters like ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select);
- fprintf(output.stream, ", if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%c", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit, context.set.notable, f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit, context.set.notable);
+ fl_print_format(" values %[%s%]", output.stream, context.set.notable, fss_extended_read_delimit_mode_name_none, context.set.notable);
+ fl_print_format(" and %[%s%],", output.stream, context.set.notable, fss_extended_read_delimit_mode_name_all, context.set.notable);
+ fl_print_format(" overrule all other delimit values.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_trim);
- fprintf(output.stream, " will remove leading and trailing whitespaces when selecting objects or when printing objects.%c", f_string_eol_s[0]);
+ fl_print_format(" The parameters %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_columns, context.set.notable);
+ fl_print_format(" and %[%s%s%]", output.stream, context.set.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select, context.set.notable);
+ fl_print_format(" refer to a Content column.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%c", output.stream, f_string_eol_s[0]);
+ fl_print_format(" This is not to be confused with a depth.%c%c", output.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " When specifying both the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_object);
- fprintf(output.stream, " parameter and the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_content);
- fprintf(output.stream, " parameter, the entire Object and Content are printed, including the formatting.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content printed are already escaped.%c", f_string_eol_s[0]);
- fprintf(output.stream, " Both the Object and Content are separated by a space.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameter ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit);
- fprintf(output.stream, " accepts the following:%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_read_delimit_mode_name_none);
- fprintf(output.stream, ": Do not apply delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_read_delimit_mode_name_all);
- fprintf(output.stream, ": (default) Apply all delimits.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_read_delimit_mode_name_object);
- fprintf(output.stream, ": Apply delimits for Objects.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater: apply delimits for Content at the specified depth.%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_read_delimit_mode_name_greater);
- fprintf(output.stream, ": (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", f_string_eol_s[0]);
- fprintf(output.stream, " - A number, 0 or greater, followed by a ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_read_delimit_mode_name_lesser);
- fprintf(output.stream, ": (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit);
- fprintf(output.stream, " parameter may be specified multiple times to customize the delimit behavior.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit);
- fprintf(output.stream, " values ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_read_delimit_mode_name_none);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s", fss_extended_read_delimit_mode_name_all);
- fprintf(output.stream, ", overrule all other delimit values.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
-
- fprintf(output.stream, " The parameters ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_columns);
- fprintf(output.stream, " and ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select);
- fprintf(output.stream, " refer to a Content column.%c", f_string_eol_s[0]);
- fprintf(output.stream, " The word \"column\" is being loosely defined to refer to a specific Content.%c", f_string_eol_s[0]);
- fprintf(output.stream, " This is not to be confused with a depth.%c", f_string_eol_s[0]);
-
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ funlockfile(output.stream);
return F_none;
}
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == fss_extended_read_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == fss_extended_read_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == fss_extended_read_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == fss_extended_read_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters[parameter_code[i]].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' requires a %s.%c", parameter_message[i], f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' requires a %s.%]%c", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters[parameter_code[i]].result == parameter_match[i]) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_columns);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, parameter_name[i]);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_columns, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) {
if (main->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_total);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_total, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
else if (main->parameters[fss_extended_read_parameter_line].result == f_console_result_additional) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sCannot specify the '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_pipe);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter with the '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_line);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_pipe, main->error.notable);
+ fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_line, main->error.notable);
+ fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
}
length = strnlen(arguments->argv[location], f_console_parameter_size);
if (!length) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value for the parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_delimit);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be empty.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit, main->error.notable);
+ fl_print_format("%[' must not be empty.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
break;
}
if (F_status_is_error_not(status) && main->parameters[fss_extended_read_parameter_select].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_select);
- f_color_print(main->error.to.stream, main->context.set.error, "' parameter requires a positive number.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select, main->error.notable);
+ fl_print_format("%[' parameter requires a positive number.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
fss_extended_read_depths_resize(0, &data.depths);
fss_extended_read_data_delete_simple(&data);
}
else {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify one or more files.%c", fll_error_print_error, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
#include <fll/level_2/error.h>
#include <fll/level_2/file.h>
#include <fll/level_2/fss_extended.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#ifdef __cplusplus
f_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_color_context_t context;
} fss_extended_read_main_t;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_color_context_t_initialize, \
}
#endif // _di_fss_extended_read_main_t_
if (!data->depths.array[i].value_name.used) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_name);
- f_color_print(main->error.to.stream, main->context.set.error, "' must not be an empty string.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_name, main->error.notable);
+ fl_print_format("%[' must not be an empty string.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
if (data->depths.array[i].depth == data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe value '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may only be specified once for the parameter '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe value '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
}
else if (data->depths.array[i].depth > data->depths.array[j].depth) {
if (main->error.verbosity != f_console_verbosity_quiet) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_extended_read_long_depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' may not have the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[i].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "' before the value '");
- f_color_print(main->error.to.stream, main->context.set.notable, "%llu", data->depths.array[j].depth);
- f_color_print(main->error.to.stream, main->context.set.error, "'.%c", f_string_eol_s[0]);
+ flockfile(main->error.to.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth, main->error.notable);
+ fl_print_format("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
+ fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context);
+ fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->error.to.stream);
}
return F_status_set_error(F_parameter);
return;
}
+ flockfile(main->output.stream);
+
if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_content) && (data->contents.array[at].used || (data->option & fss_extended_read_data_option_empty))) {
if (data->option & fss_extended_read_data_option_object) {
if (data->option & fss_extended_read_data_option_trim) {
- fl_print_trim_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
else {
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->objects.array[at], delimits_object);
+ f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.stream);
}
if (data->option & fss_extended_read_data_option_content) {
if (data->select < data->contents.array[at].used) {
content_printed = F_true;
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->contents.array[at].array[data->select], delimits_content);
+ f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[data->select], delimits_content, main->output.stream);
}
}
else {
content_printed = F_true;
- f_print_except_dynamic_partial(main->output.stream, data->buffer, data->contents.array[at].array[i], delimits_content);
+ f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[i], delimits_content, main->output.stream);
if (i + 1 < data->contents.array[at].used && data->contents.array[at].array[i + 1].start <= data->contents.array[at].array[i + 1].stop) {
fss_extended_read_print_content_end(main);
if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_content) && (content_printed || (data->option & fss_extended_read_data_option_empty))) {
fss_extended_read_print_set_end(main);
}
+
+ funlockfile(main->output.stream);
}
}
#endif // _di_fss_extended_read_print_at_
void fss_extended_read_print_content_end(fss_extended_read_main_t * const main) {
if (main->parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_extended_read_pipe_content_start);
+ f_print_character(fss_extended_read_pipe_content_start, main->output.stream);
}
else {
- fprintf(main->output.stream, "%c", f_fss_space);
+ f_print_character(f_fss_space, main->output.stream);
}
}
#endif // _di_fss_extended_read_print_content_end_
void fss_extended_read_print_object_end(fss_extended_read_main_t * const main) {
if (main->parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_extended_read_pipe_content_end);
+ f_print_character(fss_extended_read_pipe_content_end, main->output.stream);
}
else {
- fprintf(main->output.stream, "%c", f_fss_space);
+ f_print_character(f_fss_space, main->output.stream);
}
}
#endif // _di_fss_extended_read_print_object_end_
#ifndef _di_fss_extended_read_print_one_
void fss_extended_read_print_one(fss_extended_read_main_t * const main) {
- fprintf(main->output.stream, "1%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_1_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_extended_read_print_one_
void fss_extended_read_print_set_end(fss_extended_read_main_t * const main) {
if (main->parameters[fss_extended_read_parameter_pipe].result == f_console_result_found) {
- fprintf(main->output.stream, "%c", fss_extended_read_pipe_content_end);
+ f_print_character(fss_extended_read_pipe_content_end, main->output.stream);
}
else {
fprintf(main->output.stream, "%c", f_fss_eol);
+ f_print_character(f_fss_eol, main->output.stream);
}
}
#endif // _di_fss_extended_read_print_set_end_
#ifndef _di_fss_extended_read_print_zero_
void fss_extended_read_print_zero(fss_extended_read_main_t * const main) {
- fprintf(main->output.stream, "0%c", f_string_eol_s[0]);
+ f_print_character(f_string_ascii_0_s[0], main->output.stream);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
#endif // _di_fss_extended_read_print_zero_
f_fss
f_pipe
f_print
-fl_conversion
fl_console
+fl_conversion
fl_fss
fl_print
fl_status
fll_error
fll_file
fll_fss
+fll_print
fll_program
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_extended_read.c private-common.c private-fss_extended_read.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC