*
* Intended to be used for the basic/standard verbosity modes for all programs following this practice.
*
+ * These are expected to be in numeric order such that the smallest number is the least verbose and the highest number is the most verbose.
+ *
* f_console_verbosity_*:
* - quiet: Verbosity is set to quiet.
* - error: Verbosity is set to error.
if (!size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
+ // Prevent double-frees and unnecessary frees.
+ if (!*structure && !length_new || *size == length_new) return F_data_not;
+
return private_f_memory_structure_adjust(length_new, type_size, structure, used, size);
}
#endif // _di_f_memory_structure_adjust_
if (!size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (*used + amount > *size) {
+ if (amount && *used + amount > *size) {
if (*used + amount > F_array_length_t_size_d) {
return F_status_set_error(F_array_too_large);
}
if (!size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
+ // Prevent double-frees and unnecessary frees.
+ if (!*structure && !length_new || *size == length_new) return F_data_not;
+
return private_f_memory_structure_resize(length_new, type_size, structure, used, size);
}
#endif // _di_f_memory_structure_resize_
#if !defined(_di_f_memory_adjust_) || !defined(_di_f_memory_structure_adjust_) || !defined(_di_f_memory_structure_decimate_by_)
f_status_t private_f_memory_adjust(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) {
- if (length_old == length_new) return F_data_not;
+ // When old length is 0 and the pointer is not NULL, then consider this pointer stale and reset it to NULL.
+ if (!length_old && *pointer) {
+ *pointer = 0;
+ }
if (*pointer) {
if (length_old) {
#if !defined(_di_f_memory_resize_) || !defined(_di_memory_structure_decrease_by_) || !defined(_di_memory_structure_increase_) || !defined(_di_memory_structure_increase_by_) || !defined(_di_f_memory_structure_resize_)
f_status_t private_f_memory_resize(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) {
+ // When old length is 0 and the pointer is not NULL, then consider this pointer stale and reset it to NULL.
+ if (!length_old && *pointer) {
+ *pointer = 0;
+ }
+
if (*pointer) {
if (length_new) {
void * const new_pointer = realloc(*pointer, type_size * length_new);
f_status_t private_f_memory_structure_resize(const size_t length_new, const size_t type_size, void ** const structure, f_array_length_t * const used, f_array_length_t * const size) {
const f_status_t status = private_f_memory_resize(*size, length_new, type_size, structure);
- if (F_status_is_error(status)) return status;
- *size = length_new;
+ if (F_status_is_error_not(status)) {
+ *size = length_new;
- if (*used > *size) {
- *used = *size;
+ if (*used > *size) {
+ *used = *size;
+ }
}
- return F_none;
+ return status;
}
#endif // !defined(_di_memory_structure_decrease_by_) || !defined(_di_memory_structure_increase_) || !defined(_di_memory_structure_increase_by_) || !defined(_di_f_memory_structure_resize_)
}
#endif // _di_fll_program_parameter_additional_rip_mash_
-#ifndef _di_fll_program_parameter_long_print_cannot_use_with_
- f_status_t fll_program_parameter_long_print_cannot_use_with(const fl_print_t print, const f_string_static_t first, const f_string_static_t second) {
-
- f_file_stream_lock(print.to);
-
- fl_print_format("%[%QCannot specify the '%]", print.to.stream, print.context, print.prefix, print.context);
- fl_print_format("%[%r%r%]", print.to.stream, print.notable, f_console_symbol_long_enable_s, first, print.notable);
- fl_print_format("%[' parameter with the '%]", print.to.stream, print.context, print.context);
- fl_print_format("%[%r%r%]", print.to.stream, print.notable, f_console_symbol_long_enable_s, second, print.notable);
- fl_print_format("%[' parameter.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
-
- f_file_stream_unlock(print.to);
-
- return F_none;
- }
-#endif // _di_fll_program_parameter_long_print_cannot_use_with_
-
#ifndef _di_fll_program_standard_set_down_
f_status_t fll_program_standard_set_down(fll_program_data_t * const main) {
#ifndef _di_level_2_parameter_checking_
#endif // _di_level_2_parameter_checking_
// The fclose() calls have undefined behavior when closing an already closed file.
- // Avoid this by explicitly checking every permutation to make sure each descriptor is not a duplicat descriptor.
+ // Avoid this by explicitly checking every permutation to make sure each descriptor is not a duplicate descriptor.
// 0x1 = message stream, 0x2 = output stream, 0x4 = error stream, 0x8 = warning stream, 0x10 = debug stream.
// 0x20 = message descriptor, 0x40 = output descriptor, 0x80 = error descriptor, 0x100 = warning descriptor, 0x200 = debug descriptor.
uint16_t flag = 0;
- if (main->message.to.id == -1) {
- if (main->message.to.stream != 0 && main->message.to.stream != F_type_error_d && main->message.to.stream != F_type_input_d && main->message.to.stream != F_type_output_d) {
+ if (main->message.to.stream) {
+ if (main->message.to.stream != F_type_error_d && main->message.to.stream != F_type_input_d && main->message.to.stream != F_type_output_d) {
f_file_stream_flush(main->message.to);
flag |= 0x1;
}
}
- else {
+
+ if (main->message.to.id == -1) {
if (main->message.to.id != F_type_descriptor_error_d && main->message.to.id != F_type_descriptor_input_d && main->message.to.id != F_type_descriptor_output_d) {
f_file_flush(main->message.to);
}
}
- if (main->output.to.id == -1) {
- if (main->output.to.stream && main->output.to.stream != main->message.to.stream) {
+ if (main->output.to.stream) {
+ if (main->output.to.stream != main->message.to.stream) {
if (main->output.to.stream != F_type_error_d && main->output.to.stream != F_type_input_d && main->output.to.stream != F_type_output_d) {
f_file_stream_flush(main->output.to);
}
}
}
- else if (main->output.to.id != main->message.to.id) {
- if (main->output.to.id != F_type_descriptor_error_d && main->output.to.id != F_type_descriptor_input_d && main->output.to.id != F_type_descriptor_output_d) {
- f_file_flush(main->output.to);
- flag |= 0x40;
+ if (main->error.to.id != -1) {
+ if (main->output.to.id != main->message.to.id) {
+ if (main->output.to.id != F_type_descriptor_error_d && main->output.to.id != F_type_descriptor_input_d && main->output.to.id != F_type_descriptor_output_d) {
+ f_file_flush(main->output.to);
+
+ flag |= 0x40;
+ }
}
}
- if (main->error.to.id == -1) {
- if (main->error.to.stream && main->error.to.stream != main->message.to.stream && main->error.to.stream != main->output.to.stream) {
+ if (main->error.to.stream) {
+ if (main->error.to.stream != main->message.to.stream && main->error.to.stream != main->output.to.stream) {
if (main->error.to.stream != F_type_error_d && main->error.to.stream != F_type_input_d && main->error.to.stream != F_type_output_d) {
f_file_stream_flush(main->error.to);
}
}
}
- else if (main->error.to.id != main->message.to.id && main->error.to.id != main->output.to.id) {
- if (main->error.to.id != F_type_descriptor_error_d && main->error.to.id != F_type_descriptor_input_d && main->error.to.id != F_type_descriptor_output_d) {
- f_file_flush(main->error.to);
- flag |= 0x80;
+ if (main->error.to.id != -1) {
+ if (main->error.to.id != main->message.to.id && main->error.to.id != main->output.to.id) {
+ if (main->error.to.id != F_type_descriptor_error_d && main->error.to.id != F_type_descriptor_input_d && main->error.to.id != F_type_descriptor_output_d) {
+ f_file_flush(main->error.to);
+
+ flag |= 0x80;
+ }
}
}
- if (main->warning.to.id == -1) {
- if (main->warning.to.stream && main->warning.to.stream != main->message.to.stream && main->warning.to.stream != main->output.to.stream && main->warning.to.stream != main->error.to.stream) {
+ if (main->warning.to.stream) {
+ if (main->warning.to.stream != main->message.to.stream && main->warning.to.stream != main->output.to.stream && main->warning.to.stream != main->error.to.stream) {
if (main->warning.to.stream != F_type_error_d && main->warning.to.stream != F_type_input_d && main->warning.to.stream != F_type_output_d) {
f_file_stream_flush(main->warning.to);
}
}
}
- else if (main->warning.to.id != main->message.to.id && main->warning.to.id != main->output.to.id && main->warning.to.id != main->error.to.id) {
- if (main->warning.to.id != F_type_descriptor_error_d && main->warning.to.id != F_type_descriptor_input_d && main->warning.to.id != F_type_descriptor_output_d) {
- f_file_flush(main->warning.to);
- flag |= 0x100;
+ if (main->warning.to.id != -1) {
+ if (main->warning.to.id != main->message.to.id && main->warning.to.id != main->output.to.id && main->warning.to.id != main->error.to.id) {
+ if (main->warning.to.id != F_type_descriptor_error_d && main->warning.to.id != F_type_descriptor_input_d && main->warning.to.id != F_type_descriptor_output_d) {
+ f_file_flush(main->warning.to);
+
+ flag |= 0x100;
+ }
}
}
- if (main->debug.to.id == -1) {
- if (main->debug.to.stream && main->debug.to.stream != main->message.to.stream && main->debug.to.stream != main->output.to.stream && main->debug.to.stream != main->error.to.stream && main->debug.to.stream != main->warning.to.stream) {
+ if (main->debug.to.stream) {
+ if (main->debug.to.stream != main->message.to.stream && main->debug.to.stream != main->output.to.stream && main->debug.to.stream != main->error.to.stream && main->debug.to.stream != main->warning.to.stream) {
if (main->debug.to.stream != F_type_error_d && main->debug.to.stream != F_type_input_d && main->debug.to.stream != F_type_output_d) {
f_file_stream_flush(main->debug.to);
}
}
}
- else if (main->debug.to.id != main->message.to.id && main->debug.to.id != main->output.to.id && main->debug.to.id != main->error.to.id && main->debug.to.id != main->warning.to.id) {
- if (main->debug.to.id != F_type_descriptor_error_d && main->debug.to.id != F_type_descriptor_input_d && main->debug.to.id != F_type_descriptor_output_d) {
- f_file_flush(main->debug.to);
- flag |= 0x200;
+ if (main->debug.to.id != -1) {
+ if (main->debug.to.id != main->message.to.id && main->debug.to.id != main->output.to.id && main->debug.to.id != main->error.to.id && main->debug.to.id != main->warning.to.id) {
+ if (main->debug.to.id != F_type_descriptor_error_d && main->debug.to.id != F_type_descriptor_input_d && main->debug.to.id != F_type_descriptor_output_d) {
+ f_file_flush(main->debug.to);
+
+ flag |= 0x200;
+ }
}
}
#endif // _di_fll_program_parameter_additional_rip_mash_
/**
- * Print message about two long parameters not being allowed to be used together.
- *
- * This assumes both of the long parameters use f_console_symbol_long_enable_s.
- *
- * @param print
- * The output structure.
- * @param first
- * The first string.
- * @param second
- * The second string.
- *
- * @return
- * F_none on success.
- */
-#ifndef _di_fll_program_parameter_long_print_cannot_use_with_
- extern f_status_t fll_program_parameter_long_print_cannot_use_with(const fl_print_t print, const f_string_static_t first, const f_string_static_t second);
-#endif // _di_fll_program_parameter_long_print_cannot_use_with_
-
-/**
* This provides a standard program set down operations used by FLL programs.
*
* This does the following:
int child;
uint8_t pipe;
- int signal_received;
+ uint32_t signal_received;
uint16_t signal_check;
f_signal_t signal;
extern "C" {
#endif
+#ifndef _di_fll_program_print_error_missing_variable_not_zero_
+ f_status_t fll_program_print_error_missing_variable_not_zero(const fl_print_t print, const f_string_static_t variable) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe %]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%]", print.to.stream, print.set->notable, variable, print.set->notable);
+ fl_print_format("%[ is missing or has a length of %]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[0%]", print.to.stream, print.set->notable, print.set->notable);
+ fl_print_format("%[.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_missing_variable_not_zero_
+
+#ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_
+ f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, first, print.set->notable);
+ fl_print_format("%[' parameter and the '%]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, second, print.set->notable);
+ fl_print_format("%[' parameter must be specified the same number of times.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_both_specified_same_amount_
+
+#ifndef _di_fll_program_print_error_parameter_cannot_use_with_
+ f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QCannot specify the '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, first, print.set->notable);
+ fl_print_format("%[' parameter with the '%]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, second, print.set->notable);
+ fl_print_format("%[' parameter.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_cannot_use_with_
+
+#ifndef _di_fll_program_print_error_parameter_missing_value_
+ f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_missing_value_
+
+#ifndef _di_fll_program_print_error_parameter_must_specify_once_
+ f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe parameter '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable);
+ fl_print_format("%[' may only be specified once.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_must_specify_once_
+
+#ifndef _di_fll_program_print_error_parameter_must_specify_once_value_
+ f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe value '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, value, print.set->notable);
+ fl_print_format("%[' may only be specified once for the parameter '%]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%Q%Q%]", print.to.stream, print.set->notable, symbol, parameter, print.set->notable);
+ fl_print_format("%['.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_parameter_must_specify_once_value_
+
+#ifndef _di_fll_program_print_error_pipe_invalid_form_feed_
+ f_status_t fll_program_print_error_pipe_invalid_form_feed(const fl_print_t print) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe pipe has incorrectly placed form-feed characters (\\f).%]%r", print.to.stream, print.set->error, print.prefix, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_pipe_invalid_form_feed_
+
+#ifndef _di_fll_program_print_error_pipe_missing_content_
+ f_status_t fll_program_print_error_pipe_missing_content(const fl_print_t print) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe pipe has no content.%]%r", print.to.stream, print.set->error, print.prefix, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_pipe_missing_content_
+
+#ifndef _di_fll_program_print_error_pipe_object_without_content_
+ f_status_t fll_program_print_error_pipe_object_without_content(const fl_print_t print) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe pipe has an Object without Content.%]%r", print.to.stream, print.set->error, print.prefix, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_fll_program_print_error_pipe_object_without_content_
+
#ifndef _di_fll_program_print_help_header_
f_status_t fll_program_print_help_header(const fl_print_t print, const f_string_static_t name, const f_string_static_t version) {
#ifndef _di_fll_program_print_help_usage_
f_status_t fll_program_print_help_usage(const fl_print_t print, const f_string_static_t name, const f_string_static_t parameters) {
- fl_print_format("%r%r %[Usage:%]%r", print.to.stream, f_string_eol_s, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
+ fl_print_format(" %[Usage:%]%r", print.to.stream, print.set->important, print.set->important, f_string_eol_s);
fl_print_format(" %[%Q%]", print.to.stream, print.set->standout, name, print.set->standout);
fl_print_format(" %[[%] options %[]%]", print.to.stream, print.set->notable, print.set->notable, print.set->notable, print.set->notable);
#endif // _di_fll_program_print_help_usage_
#ifndef _di_fll_program_print_signal_received_
- f_status_t fll_program_print_signal_received(const fl_print_t print, const f_string_static_t line_first, const f_status_t signal) {
+ f_status_t fll_program_print_signal_received(const fl_print_t print, const f_string_static_t line_first, const uint32_t signal) {
if (print.verbosity != f_console_verbosity_verbose_e && print.verbosity != f_console_verbosity_debug_e) {
return F_output_not;
}
- flockfile(print.to.stream);
+ f_file_stream_lock(print.to);
// Must flush and reset color because the interrupt may have interrupted the middle of a print function.
f_file_stream_flush(print.to);
fl_print_format("%]%r%[Received signal code %]", print.to.stream, print.set->reset, line_first, print.set->warning, print.set->warning);
- fl_print_format("%[%i%]", print.to.stream, print.set->notable, signal, print.set->notable);
+ fl_print_format("%[%u%]", print.to.stream, print.set->notable, signal, print.set->notable);
fl_print_format("%[.%]%r", print.to.stream, print.set->warning, print.set->warning, f_string_eol_s);
- funlockfile(print.to.stream);
+ f_file_stream_unlock(print.to);
return F_none;
}
#endif
/**
+ * Print an error message a variable not being defined or the variable has a length is 0.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param variable
+ * The name of the variable that is not defined or has a length of 0.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_missing_variable_not_zero_
+ extern f_status_t fll_program_print_error_missing_variable_not_zero(const fl_print_t print, const f_string_static_t variable);
+#endif // _di_fll_program_print_error_missing_variable_not_zero_
+
+/**
+ * Print an error message about two parameters being required to be specified the same number of times.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param first
+ * The first parameter name.
+ * @param second
+ * The second parameter name.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_both_specified_same_amount_
+ extern f_status_t fll_program_print_error_parameter_both_specified_same_amount(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second);
+#endif // _di_fll_program_print_error_parameter_both_specified_same_amount_
+
+/**
+ * Print message about two parameters not being allowed to be used together.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param first
+ * The first parameter name.
+ * @param second
+ * The second parameter name.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_cannot_use_with_
+ extern f_status_t fll_program_print_error_parameter_cannot_use_with(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t first, const f_string_static_t second);
+#endif // _di_fll_program_print_error_parameter_cannot_use_with_
+
+/**
+ * Print message about parameter not have the required value associated with this.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This locks, uses, and unlocks the file stream.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param parameter
+ * The parameter name.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_missing_value_
+ f_status_t fll_program_print_error_parameter_missing_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter);
+#endif // _di_fll_program_print_error_parameter_missing_value_
+
+/**
+ * Print message about parameter only being allowed to be used once.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This locks, uses, and unlocks the file stream.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param parameter
+ * The parameter name.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_must_specify_once_
+ extern f_status_t fll_program_print_error_parameter_must_specify_once(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter);
+#endif // _di_fll_program_print_error_parameter_must_specify_once_
+
+/**
+ * Print message about a specific value only being allowed to be used once for the parameter.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ * @param symbol
+ * The symbol string prepended to both parameters.
+ * This locks, uses, and unlocks the file stream.
+ * This is usually f_console_symbol_long_enable_s.
+ * @param parameter
+ * The parameter name.
+ * @param value
+ * The value.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_parameter_must_specify_once_value_
+ extern f_status_t fll_program_print_error_parameter_must_specify_once_value(const fl_print_t print, const f_string_static_t symbol, const f_string_static_t parameter, const f_string_static_t value);
+#endif // _di_fll_program_print_error_parameter_must_specify_once_value_
+
+/**
+ * Print a message about the pipe having an invalid form-feed character '\f' (U+000C).
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_pipe_invalid_form_feed_
+ extern f_status_t fll_program_print_error_pipe_invalid_form_feed(const fl_print_t print);
+#endif // _di_fll_program_print_error_pipe_invalid_form_feed_
+
+/**
+ * Print a message about the pipe not having any content.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_pipe_missing_content_
+ extern f_status_t fll_program_print_error_pipe_missing_content(const fl_print_t print);
+#endif // _di_fll_program_print_error_pipe_missing_content_
+
+/**
+ * Print a message about the pipe having an Object without Content.
+ *
+ * This generally refers to an FSS Object and an FSS Content.
+ *
+ * This is only printed when verbosity is not set to quiet.
+ *
+ * This uses the following:
+ * - print.set->error: For the error context.
+ * - print.set->strong: For the highlighting context
+ * - print.prefix: For the prefixing a string to the message (such as "ERROR:").
+ *
+ * @param print
+ * The output structure.
+ * This locks, uses, and unlocks the file stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_fll_program_print_error_pipe_object_without_content_
+ extern f_status_t fll_program_print_error_pipe_object_without_content(const fl_print_t print);
+#endif // _di_fll_program_print_error_pipe_object_without_content_
+
+/**
* Print standard help header.
*
* This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.
*
* @param print
* The output structure to print to.
+ * This uses but does not lock or unlock file stream.
* This requires print.set to be non-NULL.
* @param name
* The name of the program.
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*
* @see f_print_terminated()
* @see fl_print_format()
*
* @param print
* The output structure to print to.
+ * This uses but does not lock or unlock file stream.
* This requires print.set to be non-NULL.
* @param option_short
* The short name of the option.
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*
* @see f_print_terminated()
* @see fl_print_format()
*
* @param print
* The output structure to print to.
+ * This uses but does not lock or unlock file stream.
* This requires print.set to be non-NULL.
* @param option_long
* The long name of the option.
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*
* @see f_print_terminated()
* @see fl_print_format()
*
* @param print
* The output structure to print to.
+ * This uses but does not lock or unlock file stream.
* This requires print.set to be non-NULL.
* @param option_other
* The other name of the option.
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*
* @see f_print_terminated()
* @see fl_print_format()
* This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.
*
* @param print
- * The output structure to print to.
+ * The output structure to print to
+ * This uses but does not lock or unlock file stream.
* This requires print.set to be non-NULL.
* @param context
* The color context.
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*
* @see f_print_terminated()
* @see fl_print_format()
*
* @param print
* The output structure to print to.
+ * This uses but does not lock or unlock file stream.
* This requires print.set to be non-NULL.
* @param name
* The name of the program.
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*
* @see f_print_terminated()
* @see fl_print_format()
*
* @param print
* The output structure to print to.
+ * This locks, uses, and unlocks the file stream.
* This requires print.set to be non-NULL.
* @param line_first
* The first line character, which is expected to be set to either f_string_eol_s or f_string_empty_s.
* F_output_not on success, but no printing is performed.
*/
#ifndef _di_fll_program_print_signal_received_
- extern f_status_t fll_program_print_signal_received(const fl_print_t print, const f_string_static_t line_first, const f_status_t signal);
+ extern f_status_t fll_program_print_signal_received(const fl_print_t print, const f_string_static_t line_first, const uint32_t signal);
#endif // _di_fll_program_print_signal_received_
/**
* Print the program version.
*
- * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.
- *
* @param print
* The output structure to print to.
+ * This uses but does not lock or unlock file stream.
* This requires print.set to be non-NULL.
* @param version
* The version number of the program.
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*
* @see fl_print_format()
*/
if (main->parameters.remaining.used || (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[byte_dump_parameter_width_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_width_s, main->context.set.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
return F_status_set_error(F_parameter);
}
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
if (F_status_is_error(status) || number < 1 || number >= 0xfb) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_width_s, main->context.set.notable);
fl_print_format("%[250%]", main->error.to.stream, main->context.set.notable, main->context.set.notable);
fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
if (F_status_is_error(status)) return status;
}
if (main->parameters.array[byte_dump_parameter_first_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
return F_status_set_error(F_parameter);
}
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
if (F_status_is_error(status) || number > F_number_t_size_unsigned_d) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable);
fl_print_format("%[%un%]", main->error.to.stream, main->context.set.notable, F_number_t_size_unsigned_d, main->context.set.notable);
fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
if (F_status_is_error(status)) return status;
}
if (main->parameters.array[byte_dump_parameter_last_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
return F_status_set_error(F_parameter);
}
status = fl_conversion_dynamic_to_unsigned_detect(fl_conversion_data_base_10_c, data.argv[index], &number);
if (F_status_is_error(status) || number < 0 || number > F_number_t_size_unsigned_d) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable);
fl_print_format("%[%un%]", main->error.to.stream, main->context.set.notable, F_number_t_size_unsigned_d, main->context.set.notable);
fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
if (F_status_is_error(status)) return status;
if (main->parameters.array[byte_dump_parameter_first_e].result == f_console_result_additional_e && main->parameters.array[byte_dump_parameter_last_e].result == f_console_result_additional_e) {
if (data.first > data.last) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_first_s, main->context.set.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, byte_dump_long_last_s, main->context.set.notable);
fl_print_format("%[' value.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
return F_status_set_error(F_parameter);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
if (main->output.verbosity != f_console_verbosity_quiet_e) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_error_file_print(main->error, F_status_set_fine(status), "byte_dump_file", F_true, data.argv[main->parameters.remaining.array[counter]], f_file_operation_process_s, fll_error_file_type_file_e);
}
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { byte_dump_parameter_from_bytesequence_e, byte_dump_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- byte_dump_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == byte_dump_parameter_from_bytesequence_e) {
- if (setting->mode & byte_dump_mode_from_codepoint_e) {
- setting->mode -= byte_dump_mode_from_codepoint_e;
- }
-
- setting->mode |= byte_dump_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == byte_dump_parameter_from_codepoint_e) {
- if (setting->mode & byte_dump_mode_from_bytesequence_e) {
- setting->mode -= byte_dump_mode_from_bytesequence_e;
- }
-
- setting->mode |= byte_dump_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { byte_dump_parameter_to_bytesequence_e, byte_dump_parameter_to_codepoint_e, byte_dump_parameter_to_combining_e, byte_dump_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- byte_dump_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == byte_dump_parameter_to_bytesequence_e) {
- if (setting->mode & byte_dump_mode_to_codepoint_e) {
- setting->mode -= byte_dump_mode_to_codepoint_e;
- }
-
- if (setting->mode & byte_dump_mode_to_combining_e) {
- setting->mode -= byte_dump_mode_to_combining_e;
- }
-
- if (setting->mode & byte_dump_mode_to_width_e) {
- setting->mode -= byte_dump_mode_to_width_e;
- }
-
- setting->mode |= byte_dump_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == byte_dump_parameter_to_codepoint_e) {
- if (setting->mode & byte_dump_mode_to_bytesequence_e) {
- setting->mode -= byte_dump_mode_to_bytesequence_e;
- }
-
- if (setting->mode & byte_dump_mode_to_combining_e) {
- setting->mode -= byte_dump_mode_to_combining_e;
- }
-
- if (setting->mode & byte_dump_mode_to_width_e) {
- setting->mode -= byte_dump_mode_to_width_e;
- }
-
- setting->mode |= byte_dump_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == byte_dump_parameter_to_combining_e) {
- if (setting->mode & byte_dump_mode_to_bytesequence_e) {
- setting->mode -= byte_dump_mode_to_bytesequence_e;
- }
-
- if (setting->mode & byte_dump_mode_to_codepoint_e) {
- setting->mode -= byte_dump_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[byte_dump_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= byte_dump_mode_to_width_e;
- }
-
- setting->mode |= byte_dump_mode_to_combining_e;
- }
- else if (choices.array[choice] == byte_dump_parameter_to_width_e) {
- if (setting->mode & byte_dump_mode_to_bytesequence_e) {
- setting->mode -= byte_dump_mode_to_bytesequence_e;
- }
-
- if (setting->mode & byte_dump_mode_to_codepoint_e) {
- setting->mode -= byte_dump_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[byte_dump_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= byte_dump_mode_to_combining_e;
- }
-
- setting->mode |= byte_dump_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[byte_dump_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[byte_dump_parameter_to_file_e].values.used > 1) {
- byte_dump_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[byte_dump_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[byte_dump_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[byte_dump_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[byte_dump_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= byte_dump_main_flag_file_to_e;
- }
- else {
- byte_dump_print_error_parameter_file_name_empty(main, setting, main->parameters.array[byte_dump_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[byte_dump_parameter_to_file_e].result == f_console_result_found_e) {
- byte_dump_print_error_no_value(main, setting, byte_dump_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & byte_dump_main_flag_file_to_e) {
- setting->flag -= byte_dump_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[byte_dump_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[byte_dump_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[byte_dump_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[byte_dump_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- byte_dump_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- byte_dump_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= byte_dump_main_flag_file_from_e;
- }
- else if (main->parameters.array[byte_dump_parameter_from_file_e].result == f_console_result_found_e) {
- byte_dump_print_error_no_value(main, setting, byte_dump_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & byte_dump_main_flag_file_from_e) {
- setting->flag -= byte_dump_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[byte_dump_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- byte_dump_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & byte_dump_mode_to_bytesequence_e)) {
- if (main->parameters.array[byte_dump_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[byte_dump_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = byte_dump_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[byte_dump_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= byte_dump_main_flag_header_e;
- }
-
- if (main->parameters.array[byte_dump_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= byte_dump_main_flag_separate_e;
- }
-
if (main->parameters.array[byte_dump_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= byte_dump_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_byte_dump_setting_load_
fflush(data->main->output.to.stream);
if (found_invalid_utf) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%[Invalid UTF-8 codes were detected for file '%]", data->main->error.to.stream, data->main->context.set.error, data->main->context.set.error);
}
if (ferror(file.stream)) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%[%Qread() failed for '%]", data->main->error.to.stream, data->main->context.set.error, data->main->error.prefix, data->main->context.set.error);
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { control_parameter_from_bytesequence_e, control_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- control_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == control_parameter_from_bytesequence_e) {
- if (setting->mode & control_mode_from_codepoint_e) {
- setting->mode -= control_mode_from_codepoint_e;
- }
-
- setting->mode |= control_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == control_parameter_from_codepoint_e) {
- if (setting->mode & control_mode_from_bytesequence_e) {
- setting->mode -= control_mode_from_bytesequence_e;
- }
-
- setting->mode |= control_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { control_parameter_to_bytesequence_e, control_parameter_to_codepoint_e, control_parameter_to_combining_e, control_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- control_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == control_parameter_to_bytesequence_e) {
- if (setting->mode & control_mode_to_codepoint_e) {
- setting->mode -= control_mode_to_codepoint_e;
- }
-
- if (setting->mode & control_mode_to_combining_e) {
- setting->mode -= control_mode_to_combining_e;
- }
-
- if (setting->mode & control_mode_to_width_e) {
- setting->mode -= control_mode_to_width_e;
- }
-
- setting->mode |= control_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == control_parameter_to_codepoint_e) {
- if (setting->mode & control_mode_to_bytesequence_e) {
- setting->mode -= control_mode_to_bytesequence_e;
- }
-
- if (setting->mode & control_mode_to_combining_e) {
- setting->mode -= control_mode_to_combining_e;
- }
-
- if (setting->mode & control_mode_to_width_e) {
- setting->mode -= control_mode_to_width_e;
- }
-
- setting->mode |= control_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == control_parameter_to_combining_e) {
- if (setting->mode & control_mode_to_bytesequence_e) {
- setting->mode -= control_mode_to_bytesequence_e;
- }
-
- if (setting->mode & control_mode_to_codepoint_e) {
- setting->mode -= control_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[control_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= control_mode_to_width_e;
- }
-
- setting->mode |= control_mode_to_combining_e;
- }
- else if (choices.array[choice] == control_parameter_to_width_e) {
- if (setting->mode & control_mode_to_bytesequence_e) {
- setting->mode -= control_mode_to_bytesequence_e;
- }
-
- if (setting->mode & control_mode_to_codepoint_e) {
- setting->mode -= control_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[control_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= control_mode_to_combining_e;
- }
-
- setting->mode |= control_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[control_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[control_parameter_to_file_e].values.used > 1) {
- control_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[control_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[control_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[control_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[control_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= control_main_flag_file_to_e;
- }
- else {
- control_print_error_parameter_file_name_empty(main, setting, main->parameters.array[control_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[control_parameter_to_file_e].result == f_console_result_found_e) {
- control_print_error_no_value(main, setting, control_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & control_main_flag_file_to_e) {
- setting->flag -= control_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[control_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[control_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[control_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[control_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- control_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- control_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= control_main_flag_file_from_e;
- }
- else if (main->parameters.array[control_parameter_from_file_e].result == f_console_result_found_e) {
- control_print_error_no_value(main, setting, control_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & control_main_flag_file_from_e) {
- setting->flag -= control_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[control_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- control_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & control_mode_to_bytesequence_e)) {
- if (main->parameters.array[control_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[control_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = control_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[control_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= control_main_flag_header_e;
- }
-
- if (main->parameters.array[control_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= control_main_flag_separate_e;
- }
-
if (main->parameters.array[control_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= control_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_control_setting_load_
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
if (main->output.verbosity != f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fflush(main->error.to.stream);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
if (F_status_is_error(status)) {
fll_error_file_print(main->error, F_status_set_fine(status), "f_file_exists", F_true, data->cache.small, f_file_operation_find_s, fll_error_file_type_directory_e);
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
}
if (F_status_is_error(status)) {
fll_error_file_print(main->error, F_status_set_fine(status), "f_file_exists", F_true, data->cache.small, f_file_operation_find_s, fll_error_file_type_directory_e);
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
}
if (header.status == F_failure) {
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, control_action_type_name(header.action), main->context.set.notable);
fl_print_format("%[).%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
}
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
return;
}
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QReceived error response for " CONTROL_action_s " '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%q%]", main->error.to.stream, main->context.set.notable, control_action_type_name(header.action), main->context.set.notable);
fl_print_format("%[).%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
}
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_packet_response_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[' is not a known controller action.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_not_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[' a rule base name cannot be an empty string.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_basename_empty_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[' a rule directory path cannot be an empty string.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_directory_empty_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[' a rule name cannot be an empty string.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_empty_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[' requires either a full rule name or a rule directory path along with the rule base name.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_not_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[' has too few arguments.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_too_few_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, with, main->context.set.notable);
fl_print_format("%[' has too few arguments.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_too_few_with_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[' has too many arguments.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_too_many_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, with, main->context.set.notable);
fl_print_format("%[' has too many arguments.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_too_many_with_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe action parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, action, main->context.set.notable);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, with, main->context.set.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_action_rule_with_unknown_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, parameter, main->context.set.notable);
fl_print_format("%[' must not be an empty string.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_value_empty_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, parameter, main->context.set.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_parameter_value_not_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QFailed to connect to the socket file '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, path_socket, main->context.set.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_socket_file_failed_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe controller socket file '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, path_socket, main->context.set.notable);
fl_print_format("%[' could not be found and is required.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_socket_file_missing_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe controller socket file '%]", main->error.to.stream, f_string_eol_s, main->context.set.error, main->error.prefix, main->context.set.error);
fl_print_format("%[%Q%]", main->error.to.stream, main->context.set.notable, path_socket, main->context.set.notable);
fl_print_format("%[' is not a socket file.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_control_print_error_socket_file_not_
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { controller_parameter_from_bytesequence_e, controller_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- controller_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == controller_parameter_from_bytesequence_e) {
- if (setting->mode & controller_mode_from_codepoint_e) {
- setting->mode -= controller_mode_from_codepoint_e;
- }
-
- setting->mode |= controller_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == controller_parameter_from_codepoint_e) {
- if (setting->mode & controller_mode_from_bytesequence_e) {
- setting->mode -= controller_mode_from_bytesequence_e;
- }
-
- setting->mode |= controller_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { controller_parameter_to_bytesequence_e, controller_parameter_to_codepoint_e, controller_parameter_to_combining_e, controller_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- controller_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == controller_parameter_to_bytesequence_e) {
- if (setting->mode & controller_mode_to_codepoint_e) {
- setting->mode -= controller_mode_to_codepoint_e;
- }
-
- if (setting->mode & controller_mode_to_combining_e) {
- setting->mode -= controller_mode_to_combining_e;
- }
-
- if (setting->mode & controller_mode_to_width_e) {
- setting->mode -= controller_mode_to_width_e;
- }
-
- setting->mode |= controller_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == controller_parameter_to_codepoint_e) {
- if (setting->mode & controller_mode_to_bytesequence_e) {
- setting->mode -= controller_mode_to_bytesequence_e;
- }
-
- if (setting->mode & controller_mode_to_combining_e) {
- setting->mode -= controller_mode_to_combining_e;
- }
-
- if (setting->mode & controller_mode_to_width_e) {
- setting->mode -= controller_mode_to_width_e;
- }
-
- setting->mode |= controller_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == controller_parameter_to_combining_e) {
- if (setting->mode & controller_mode_to_bytesequence_e) {
- setting->mode -= controller_mode_to_bytesequence_e;
- }
-
- if (setting->mode & controller_mode_to_codepoint_e) {
- setting->mode -= controller_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[controller_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= controller_mode_to_width_e;
- }
-
- setting->mode |= controller_mode_to_combining_e;
- }
- else if (choices.array[choice] == controller_parameter_to_width_e) {
- if (setting->mode & controller_mode_to_bytesequence_e) {
- setting->mode -= controller_mode_to_bytesequence_e;
- }
-
- if (setting->mode & controller_mode_to_codepoint_e) {
- setting->mode -= controller_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[controller_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= controller_mode_to_combining_e;
- }
-
- setting->mode |= controller_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[controller_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[controller_parameter_to_file_e].values.used > 1) {
- controller_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[controller_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[controller_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[controller_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[controller_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= controller_main_flag_file_to_e;
- }
- else {
- controller_print_error_parameter_file_name_empty(main, setting, main->parameters.array[controller_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[controller_parameter_to_file_e].result == f_console_result_found_e) {
- controller_print_error_no_value(main, setting, controller_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & controller_main_flag_file_to_e) {
- setting->flag -= controller_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[controller_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[controller_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[controller_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[controller_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- controller_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- controller_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= controller_main_flag_file_from_e;
- }
- else if (main->parameters.array[controller_parameter_from_file_e].result == f_console_result_found_e) {
- controller_print_error_no_value(main, setting, controller_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & controller_main_flag_file_from_e) {
- setting->flag -= controller_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[controller_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- controller_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & controller_mode_to_bytesequence_e)) {
- if (main->parameters.array[controller_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[controller_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = controller_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[controller_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= controller_main_flag_header_e;
- }
-
- if (main->parameters.array[controller_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= controller_main_flag_separate_e;
- }
-
if (main->parameters.array[controller_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= controller_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_controller_setting_load_
}
else {
if (main->parameters.array[controller_parameter_settings_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, 0);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
if (F_status_is_error_not(status)) {
if (main->parameters.array[controller_parameter_pid_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, 0);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
if (F_status_is_error_not(status)) {
if (main->parameters.array[controller_parameter_cgroup_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, 0);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
if (F_status_is_error_not(status) && main->parameters.array[controller_parameter_daemon_e].result == f_console_result_found_e) {
if (main->parameters.array[controller_parameter_validate_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, 0);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
if (F_status_is_error(status) && main->output.verbosity != f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
return F_file_found_not;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stream_open", F_true, path, f_file_operation_open_s, fll_error_file_type_file_e);
}
}
status = f_file_stream_read(file, &cache->buffer_file);
if (F_status_is_error(status)) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, f_file_operation_read_s, fll_error_file_type_file_e);
}
}
status = f_file_stat(path, F_true, &stat_file);
if (F_status_is_error(status)) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stat", F_true, path, f_file_operation_stat_s, fll_error_file_type_file_e);
}
}
// Always return immediately on memory errors.
if (F_status_set_fine(status) == F_memory_not) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global->main->error.to, global->thread);
controller_print_error_file(0, global->main->error, F_status_set_fine(status), "controller_file_pid_create", F_true, global->setting->path_pid, f_file_operation_create_s, fll_error_file_type_file_e);
global->thread->id_control = 0;
}
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_thread_create", F_true);
}
}
if (cache->content_actions.array[i].used < at_least || cache->content_actions.array[i].used > at_most) {
action->status = F_status_set_error(F_parameter);
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
f_thread_mutex_lock(&global.thread->lock.print);
flockfile(global.main->error.to.stream);
status_action = action->status;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QThe %r item action must not have an empty string for a path (the first parameter).%]%r", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s);
}
}
}
else {
if (fl_string_dynamic_compare(action->parameters.array[1], cache->buffer_path) == F_equal_to_not) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(global.main->error.to.stream);
fl_print_format("%r%[%QThe %r item action second parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
status_action = action->status;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QThe %r item action must not have an empty string for a rule name (the second parameter).%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s);
}
}
}
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(global.main->error.to.stream);
fl_print_format("%r%[%QThe %r item action third parameter (and beyond) must be one of '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
status_action = action->status;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(global.main->error.to.stream);
fl_print_format("%r%[%QThe %r item action may not specify the reserved item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
status_action = action->status;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(global.main->error.to.stream);
fl_print_format("%r%[%QThe %r item action must have one of '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
break;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(global.main->error.to.stream);
fl_print_format("%r%[%QThe %r item action parameter '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
else {
action->status = F_status_set_error(F_supported_not);
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(global.main->error.to.stream);
fl_print_format("%r%[%QThe %r item action may only have '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
for (j = 2; j < cache->ats.used; j += 2) {
if (cache->ats.array[j] == i) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QThe %r item named '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, is_entry ? controller_entry_s : controller_exit_s, global.main->error.prefix, global.main->error.context);
if (error_has || i >= entry->items.used) {
if (i >= entry->items.used) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QThe %r item named '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, is_entry ? controller_entry_s : controller_exit_s, global.main->error.prefix, global.main->error.context);
}
if (global->main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e || global->main->error.verbosity == f_console_verbosity_verbose_e || global->main->error.verbosity == f_console_verbosity_debug_e) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e && global->main->error.verbosity != f_console_verbosity_error_e) {
+ if ((global->main->error.verbosity > f_console_verbosity_error_e)) {
controller_lock_print(global->main->output.to, global->thread);
fl_print_format("%rProcessing %r%r item '", global->main->output.to.stream, f_string_eol_s, failsafe ? controller_entry_print_failsafe_s : f_string_empty_s, is_entry ? controller_entry_s : controller_exit_s);
if (F_status_is_error(entry_action->status)) {
if (global->main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global->main->output.to, global->thread);
fl_print_format("%rThe %r item action '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
}
}
else {
- if ((entry_action->code & controller_entry_rule_code_require_d) && global->main->error.verbosity != f_console_verbosity_quiet_e || !(entry_action->code & controller_entry_rule_code_require_d) && (global->main->warning.verbosity == f_console_verbosity_verbose_e || global->main->warning.verbosity == f_console_verbosity_debug_e)) {
+ if ((entry_action->code & controller_entry_rule_code_require_d) && global->main->error.verbosity > f_console_verbosity_quiet_e || !(entry_action->code & controller_entry_rule_code_require_d) && (global->main->warning.verbosity == f_console_verbosity_verbose_e || global->main->warning.verbosity == f_console_verbosity_debug_e)) {
fl_print_t *output = 0;
if (entry_action->code & controller_entry_rule_code_require_d) {
}
else {
if (!failsafe && (global->main->error.verbosity == f_console_verbosity_verbose_e || entry->show == controller_entry_show_init_e) && global->main->parameters.array[controller_parameter_simulate_e].result == f_console_result_none_e) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e && global->main->error.verbosity != f_console_verbosity_error_e) {
+ if ((global->main->error.verbosity > f_console_verbosity_error_e)) {
fl_print_format("%rState is now '%[%r%]'.%r", global->main->output.to.stream, f_string_eol_s, global->main->context.set.notable, controller_ready_s, global->main->context.set.notable, f_string_eol_s);
}
}
if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == global->setting->failsafe_item_id) {
// This should not happen if the pre-process is working as intended, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global->main->error.to, global->thread);
fl_print_format("%r%[Invalid %r item index '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context);
}
if (F_status_is_error(status)) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global->main->error.to, global->thread);
controller_entry_print_error_cache(is_entry, global->main->error, cache->action);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_file_found_not) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global->main->error.to, global->thread);
fl_print_format("%r%[%QExecution failed, unable to find program or script '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix, global->main->error.context);
return F_status_set_error(F_execute);
}
else if (result != 0) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global->main->error.to, global->thread);
fl_print_format("%r%[%QExecution failed with return value of '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix, global->main->error.context);
if (entry_action->number == 0 || entry_action->number >= entry->items.used) {
// This should not happen if the pre-process is working as designed, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global->main->error.to, global->thread);
fl_print_format("%r%[%QInvalid %r item index '%]", global->main->error.to.stream, f_string_eol_s, global->main->error.context, global->main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context);
}
}
- if ((global->main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e && global->main->error.verbosity != f_console_verbosity_quiet_e) && global->main->error.verbosity != f_console_verbosity_error_e || global->main->error.verbosity == f_console_verbosity_verbose_e) {
+ if ((global->main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e && global->main->error.verbosity > f_console_verbosity_quiet_e) && global->main->error.verbosity != f_console_verbosity_error_e || global->main->error.verbosity == f_console_verbosity_verbose_e) {
controller_lock_print(global->main->output.to, global->thread);
fl_print_format("%rDone processing %r item '", global->main->output.to.stream, f_string_eol_s, is_entry ? controller_entry_s : controller_exit_s);
}
}
else {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fll_print_format("%r%[%QThe %r file is empty.%]%r", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : is_entry ? controller_entry_s : controller_exit_s, global.main->error.context, f_string_eol_s);
cache->action.name_item.used = 0;
if (!(code & 0x1)) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QThe required %r item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
break;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QThe required %r item '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
continue;
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(global.main->error.to.stream);
fl_print_format("%r%[%QThe %r setting '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
}
if (!type_rerun) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
}
}
else {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
item->reruns[type_rerun].is |= rerun_item == &item->reruns[type_rerun].failure ? controller_rule_rerun_is_failure_reset_d : controller_rule_rerun_is_success_reset_d;
}
else {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QRule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
}
}
else {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QUnknown value '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
}
if (F_status_is_error(status)) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
status = F_status_set_fine(status);
if (status != F_valid_not && status != F_number && status != F_number_decimal && status != F_number_overflow && status != F_number_underflow && status != F_number_negative) {
}
if (options & controller_process_option_simulate_d) {
- if (main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e) {
+ if (main->error.verbosity > f_console_verbosity_error_e) {
controller_lock_print(main->error.to, thread);
fl_print_format("%rSimulating execution of '%[", main->error.to.stream, f_string_eol_s, main->context.set.title);
if (multiple) {
if (type == controller_rule_action_type_group_e || type == controller_rule_action_type_pid_file_e || type == controller_rule_action_type_user_e) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QFSS Extended List is not allowed for the rule item action '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
break;
default:
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QUnsupported action type '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
}
}
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
controller_rule_item_print_error_rule_not_loaded(global.main->error, dynamics[i]->array[j]);
} // for
if (missing) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
if (process->rule.items.used) {
if (F_status_is_error(status)) {
f_thread_unlock(&global.thread->lock.process);
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
controller_rule_item_print_error_rule_not_loaded(global.main->error, alias_rule);
for (f_array_length_t i = 0; i < process->stack.used && controller_thread_is_enabled_process(process, global.thread); ++i) {
if (process->stack.array[i] == id_rule) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QThe rule '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
status = F_status_set_error(F_found_not);
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
controller_rule_item_print_error_rule_not_loaded(global.main->error, process->rule.alias);
for (j = 0; j < rule->limits.used; ++j) {
if (type == rule->limits.array[j].type) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
// Get the current line number within the settings item.
cache->action.line_item = line_item;
status = controller_validate_has_graph(*setting_value);
if (status == F_false || F_status_set_fine(status) == F_complete_not_utf) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
// Get the current line number within the settings item.
cache->action.line_item = line_item;
}
if (status == F_false) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QRule setting has an invalid name '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
status = F_status_set_fine(status);
if ((zero_only && number) || (!zero_only && (number < 1 || number > 99)) || status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_negative || status == F_number_positive) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
// Get the current line number within the settings item.
cache->action.line_item = line_item;
timeout_code = controller_rule_timeout_code_stop_d;
}
else {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
// Get the current line number within the settings item.
cache->action.line_item = line_item;
status = F_status_set_fine(status);
if (number < -20 || number > 19 || status == F_data_not || status == F_number || status == F_number_overflow || status == F_number_underflow || status == F_number_decimal) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
// Get the current line number within the settings item.
cache->action.line_item = line_item;
cache->action.line_action = ++cache->action.line_item;
if (status == F_false) {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(global.main->error.to, global.thread);
fl_print_format("%r%[%QRule setting has an invalid environment variable name '%]", global.main->error.to.stream, f_string_eol_s, global.main->error.context, global.main->error.prefix, global.main->error.context);
action = controller_rule_action_type_thaw_e;
}
else {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
// Get the current line number within the settings item.
cache->action.line_item = line_item;
setting_values = &rule->ons.array[j].wish;
}
else {
- if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global.main->error.verbosity > f_console_verbosity_quiet_e) {
// Get the current line number within the settings item.
cache->action.line_item = line_item;
break;
default:
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, global.thread);
fl_print_format("%r%[%QUnsupported action type '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
status = controller_lock_create(&thread.lock);
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_error_print(main->error, status, "controller_lock_create", F_true);
}
}
if (F_status_is_error(status)) {
thread.id_signal = 0;
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error(&thread, main->error, F_status_set_fine(status), "f_thread_create", F_true);
}
}
setting->ready = controller_setting_ready_done_e;
if (f_file_exists(setting->path_pid, F_true) == F_true) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, &thread);
fl_print_format("%r%[%QThe pid file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
status = f_thread_create(0, &thread.id_entry, &controller_thread_entry, (void *) &entry);
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error(&thread, main->error, F_status_set_fine(status), "f_thread_create", F_true);
}
}
if (F_status_is_error(status)) {
thread.id_cleanup = 0;
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error(&thread, main->error, F_status_set_fine(status), "f_thread_create", F_true);
}
}
if (main->parameters.array[controller_parameter_validate_e].result == f_console_result_none_e || main->parameters.array[controller_parameter_simulate_e].result == f_console_result_found_e) {
if (entry->setting->entry.pid == controller_entry_pid_require_e && f_file_exists(entry->setting->path_pid, F_true) == F_true) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, entry->global->thread);
fl_print_format("%r%[%QThe pid file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
const f_status_t status_failsafe = controller_entry_process(entry->global, cache, F_true, F_true);
if (F_status_is_error(status_failsafe)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, entry->global->thread);
fl_print_format("%r%[%QFailed while processing requested failsafe item '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
const f_status_t status_failsafe = controller_entry_process(entry->global, cache, F_true, F_false);
if (F_status_is_error(status_failsafe)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->error.to, entry->global->thread);
fl_print_format("%r%[%QFailed while processing requested failsafe item '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
f_status_t status = f_thread_create(0, &global->thread->id_entry, &controller_thread_exit, (void *) &entry);
if (F_status_is_error(status)) {
- if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (global->main->error.verbosity > f_console_verbosity_quiet_e) {
controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_thread_create", F_true);
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fake_parameter_from_bytesequence_e, fake_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fake_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fake_parameter_from_bytesequence_e) {
- if (setting->mode & fake_mode_from_codepoint_e) {
- setting->mode -= fake_mode_from_codepoint_e;
- }
-
- setting->mode |= fake_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fake_parameter_from_codepoint_e) {
- if (setting->mode & fake_mode_from_bytesequence_e) {
- setting->mode -= fake_mode_from_bytesequence_e;
- }
-
- setting->mode |= fake_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fake_parameter_to_bytesequence_e, fake_parameter_to_codepoint_e, fake_parameter_to_combining_e, fake_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fake_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fake_parameter_to_bytesequence_e) {
- if (setting->mode & fake_mode_to_codepoint_e) {
- setting->mode -= fake_mode_to_codepoint_e;
- }
-
- if (setting->mode & fake_mode_to_combining_e) {
- setting->mode -= fake_mode_to_combining_e;
- }
-
- if (setting->mode & fake_mode_to_width_e) {
- setting->mode -= fake_mode_to_width_e;
- }
-
- setting->mode |= fake_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fake_parameter_to_codepoint_e) {
- if (setting->mode & fake_mode_to_bytesequence_e) {
- setting->mode -= fake_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fake_mode_to_combining_e) {
- setting->mode -= fake_mode_to_combining_e;
- }
-
- if (setting->mode & fake_mode_to_width_e) {
- setting->mode -= fake_mode_to_width_e;
- }
-
- setting->mode |= fake_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fake_parameter_to_combining_e) {
- if (setting->mode & fake_mode_to_bytesequence_e) {
- setting->mode -= fake_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fake_mode_to_codepoint_e) {
- setting->mode -= fake_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fake_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fake_mode_to_width_e;
- }
-
- setting->mode |= fake_mode_to_combining_e;
- }
- else if (choices.array[choice] == fake_parameter_to_width_e) {
- if (setting->mode & fake_mode_to_bytesequence_e) {
- setting->mode -= fake_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fake_mode_to_codepoint_e) {
- setting->mode -= fake_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fake_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fake_mode_to_combining_e;
- }
-
- setting->mode |= fake_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fake_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fake_parameter_to_file_e].values.used > 1) {
- fake_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fake_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fake_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fake_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fake_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fake_main_flag_file_to_e;
- }
- else {
- fake_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fake_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fake_parameter_to_file_e].result == f_console_result_found_e) {
- fake_print_error_no_value(main, setting, fake_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fake_main_flag_file_to_e) {
- setting->flag -= fake_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fake_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fake_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fake_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fake_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fake_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fake_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fake_main_flag_file_from_e;
- }
- else if (main->parameters.array[fake_parameter_from_file_e].result == f_console_result_found_e) {
- fake_print_error_no_value(main, setting, fake_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fake_main_flag_file_from_e) {
- setting->flag -= fake_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fake_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fake_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fake_mode_to_bytesequence_e)) {
- if (main->parameters.array[fake_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fake_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fake_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fake_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fake_main_flag_header_e;
- }
-
- if (main->parameters.array[fake_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fake_main_flag_separate_e;
- }
-
if (main->parameters.array[fake_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fake_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fake_setting_load_
if (!(main->pipe & fll_program_data_pipe_input_e) && main->parameters.remaining.used) {
status = F_status_set_error(F_parameter);
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QYou failed to specify a valid operation.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
}
if (main->parameters.array[fake_parameter_operation_build_e].locations.used && main->parameters.array[fake_parameter_operation_make_e].locations.used) {
status = F_status_set_error(F_parameter);
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%]", main->error.to.stream, main->error.notable, fake_other_operation_build_s, main->error.notable);
fl_print_format("%[%r%]", main->error.to.stream, main->error.notable, fake_other_operation_make_s, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe operation '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%]", main->error.to.stream, main->error.notable, operations_name, main->error.notable);
fl_print_format("%[' failed.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
- if (main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e) {
+ if (main->error.verbosity > f_console_verbosity_error_e) {
if (F_status_is_error_not(status) && status != F_child) {
fll_print_format("%rAll operations complete.%r%r", main->output.to.stream, f_string_eol_s, f_string_eol_s, f_string_eol_s);
}
}
}
- if (F_status_is_error(status) && main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (F_status_is_error(status) && main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
if (environment->used + data_build->setting.environment.used > environment->size) {
if (environment->used + data_build->setting.environment.used > f_environment_max_length) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe values for the setting '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
} // for
if (found == F_false) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe specified mode '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
if (F_status_is_error(*status)) {
if (*status == F_status_set_error(F_string_too_large)) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
funlockfile(data->main->error.to.stream);
fl_print_format("%r%[%QA setting in the file '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
setting->search_shared = F_false;
}
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe parameters '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
if (setting->build_language == fake_build_language_type_c_e || setting->build_language == fake_build_language_type_cpp_e) {
if (setting->build_shared == F_false && setting->build_static == F_false) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe build settings '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
*status = f_directory_exists(destination_path);
if (*status == F_false) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe path '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
break;
}
- else if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ else if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
fake_print_error_build_operation_file(data, F_status_set_fine(*status), "fl_directory_copy", fake_common_file_directory_copy_s, f_file_operation_to_s, path_source, destination_directory, F_true);
}
else if (*status != F_child) {
if (F_status_is_error(*status)) {
if (F_status_set_fine(*status) == F_failure) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to execute script: '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
return_code = 1;
if (F_status_set_fine(*status) == F_file_found_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to find program '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
status = f_utf_is_word_dash_plus(data->main->parameters.arguments.array[index].string + j, width_max, F_false);
if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (status == F_false) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
if (F_status_is_error(status)) {
if (status == F_status_set_error(F_string_too_large)) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (!data->main->parameters.arguments.array[index].used || status == F_data_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
status = f_path_directory_cleanup(data->main->parameters.arguments.array[index], parameters_value[i]);
if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "f_path_directory_cleanup", F_false) == F_known_not && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, F_status_set_fine(status), "f_path_directory_cleanup", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to process parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
status = f_string_dynamic_append(parameter_defaults[i], parameters_value[i]);
if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), " f_string_dynamic_append", F_false) == F_known_not && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, F_status_set_fine(status), " f_string_dynamic_append", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to load default for the parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[fake_parameter_define_e].values, &data->define);
if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
status = fll_program_parameter_additional_rip(data->main->parameters.arguments.array, data->main->parameters.array[fake_parameter_mode_e].values, &data->mode);
if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
status = f_utf_is_word_dash_plus(data->mode.array[i].string + j, width_max, F_false);
if (F_status_is_error(status)) {
- if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to process the parameter '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (status == F_false) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (missing_main) {
- if (data_make->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data_make->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data_make->main->error.to.stream);
fl_print_format("%r%[%QThe fakefile '%]", data_make->main->error.to.stream, f_string_eol_s, data_make->main->error.context, data_make->main->error.prefix, data_make->main->error.context);
}
}
else {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QInvalid characters in the define setting name '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
if (F_status_set_error(*status) == F_interrupt) return 0;
if (i == section->objects.used && F_status_is_error_not(*status) && (state_process.operation == fake_make_operation_type_and_e || state_process.operation == fake_make_operation_type_else_e || state_process.operation == fake_make_operation_type_if_e || state_process.operation == fake_make_operation_type_or_e)) {
- if (data_make->data->main->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) {
+ if (data_make->data->main->error.verbosity > f_console_verbosity_quiet_e && data_make->error.to.stream) {
flockfile(data_make->error.to.stream);
fl_print_format("%r%[%QIncomplete '%]", data_make->error.to.stream, f_string_eol_s, data_make->error.context, data_make->error.prefix, data_make->error.context);
if (F_status_is_error(status)) {
state_process->condition_result = fake_condition_result_error_e;
- if (data_make->main->error.verbosity != f_console_verbosity_quiet_e && data_make->error.to.stream) {
+ if (data_make->main->error.verbosity > f_console_verbosity_quiet_e && data_make->error.to.stream) {
flockfile(data_make->error.to.stream);
if ((i == 1 && number_left > F_number_t_size_unsigned_d) || (i > 1 && number_right > F_number_t_size_unsigned_d)) {
}
if (status == F_exist_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe group name '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (number > F_type_size_32_unsigned_d) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe number '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
const f_status_t status = f_file_mode_from_string(buffer, data->main->umask, mode, replace);
if (F_status_is_error(status)) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_syntax) {
flockfile(data->main->error.to.stream);
}
if (status == F_exist_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe user '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (number > F_type_size_32_unsigned_d) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe number '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
bool fake_print_error_build_operation_file(fake_data_t * const data, const f_status_t status, const char *function, const f_string_static_t operation, const f_string_static_t source, const f_string_static_t destination, const f_string_static_t how, const bool fallback) {
if (status == F_file_found_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to find '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (status == F_parameter) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QInvalid parameter when calling '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (status == F_name) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QInvalid name for '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (status == F_memory_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QUnable to allocate memory, while trying to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
}
if (status == F_number_overflow) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QOverflow while trying to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
}
if (status == F_directory) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QInvalid directory while trying to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
}
if (status == F_access_denied) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QAccess denied while trying to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
}
if (status == F_loop) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QLoop while trying to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
}
if (status == F_prohibited) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QProhibited by system while trying to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
}
if (status == F_directory_found_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
}
if (status == F_failure) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QFailed to %Q '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, operation, data->main->error.context);
return F_false;
}
- if (fll_error_print(data->main->error, status, function, F_false) == F_known_not && fallback && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, status, function, F_false) == F_known_not && fallback && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[UNKNOWN %Q(%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
bool fake_print_error_fss(fake_data_t * const data, const f_status_t status, const char *function, const f_string_static_t path_file, const f_string_range_t range, const bool fallback) {
if (status == F_file_found_not) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QOccurred on invalid UTF-8 character at stop position (at '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QOccurred on invalid UTF-8 character at %s (at '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, status == F_complete_not_utf_eos ? "end of string" : "stop point of string", data->main->error.context);
}
if (status == F_complete_not_utf_stop) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QOccurred on invalid UTF-8 character at stop point of string (at '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
return F_false;
}
- if (fll_error_print(data->main->error, status, function, F_false) == F_known_not && fallback && data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (fll_error_print(data->main->error, status, function, F_false) == F_known_not && fallback && data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[UNKNOWN %Q(%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
}
if (status == F_false) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
flockfile(data->main->error.to.stream);
fl_print_format("%r%[%QThe path '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { firewall_parameter_from_bytesequence_e, firewall_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- firewall_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == firewall_parameter_from_bytesequence_e) {
- if (setting->mode & firewall_mode_from_codepoint_e) {
- setting->mode -= firewall_mode_from_codepoint_e;
- }
-
- setting->mode |= firewall_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == firewall_parameter_from_codepoint_e) {
- if (setting->mode & firewall_mode_from_bytesequence_e) {
- setting->mode -= firewall_mode_from_bytesequence_e;
- }
-
- setting->mode |= firewall_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { firewall_parameter_to_bytesequence_e, firewall_parameter_to_codepoint_e, firewall_parameter_to_combining_e, firewall_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- firewall_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == firewall_parameter_to_bytesequence_e) {
- if (setting->mode & firewall_mode_to_codepoint_e) {
- setting->mode -= firewall_mode_to_codepoint_e;
- }
-
- if (setting->mode & firewall_mode_to_combining_e) {
- setting->mode -= firewall_mode_to_combining_e;
- }
-
- if (setting->mode & firewall_mode_to_width_e) {
- setting->mode -= firewall_mode_to_width_e;
- }
-
- setting->mode |= firewall_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == firewall_parameter_to_codepoint_e) {
- if (setting->mode & firewall_mode_to_bytesequence_e) {
- setting->mode -= firewall_mode_to_bytesequence_e;
- }
-
- if (setting->mode & firewall_mode_to_combining_e) {
- setting->mode -= firewall_mode_to_combining_e;
- }
-
- if (setting->mode & firewall_mode_to_width_e) {
- setting->mode -= firewall_mode_to_width_e;
- }
-
- setting->mode |= firewall_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == firewall_parameter_to_combining_e) {
- if (setting->mode & firewall_mode_to_bytesequence_e) {
- setting->mode -= firewall_mode_to_bytesequence_e;
- }
-
- if (setting->mode & firewall_mode_to_codepoint_e) {
- setting->mode -= firewall_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[firewall_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= firewall_mode_to_width_e;
- }
-
- setting->mode |= firewall_mode_to_combining_e;
- }
- else if (choices.array[choice] == firewall_parameter_to_width_e) {
- if (setting->mode & firewall_mode_to_bytesequence_e) {
- setting->mode -= firewall_mode_to_bytesequence_e;
- }
-
- if (setting->mode & firewall_mode_to_codepoint_e) {
- setting->mode -= firewall_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[firewall_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= firewall_mode_to_combining_e;
- }
-
- setting->mode |= firewall_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[firewall_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[firewall_parameter_to_file_e].values.used > 1) {
- firewall_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[firewall_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[firewall_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[firewall_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[firewall_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= firewall_main_flag_file_to_e;
- }
- else {
- firewall_print_error_parameter_file_name_empty(main, setting, main->parameters.array[firewall_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[firewall_parameter_to_file_e].result == f_console_result_found_e) {
- firewall_print_error_no_value(main, setting, firewall_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & firewall_main_flag_file_to_e) {
- setting->flag -= firewall_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[firewall_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[firewall_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[firewall_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[firewall_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- firewall_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- firewall_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= firewall_main_flag_file_from_e;
- }
- else if (main->parameters.array[firewall_parameter_from_file_e].result == f_console_result_found_e) {
- firewall_print_error_no_value(main, setting, firewall_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & firewall_main_flag_file_from_e) {
- setting->flag -= firewall_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[firewall_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- firewall_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & firewall_mode_to_bytesequence_e)) {
- if (main->parameters.array[firewall_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[firewall_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = firewall_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[firewall_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= firewall_main_flag_header_e;
- }
-
- if (main->parameters.array[firewall_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= firewall_main_flag_separate_e;
- }
-
if (main->parameters.array[firewall_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= firewall_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_firewall_setting_load_
if (show_nat) {
fll_print_format("%[===========================%] %[NAT%] %[============================%]%r", main->output.to.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);
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
status = fll_execute_program(firewall_tool_iptables_s, parameters, 0, 0, (void *) &return_code);
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
if (F_status_is_error_not(status) && show_mangle) {
fll_print_format("%[==========================%] %[MANGLE%] %[==========================%]%r", main->output.to.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);
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
parameters_array[3] = firewall_show_mangle_s;
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
if (F_status_is_error_not(status) && show_ports) {
fll_print_format("%[==========================%] %[FILTER%] %[==========================%]%r", main->output.to.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);
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
parameters_array[0] = firewall_show_parameter_exact_s;
parameters_array[1] = firewall_show_parameter_verbose_s;
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
if (F_status_is_error(status)) {
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (status == F_memory_not) {
firewall_print_error_on_allocation_failure(main->error);
}
return status;
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QFailed to perform lock request because the lock instructions are missing from: %r.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file_other, main->error.context, f_string_eol_s);
}
}
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QFailed to perform stop request because the lock instructions are missing from: %r.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, path_file_other, main->error.context, f_string_eol_s);
}
firewall_delete_local_data(&local);
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QNo command given.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
status = F_status_set_error(F_parameter);
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_parameter) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
firewall_print_error_on_invalid_parameter(data->main->error, "f_file_open");
}
}
status = F_none;
}
else if (F_status_set_fine(status) == F_file_open) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QUnable to open the file '%Q'.%]%r", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, path_file, data->main->error.context, f_string_eol_s);
}
}
else if (F_status_set_fine(status) == F_file_descriptor) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QFile descriptor error while trying to open the file '%Q'.%]%r", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, path_file, data->main->error.context, f_string_eol_s);
}
}
f_file_stream_close(&file);
if (F_status_is_error(status)) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_parameter) {
firewall_print_error_on_invalid_parameter(data->main->error, "f_file_read");
}
f_status_t status = f_file_open(filename, 0, &file);
if (F_status_is_error(status)) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
if (optional) {
if (F_status_set_fine(status) == F_parameter) {
firewall_print_error_on_invalid_parameter(data->main->error, "f_file_open");
f_file_stream_close(&file);
if (F_status_is_error(status)) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_parameter) {
firewall_print_error_on_invalid_parameter(data->main->error, "f_file_read");
}
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (data->main->error.verbosity > f_console_verbosity_quiet_e) {
if (status == F_parameter) {
firewall_print_error_on_invalid_parameter_for_file(data->main->error, "fll_fss_basic_list_read", filename);
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_basic_list_read_parameter_from_bytesequence_e, fss_basic_list_read_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_list_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_list_read_parameter_from_bytesequence_e) {
- if (setting->mode & fss_basic_list_read_mode_from_codepoint_e) {
- setting->mode -= fss_basic_list_read_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_basic_list_read_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_list_read_parameter_from_codepoint_e) {
- if (setting->mode & fss_basic_list_read_mode_from_bytesequence_e) {
- setting->mode -= fss_basic_list_read_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_basic_list_read_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_basic_list_read_parameter_to_bytesequence_e, fss_basic_list_read_parameter_to_codepoint_e, fss_basic_list_read_parameter_to_combining_e, fss_basic_list_read_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_list_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_list_read_parameter_to_bytesequence_e) {
- if (setting->mode & fss_basic_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_basic_list_read_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_basic_list_read_mode_to_combining_e) {
- setting->mode -= fss_basic_list_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_list_read_mode_to_width_e) {
- setting->mode -= fss_basic_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_list_read_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_list_read_parameter_to_codepoint_e) {
- if (setting->mode & fss_basic_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_list_read_mode_to_combining_e) {
- setting->mode -= fss_basic_list_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_list_read_mode_to_width_e) {
- setting->mode -= fss_basic_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_list_read_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_basic_list_read_parameter_to_combining_e) {
- if (setting->mode & fss_basic_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_basic_list_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_list_read_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_list_read_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_basic_list_read_parameter_to_width_e) {
- if (setting->mode & fss_basic_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_basic_list_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_list_read_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_list_read_mode_to_combining_e;
- }
-
- setting->mode |= fss_basic_list_read_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_basic_list_read_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_basic_list_read_parameter_to_file_e].values.used > 1) {
- fss_basic_list_read_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_basic_list_read_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_basic_list_read_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_basic_list_read_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_basic_list_read_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_basic_list_read_main_flag_file_to_e;
- }
- else {
- fss_basic_list_read_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_basic_list_read_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_basic_list_read_parameter_to_file_e].result == f_console_result_found_e) {
- fss_basic_list_read_print_error_no_value(main, setting, fss_basic_list_read_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_basic_list_read_main_flag_file_to_e) {
- setting->flag -= fss_basic_list_read_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_basic_list_read_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_basic_list_read_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_basic_list_read_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_basic_list_read_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_basic_list_read_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_basic_list_read_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_basic_list_read_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_basic_list_read_parameter_from_file_e].result == f_console_result_found_e) {
- fss_basic_list_read_print_error_no_value(main, setting, fss_basic_list_read_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_basic_list_read_main_flag_file_from_e) {
- setting->flag -= fss_basic_list_read_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_basic_list_read_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_basic_list_read_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_basic_list_read_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_basic_list_read_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_basic_list_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_basic_list_read_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_basic_list_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_list_read_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_basic_list_read_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_list_read_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_basic_list_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_basic_list_read_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_basic_list_read_setting_load_
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters.array[parameter_code[i]].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", 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.%]%r", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_basic_list_read_long_columns_s, parameter_name[i]);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_basic_list_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_basic_list_read_parameter_line_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_line_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, fss_basic_list_read_long_line_s);
}
status = F_status_set_error(F_parameter);
length = data.argv[index].used;
if (!length) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, main->error.notable);
fl_print_format("%[' must not be empty.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_list_read_parameter_select_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, main->error.notable);
fl_print_format("%[' parameter requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = F_status_set_error(F_parameter);
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
if (data->depths.array[i].depth == data->depths.array[j].depth) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value '%]", main->error.to.stream, f_string_eol_s, 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("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
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_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, main->error.notable);
fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
return F_status_set_error(F_parameter);
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_basic_list_write_parameter_from_bytesequence_e, fss_basic_list_write_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_list_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_list_write_parameter_from_bytesequence_e) {
- if (setting->mode & fss_basic_list_write_mode_from_codepoint_e) {
- setting->mode -= fss_basic_list_write_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_basic_list_write_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_list_write_parameter_from_codepoint_e) {
- if (setting->mode & fss_basic_list_write_mode_from_bytesequence_e) {
- setting->mode -= fss_basic_list_write_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_basic_list_write_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_basic_list_write_parameter_to_bytesequence_e, fss_basic_list_write_parameter_to_codepoint_e, fss_basic_list_write_parameter_to_combining_e, fss_basic_list_write_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_list_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_list_write_parameter_to_bytesequence_e) {
- if (setting->mode & fss_basic_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_basic_list_write_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_basic_list_write_mode_to_combining_e) {
- setting->mode -= fss_basic_list_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_list_write_mode_to_width_e) {
- setting->mode -= fss_basic_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_list_write_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_list_write_parameter_to_codepoint_e) {
- if (setting->mode & fss_basic_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_list_write_mode_to_combining_e) {
- setting->mode -= fss_basic_list_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_list_write_mode_to_width_e) {
- setting->mode -= fss_basic_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_list_write_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_basic_list_write_parameter_to_combining_e) {
- if (setting->mode & fss_basic_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_basic_list_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_list_write_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_list_write_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_basic_list_write_parameter_to_width_e) {
- if (setting->mode & fss_basic_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_basic_list_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_list_write_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_list_write_mode_to_combining_e;
- }
-
- setting->mode |= fss_basic_list_write_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_basic_list_write_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_basic_list_write_parameter_to_file_e].values.used > 1) {
- fss_basic_list_write_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_basic_list_write_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_basic_list_write_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_basic_list_write_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_basic_list_write_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_basic_list_write_main_flag_file_to_e;
- }
- else {
- fss_basic_list_write_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_basic_list_write_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_basic_list_write_parameter_to_file_e].result == f_console_result_found_e) {
- fss_basic_list_write_print_error_no_value(main, setting, fss_basic_list_write_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_basic_list_write_main_flag_file_to_e) {
- setting->flag -= fss_basic_list_write_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_basic_list_write_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_basic_list_write_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_basic_list_write_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_basic_list_write_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_basic_list_write_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_basic_list_write_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_basic_list_write_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_basic_list_write_parameter_from_file_e].result == f_console_result_found_e) {
- fss_basic_list_write_print_error_no_value(main, setting, fss_basic_list_write_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_basic_list_write_main_flag_file_from_e) {
- setting->flag -= fss_basic_list_write_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_basic_list_write_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_basic_list_write_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_basic_list_write_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_basic_list_write_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_basic_list_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_basic_list_write_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_basic_list_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_list_write_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_basic_list_write_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_list_write_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_basic_list_write_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_basic_list_write_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_basic_list_write_setting_load_
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_basic_list_write_parameter_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[fss_basic_list_write_parameter_file_e].values.used > 1) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_file_s, main->error.notable);
fl_print_format("%[' may only be specified once.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_basic_list_write_parameter_content_e].locations.used && main->parameters.array[fss_basic_list_write_parameter_partial_e].locations.used) {
if (main->parameters.array[fss_basic_list_write_parameter_content_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter, but not both.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
location_sub_content = main->parameters.array[fss_basic_list_write_parameter_content_e].locations_sub.array[i];
if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
}
else if (!(main->pipe & fll_program_data_pipe_input_e)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[fss_basic_list_write_parameter_partial_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter cannot be used when processing a pipe.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_basic_list_write_parameter_prepend_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error(status)) break;
if (status == F_false) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must only contain white space.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
} // for
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must not be an empty string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_basic_list_write_parameter_ignore_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, main->error.notable);
fl_print_format("%[' was specified, but no values were given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
const f_array_length_t total_arguments = main->parameters.array[fss_basic_list_write_parameter_ignore_e].values.used;
if (total_locations * 2 > total_arguments) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_ignore_s, main->error.notable);
fl_print_format("%[' requires two values.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = fss_basic_list_write_process_pipe(main, output, quoted, &buffer);
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
- else if (main->error.verbosity != f_console_verbosity_quiet_e && main->parameters.array[fss_basic_list_write_parameter_file_e].result == f_console_result_none_e) {
+ else if (main->error.verbosity > f_console_verbosity_quiet_e && main->parameters.array[fss_basic_list_write_parameter_file_e].result == f_console_result_none_e) {
// Ensure there is always a newline at the end, unless in quiet mode.
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_basic_list_write_error_parameter_same_times_print_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe FSS-0002 (Basic List) standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[U+000A%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[) in objects.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_basic_list_write_error_parameter_unsupported_eol_print_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_basic_list_write_error_parameter_value_missing_print_
for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s.string[0]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QThe FSS-0002 (Basic List) standard only supports one content per object.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_basic_read_parameter_from_bytesequence_e, fss_basic_read_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_read_parameter_from_bytesequence_e) {
- if (setting->mode & fss_basic_read_mode_from_codepoint_e) {
- setting->mode -= fss_basic_read_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_basic_read_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_read_parameter_from_codepoint_e) {
- if (setting->mode & fss_basic_read_mode_from_bytesequence_e) {
- setting->mode -= fss_basic_read_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_basic_read_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_basic_read_parameter_to_bytesequence_e, fss_basic_read_parameter_to_codepoint_e, fss_basic_read_parameter_to_combining_e, fss_basic_read_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_read_parameter_to_bytesequence_e) {
- if (setting->mode & fss_basic_read_mode_to_codepoint_e) {
- setting->mode -= fss_basic_read_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_basic_read_mode_to_combining_e) {
- setting->mode -= fss_basic_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_read_mode_to_width_e) {
- setting->mode -= fss_basic_read_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_read_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_read_parameter_to_codepoint_e) {
- if (setting->mode & fss_basic_read_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_read_mode_to_combining_e) {
- setting->mode -= fss_basic_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_read_mode_to_width_e) {
- setting->mode -= fss_basic_read_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_read_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_basic_read_parameter_to_combining_e) {
- if (setting->mode & fss_basic_read_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_read_mode_to_codepoint_e) {
- setting->mode -= fss_basic_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_read_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_read_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_read_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_basic_read_parameter_to_width_e) {
- if (setting->mode & fss_basic_read_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_read_mode_to_codepoint_e) {
- setting->mode -= fss_basic_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_read_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_read_mode_to_combining_e;
- }
-
- setting->mode |= fss_basic_read_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_basic_read_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_basic_read_parameter_to_file_e].values.used > 1) {
- fss_basic_read_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_basic_read_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_basic_read_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_basic_read_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_basic_read_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_basic_read_main_flag_file_to_e;
- }
- else {
- fss_basic_read_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_basic_read_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_basic_read_parameter_to_file_e].result == f_console_result_found_e) {
- fss_basic_read_print_error_no_value(main, setting, fss_basic_read_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_basic_read_main_flag_file_to_e) {
- setting->flag -= fss_basic_read_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_basic_read_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_basic_read_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_basic_read_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_basic_read_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_basic_read_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_basic_read_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_basic_read_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_basic_read_parameter_from_file_e].result == f_console_result_found_e) {
- fss_basic_read_print_error_no_value(main, setting, fss_basic_read_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_basic_read_main_flag_file_from_e) {
- setting->flag -= fss_basic_read_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_basic_read_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_basic_read_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_basic_read_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_basic_read_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_basic_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_basic_read_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_basic_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_read_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_basic_read_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_read_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_basic_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_basic_read_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_basic_read_setting_load_
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters.array[parameter_code[i]].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", 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.%]%r", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_basic_read_long_columns_s, parameter_name[i]);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_basic_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_basic_read_long_pipe_s, fss_basic_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, fss_basic_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_basic_read_parameter_line_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_basic_read_long_pipe_s, fss_basic_read_long_line_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_basic_read_long_pipe_s, fss_basic_read_long_line_s);
}
status = F_status_set_error(F_parameter);
length = data.argv[index].used;
if (!length) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_delimit_s, main->error.notable);
fl_print_format("%[' must not be empty.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_read_parameter_select_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_select_s, main->error.notable);
fl_print_format("%[' parameter requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
fss_basic_read_depths_resize(0, &data.depths);
status = F_status_set_error(F_parameter);
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
if (data->depths.array[i].depth == data->depths.array[j].depth) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value '%]", main->error.to.stream, f_string_eol_s, 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("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
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_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_read_long_depth_s, main->error.notable);
fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
return F_status_set_error(F_parameter);
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_basic_write_parameter_from_bytesequence_e, fss_basic_write_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_write_parameter_from_bytesequence_e) {
- if (setting->mode & fss_basic_write_mode_from_codepoint_e) {
- setting->mode -= fss_basic_write_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_basic_write_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_write_parameter_from_codepoint_e) {
- if (setting->mode & fss_basic_write_mode_from_bytesequence_e) {
- setting->mode -= fss_basic_write_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_basic_write_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_basic_write_parameter_to_bytesequence_e, fss_basic_write_parameter_to_codepoint_e, fss_basic_write_parameter_to_combining_e, fss_basic_write_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_basic_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_basic_write_parameter_to_bytesequence_e) {
- if (setting->mode & fss_basic_write_mode_to_codepoint_e) {
- setting->mode -= fss_basic_write_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_basic_write_mode_to_combining_e) {
- setting->mode -= fss_basic_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_write_mode_to_width_e) {
- setting->mode -= fss_basic_write_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_write_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_basic_write_parameter_to_codepoint_e) {
- if (setting->mode & fss_basic_write_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_write_mode_to_combining_e) {
- setting->mode -= fss_basic_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_basic_write_mode_to_width_e) {
- setting->mode -= fss_basic_write_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_write_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_basic_write_parameter_to_combining_e) {
- if (setting->mode & fss_basic_write_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_write_mode_to_codepoint_e) {
- setting->mode -= fss_basic_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_write_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_write_mode_to_width_e;
- }
-
- setting->mode |= fss_basic_write_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_basic_write_parameter_to_width_e) {
- if (setting->mode & fss_basic_write_mode_to_bytesequence_e) {
- setting->mode -= fss_basic_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_basic_write_mode_to_codepoint_e) {
- setting->mode -= fss_basic_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_basic_write_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_basic_write_mode_to_combining_e;
- }
-
- setting->mode |= fss_basic_write_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_basic_write_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_basic_write_parameter_to_file_e].values.used > 1) {
- fss_basic_write_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_basic_write_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_basic_write_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_basic_write_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_basic_write_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_basic_write_main_flag_file_to_e;
- }
- else {
- fss_basic_write_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_basic_write_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_basic_write_parameter_to_file_e].result == f_console_result_found_e) {
- fss_basic_write_print_error_no_value(main, setting, fss_basic_write_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_basic_write_main_flag_file_to_e) {
- setting->flag -= fss_basic_write_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_basic_write_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_basic_write_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_basic_write_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_basic_write_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_basic_write_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_basic_write_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_basic_write_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_basic_write_parameter_from_file_e].result == f_console_result_found_e) {
- fss_basic_write_print_error_no_value(main, setting, fss_basic_write_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_basic_write_main_flag_file_from_e) {
- setting->flag -= fss_basic_write_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_basic_write_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_basic_write_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_basic_write_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_basic_write_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_basic_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_basic_write_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_basic_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_write_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_basic_write_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_basic_write_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_basic_write_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_basic_write_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_basic_write_setting_load_
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_basic_write_parameter_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[fss_basic_write_parameter_file_e].values.used > 1) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_file_s, main->error.notable);
fl_print_format("%[' may only be specified once.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_basic_write_parameter_content_e].locations.used && main->parameters.array[fss_basic_write_parameter_partial_e].locations.used) {
if (main->parameters.array[fss_basic_write_parameter_content_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter, but not both.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
location_sub_content = main->parameters.array[fss_basic_write_parameter_content_e].locations_sub.array[i];
if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
}
else if (!(main->pipe & fll_program_data_pipe_input_e)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[fss_basic_write_parameter_partial_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter cannot be used when processing a pipe.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_basic_write_parameter_prepend_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error(status)) break;
if (status == F_false) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must only contain white space.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
} // for
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must not be an empty string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_basic_write_parameter_ignore_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, main->error.notable);
fl_print_format("%[' was specified, but no values were given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
const f_array_length_t total_arguments = main->parameters.array[fss_basic_write_parameter_ignore_e].values.used;
if (total_locations * 2 > total_arguments) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_ignore_s, main->error.notable);
fl_print_format("%[' requires two values.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = fss_basic_write_process_pipe(main, output, quote, &buffer);
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
- else if (main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_basic_write_parameter_file_e].result == f_console_result_none_e) {
+ else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_basic_write_parameter_file_e].result == f_console_result_none_e) {
// Ensure there is always a newline at the end, unless in quiet mode.
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_basic_write_error_parameter_same_times_print_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_basic_write_error_parameter_value_missing_print_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe FSS-0000 (Basic) standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[U+000A%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[) in objects.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_basic_write_error_parameter_unsupported_eol_print_
for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_basic_write_pipe_content_start_s.string[0]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QThe FSS-0000 (Basic) standard only supports one content per object.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_embedded_list_read_parameter_from_bytesequence_e, fss_embedded_list_read_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_embedded_list_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_embedded_list_read_parameter_from_bytesequence_e) {
- if (setting->mode & fss_embedded_list_read_mode_from_codepoint_e) {
- setting->mode -= fss_embedded_list_read_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_embedded_list_read_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_embedded_list_read_parameter_from_codepoint_e) {
- if (setting->mode & fss_embedded_list_read_mode_from_bytesequence_e) {
- setting->mode -= fss_embedded_list_read_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_embedded_list_read_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_embedded_list_read_parameter_to_bytesequence_e, fss_embedded_list_read_parameter_to_codepoint_e, fss_embedded_list_read_parameter_to_combining_e, fss_embedded_list_read_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_embedded_list_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_embedded_list_read_parameter_to_bytesequence_e) {
- if (setting->mode & fss_embedded_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_embedded_list_read_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_embedded_list_read_mode_to_combining_e) {
- setting->mode -= fss_embedded_list_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_embedded_list_read_mode_to_width_e) {
- setting->mode -= fss_embedded_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_embedded_list_read_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_embedded_list_read_parameter_to_codepoint_e) {
- if (setting->mode & fss_embedded_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_embedded_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_embedded_list_read_mode_to_combining_e) {
- setting->mode -= fss_embedded_list_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_embedded_list_read_mode_to_width_e) {
- setting->mode -= fss_embedded_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_embedded_list_read_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_embedded_list_read_parameter_to_combining_e) {
- if (setting->mode & fss_embedded_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_embedded_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_embedded_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_embedded_list_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_embedded_list_read_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_embedded_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_embedded_list_read_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_embedded_list_read_parameter_to_width_e) {
- if (setting->mode & fss_embedded_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_embedded_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_embedded_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_embedded_list_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_embedded_list_read_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_embedded_list_read_mode_to_combining_e;
- }
-
- setting->mode |= fss_embedded_list_read_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_embedded_list_read_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_embedded_list_read_parameter_to_file_e].values.used > 1) {
- fss_embedded_list_read_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_embedded_list_read_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_embedded_list_read_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_embedded_list_read_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_embedded_list_read_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_embedded_list_read_main_flag_file_to_e;
- }
- else {
- fss_embedded_list_read_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_embedded_list_read_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_embedded_list_read_parameter_to_file_e].result == f_console_result_found_e) {
- fss_embedded_list_read_print_error_no_value(main, setting, fss_embedded_list_read_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_embedded_list_read_main_flag_file_to_e) {
- setting->flag -= fss_embedded_list_read_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_embedded_list_read_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_embedded_list_read_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_embedded_list_read_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_embedded_list_read_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_embedded_list_read_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_embedded_list_read_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_embedded_list_read_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_embedded_list_read_parameter_from_file_e].result == f_console_result_found_e) {
- fss_embedded_list_read_print_error_no_value(main, setting, fss_embedded_list_read_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_embedded_list_read_main_flag_file_from_e) {
- setting->flag -= fss_embedded_list_read_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_embedded_list_read_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_embedded_list_read_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_embedded_list_read_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_embedded_list_read_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_embedded_list_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_embedded_list_read_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_embedded_list_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_embedded_list_read_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_embedded_list_read_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_embedded_list_read_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_embedded_list_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_embedded_list_read_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_embedded_list_read_setting_load_
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_embedded_list_read_parameter_columns_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_embedded_list_read_long_columns_s, fss_embedded_list_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_embedded_list_read_long_columns_s, fss_embedded_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (main->parameters.remaining.used > 0 || (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[fss_embedded_list_read_parameter_at_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_at_s, main->error.notable);
fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_depth_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_depth_s, main->error.notable);
fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, main->error.notable);
fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_name_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_name_s, main->error.notable);
fl_print_format("%[' requires a string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_select_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, main->error.notable);
fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_embedded_list_read_long_line_s, fss_embedded_list_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_embedded_list_read_long_line_s, fss_embedded_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (main->parameters.array[fss_embedded_list_read_parameter_pipe_e].result == f_console_result_found_e) {
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_embedded_list_read_long_pipe_s, fss_embedded_list_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_embedded_list_read_long_pipe_s, fss_embedded_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_embedded_list_read_parameter_delimit_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, main->error.notable);
fl_print_format("%[' requires a value.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
f_array_length_t length = data.argv[index].used;
if (!length) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_delimit_s, main->error.notable);
fl_print_format("%[' must not be empty.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
}
if (F_status_is_error_not(status) && main->parameters.array[fss_embedded_list_read_parameter_select_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_read_long_select_s, main->error.notable);
fl_print_format("%[' parameter requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = F_status_set_error(F_parameter);
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_embedded_list_write_parameter_from_bytesequence_e, fss_embedded_list_write_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_embedded_list_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_embedded_list_write_parameter_from_bytesequence_e) {
- if (setting->mode & fss_embedded_list_write_mode_from_codepoint_e) {
- setting->mode -= fss_embedded_list_write_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_embedded_list_write_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_embedded_list_write_parameter_from_codepoint_e) {
- if (setting->mode & fss_embedded_list_write_mode_from_bytesequence_e) {
- setting->mode -= fss_embedded_list_write_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_embedded_list_write_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_embedded_list_write_parameter_to_bytesequence_e, fss_embedded_list_write_parameter_to_codepoint_e, fss_embedded_list_write_parameter_to_combining_e, fss_embedded_list_write_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_embedded_list_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_embedded_list_write_parameter_to_bytesequence_e) {
- if (setting->mode & fss_embedded_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_embedded_list_write_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_embedded_list_write_mode_to_combining_e) {
- setting->mode -= fss_embedded_list_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_embedded_list_write_mode_to_width_e) {
- setting->mode -= fss_embedded_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_embedded_list_write_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_embedded_list_write_parameter_to_codepoint_e) {
- if (setting->mode & fss_embedded_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_embedded_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_embedded_list_write_mode_to_combining_e) {
- setting->mode -= fss_embedded_list_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_embedded_list_write_mode_to_width_e) {
- setting->mode -= fss_embedded_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_embedded_list_write_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_embedded_list_write_parameter_to_combining_e) {
- if (setting->mode & fss_embedded_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_embedded_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_embedded_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_embedded_list_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_embedded_list_write_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_embedded_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_embedded_list_write_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_embedded_list_write_parameter_to_width_e) {
- if (setting->mode & fss_embedded_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_embedded_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_embedded_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_embedded_list_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_embedded_list_write_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_embedded_list_write_mode_to_combining_e;
- }
-
- setting->mode |= fss_embedded_list_write_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_embedded_list_write_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_embedded_list_write_parameter_to_file_e].values.used > 1) {
- fss_embedded_list_write_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_embedded_list_write_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_embedded_list_write_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_embedded_list_write_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_embedded_list_write_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_embedded_list_write_main_flag_file_to_e;
- }
- else {
- fss_embedded_list_write_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_embedded_list_write_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_embedded_list_write_parameter_to_file_e].result == f_console_result_found_e) {
- fss_embedded_list_write_print_error_no_value(main, setting, fss_embedded_list_write_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_embedded_list_write_main_flag_file_to_e) {
- setting->flag -= fss_embedded_list_write_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_embedded_list_write_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_embedded_list_write_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_embedded_list_write_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_embedded_list_write_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_embedded_list_write_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_embedded_list_write_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_embedded_list_write_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_embedded_list_write_parameter_from_file_e].result == f_console_result_found_e) {
- fss_embedded_list_write_print_error_no_value(main, setting, fss_embedded_list_write_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_embedded_list_write_main_flag_file_from_e) {
- setting->flag -= fss_embedded_list_write_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_embedded_list_write_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_embedded_list_write_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_embedded_list_write_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_embedded_list_write_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_embedded_list_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_embedded_list_write_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_embedded_list_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_embedded_list_write_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_embedded_list_write_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_embedded_list_write_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_embedded_list_write_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_embedded_list_write_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_embedded_list_write_setting_load_
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_embedded_list_write_parameter_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[fss_embedded_list_write_parameter_file_e].values.used > 1) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_file_s, main->error.notable);
fl_print_format("%[' may only be specified once.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_embedded_list_write_parameter_content_e].locations.used && main->parameters.array[fss_embedded_list_write_parameter_partial_e].locations.used) {
if (main->parameters.array[fss_embedded_list_write_parameter_content_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter, but not both.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
location_sub_content = main->parameters.array[fss_embedded_list_write_parameter_content_e].locations_sub.array[i];
if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
}
else if (!(main->pipe & fll_program_data_pipe_input_e)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[fss_embedded_list_write_parameter_partial_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter cannot be used when processing a pipe.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_embedded_list_write_parameter_prepend_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error(status)) break;
if (status == F_false) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must only contain white space.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
} // for
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must not be an empty string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_embedded_list_write_parameter_ignore_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, main->error.notable);
fl_print_format("%[' was specified, but no values were given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
const f_array_length_t total_arguments = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].values.used;
if (total_locations * 2 > total_arguments) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_ignore_s, main->error.notable);
fl_print_format("%[' requires two values.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = fss_embedded_list_write_process_pipe(main, output, quote, &buffer, &ignore);
if (F_status_is_error(status) && F_status_set_fine(status) != F_interrupt) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
- else if (main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_embedded_list_write_parameter_file_e].result == f_console_result_none_e) {
+ else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_embedded_list_write_parameter_file_e].result == f_console_result_none_e) {
// Ensure there is always a newline at the end, unless in quiet mode.
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_embedded_list_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_embedded_list_write_error_parameter_same_times_print_
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe FSS-0008 (Embedded List) standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[U+000A%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[) in objects.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_embedded_list_write_error_parameter_unsupported_eol_print_
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_embedded_list_write_error_parameter_value_missing_print_
for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_embedded_list_write_pipe_content_start_s.string[0]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QThe FSS-0008 (Embedded List) standard only supports one content per object.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_extended_list_read_parameter_from_bytesequence_e, fss_extended_list_read_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_list_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_list_read_parameter_from_bytesequence_e) {
- if (setting->mode & fss_extended_list_read_mode_from_codepoint_e) {
- setting->mode -= fss_extended_list_read_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_extended_list_read_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_list_read_parameter_from_codepoint_e) {
- if (setting->mode & fss_extended_list_read_mode_from_bytesequence_e) {
- setting->mode -= fss_extended_list_read_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_extended_list_read_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_extended_list_read_parameter_to_bytesequence_e, fss_extended_list_read_parameter_to_codepoint_e, fss_extended_list_read_parameter_to_combining_e, fss_extended_list_read_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_list_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_list_read_parameter_to_bytesequence_e) {
- if (setting->mode & fss_extended_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_extended_list_read_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_extended_list_read_mode_to_combining_e) {
- setting->mode -= fss_extended_list_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_list_read_mode_to_width_e) {
- setting->mode -= fss_extended_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_list_read_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_list_read_parameter_to_codepoint_e) {
- if (setting->mode & fss_extended_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_list_read_mode_to_combining_e) {
- setting->mode -= fss_extended_list_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_list_read_mode_to_width_e) {
- setting->mode -= fss_extended_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_list_read_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_extended_list_read_parameter_to_combining_e) {
- if (setting->mode & fss_extended_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_extended_list_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_list_read_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_list_read_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_list_read_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_extended_list_read_parameter_to_width_e) {
- if (setting->mode & fss_extended_list_read_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_list_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_list_read_mode_to_codepoint_e) {
- setting->mode -= fss_extended_list_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_list_read_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_list_read_mode_to_combining_e;
- }
-
- setting->mode |= fss_extended_list_read_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_extended_list_read_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_extended_list_read_parameter_to_file_e].values.used > 1) {
- fss_extended_list_read_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_extended_list_read_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_extended_list_read_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_extended_list_read_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_extended_list_read_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_extended_list_read_main_flag_file_to_e;
- }
- else {
- fss_extended_list_read_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_extended_list_read_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_extended_list_read_parameter_to_file_e].result == f_console_result_found_e) {
- fss_extended_list_read_print_error_no_value(main, setting, fss_extended_list_read_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_extended_list_read_main_flag_file_to_e) {
- setting->flag -= fss_extended_list_read_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_extended_list_read_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_extended_list_read_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_extended_list_read_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_extended_list_read_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_extended_list_read_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_extended_list_read_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_extended_list_read_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_extended_list_read_parameter_from_file_e].result == f_console_result_found_e) {
- fss_extended_list_read_print_error_no_value(main, setting, fss_extended_list_read_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_extended_list_read_main_flag_file_from_e) {
- setting->flag -= fss_extended_list_read_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_extended_list_read_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_extended_list_read_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_extended_list_read_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_extended_list_read_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_extended_list_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_extended_list_read_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_extended_list_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_list_read_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_extended_list_read_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_list_read_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_extended_list_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_extended_list_read_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_extended_list_read_setting_load_
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters.array[parameter_code[i]].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", 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.%]%r", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_extended_list_read_long_columns_s, parameter_name[i]);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_list_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_extended_list_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_extended_list_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_extended_list_read_parameter_line_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_line_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_list_read_long_pipe_s, fss_extended_list_read_long_line_s);
}
status = F_status_set_error(F_parameter);
length = data.argv[index].used;
if (!length) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_delimit_s, main->error.notable);
fl_print_format("%[' must not be empty.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_extended_list_read_parameter_select_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_select_s, main->error.notable);
fl_print_format("%[' parameter requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
fss_extended_list_read_depths_resize(0, &data.depths);
status = F_status_set_error(F_parameter);
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
if (data->depths.array[i].depth == data->depths.array[j].depth) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value '%]", main->error.to.stream, f_string_eol_s, 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("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
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_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_read_long_depth_s, main->error.notable);
fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
return F_status_set_error(F_parameter);
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_extended_list_write_parameter_from_bytesequence_e, fss_extended_list_write_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_list_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_list_write_parameter_from_bytesequence_e) {
- if (setting->mode & fss_extended_list_write_mode_from_codepoint_e) {
- setting->mode -= fss_extended_list_write_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_extended_list_write_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_list_write_parameter_from_codepoint_e) {
- if (setting->mode & fss_extended_list_write_mode_from_bytesequence_e) {
- setting->mode -= fss_extended_list_write_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_extended_list_write_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_extended_list_write_parameter_to_bytesequence_e, fss_extended_list_write_parameter_to_codepoint_e, fss_extended_list_write_parameter_to_combining_e, fss_extended_list_write_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_list_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_list_write_parameter_to_bytesequence_e) {
- if (setting->mode & fss_extended_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_extended_list_write_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_extended_list_write_mode_to_combining_e) {
- setting->mode -= fss_extended_list_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_list_write_mode_to_width_e) {
- setting->mode -= fss_extended_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_list_write_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_list_write_parameter_to_codepoint_e) {
- if (setting->mode & fss_extended_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_list_write_mode_to_combining_e) {
- setting->mode -= fss_extended_list_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_list_write_mode_to_width_e) {
- setting->mode -= fss_extended_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_list_write_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_extended_list_write_parameter_to_combining_e) {
- if (setting->mode & fss_extended_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_extended_list_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_list_write_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_list_write_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_list_write_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_extended_list_write_parameter_to_width_e) {
- if (setting->mode & fss_extended_list_write_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_list_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_list_write_mode_to_codepoint_e) {
- setting->mode -= fss_extended_list_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_list_write_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_list_write_mode_to_combining_e;
- }
-
- setting->mode |= fss_extended_list_write_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_extended_list_write_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_extended_list_write_parameter_to_file_e].values.used > 1) {
- fss_extended_list_write_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_extended_list_write_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_extended_list_write_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_extended_list_write_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_extended_list_write_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_extended_list_write_main_flag_file_to_e;
- }
- else {
- fss_extended_list_write_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_extended_list_write_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_extended_list_write_parameter_to_file_e].result == f_console_result_found_e) {
- fss_extended_list_write_print_error_no_value(main, setting, fss_extended_list_write_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_extended_list_write_main_flag_file_to_e) {
- setting->flag -= fss_extended_list_write_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_extended_list_write_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_extended_list_write_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_extended_list_write_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_extended_list_write_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_extended_list_write_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_extended_list_write_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_extended_list_write_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_extended_list_write_parameter_from_file_e].result == f_console_result_found_e) {
- fss_extended_list_write_print_error_no_value(main, setting, fss_extended_list_write_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_extended_list_write_main_flag_file_from_e) {
- setting->flag -= fss_extended_list_write_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_extended_list_write_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_extended_list_write_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_extended_list_write_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_extended_list_write_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_extended_list_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_extended_list_write_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_extended_list_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_list_write_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_extended_list_write_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_list_write_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_extended_list_write_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_extended_list_write_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_extended_list_write_setting_load_
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_extended_list_write_parameter_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[fss_extended_list_write_parameter_file_e].values.used > 1) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_file_s, main->error.notable);
fl_print_format("%[' may only be specified once.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_extended_list_write_parameter_content_e].locations.used && main->parameters.array[fss_extended_list_write_parameter_partial_e].locations.used) {
if (main->parameters.array[fss_extended_list_write_parameter_content_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter, but not both.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
location_sub_content = main->parameters.array[fss_extended_list_write_parameter_content_e].locations_sub.array[i];
if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
}
else if (!(main->pipe & fll_program_data_pipe_input_e)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[fss_extended_list_write_parameter_partial_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter cannot be used when processing a pipe.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_extended_list_write_parameter_prepend_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error(status)) break;
if (status == F_false) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must only contain white space.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
} // for
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must not be an empty string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_extended_list_write_parameter_ignore_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, main->error.notable);
fl_print_format("%[' was specified, but no values were given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
const f_array_length_t total_arguments = main->parameters.array[fss_extended_list_write_parameter_ignore_e].values.used;
if (total_locations * 2 > total_arguments) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_ignore_s, main->error.notable);
fl_print_format("%[' requires two values.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = fss_extended_list_write_process_pipe(main, output, quote, &buffer, &ignore);
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
- else if (main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_extended_list_write_parameter_file_e].result == f_console_result_none_e) {
+ else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_extended_list_write_parameter_file_e].result == f_console_result_none_e) {
// Ensure there is always a newline at the end, unless in quiet mode.
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_list_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_extended_list_write_error_parameter_same_times_print_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe FSS-0003 (Extended List) standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[U+000A%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[) in objects.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_extended_list_write_error_parameter_unsupported_eol_print_
if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_extended_list_write_error_parameter_value_missing_print_
for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_extended_list_write_pipe_content_start_s.string[0]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QThe FSS-0003 (Extended List) standard only supports one content per object.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_extended_read_parameter_from_bytesequence_e, fss_extended_read_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_read_parameter_from_bytesequence_e) {
- if (setting->mode & fss_extended_read_mode_from_codepoint_e) {
- setting->mode -= fss_extended_read_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_extended_read_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_read_parameter_from_codepoint_e) {
- if (setting->mode & fss_extended_read_mode_from_bytesequence_e) {
- setting->mode -= fss_extended_read_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_extended_read_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_extended_read_parameter_to_bytesequence_e, fss_extended_read_parameter_to_codepoint_e, fss_extended_read_parameter_to_combining_e, fss_extended_read_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_read_parameter_to_bytesequence_e) {
- if (setting->mode & fss_extended_read_mode_to_codepoint_e) {
- setting->mode -= fss_extended_read_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_extended_read_mode_to_combining_e) {
- setting->mode -= fss_extended_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_read_mode_to_width_e) {
- setting->mode -= fss_extended_read_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_read_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_read_parameter_to_codepoint_e) {
- if (setting->mode & fss_extended_read_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_read_mode_to_combining_e) {
- setting->mode -= fss_extended_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_read_mode_to_width_e) {
- setting->mode -= fss_extended_read_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_read_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_extended_read_parameter_to_combining_e) {
- if (setting->mode & fss_extended_read_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_read_mode_to_codepoint_e) {
- setting->mode -= fss_extended_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_read_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_read_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_read_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_extended_read_parameter_to_width_e) {
- if (setting->mode & fss_extended_read_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_read_mode_to_codepoint_e) {
- setting->mode -= fss_extended_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_read_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_read_mode_to_combining_e;
- }
-
- setting->mode |= fss_extended_read_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_extended_read_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_extended_read_parameter_to_file_e].values.used > 1) {
- fss_extended_read_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_extended_read_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_extended_read_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_extended_read_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_extended_read_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_extended_read_main_flag_file_to_e;
- }
- else {
- fss_extended_read_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_extended_read_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_extended_read_parameter_to_file_e].result == f_console_result_found_e) {
- fss_extended_read_print_error_no_value(main, setting, fss_extended_read_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_extended_read_main_flag_file_to_e) {
- setting->flag -= fss_extended_read_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_extended_read_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_extended_read_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_extended_read_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_extended_read_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_extended_read_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_extended_read_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_extended_read_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_extended_read_parameter_from_file_e].result == f_console_result_found_e) {
- fss_extended_read_print_error_no_value(main, setting, fss_extended_read_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_extended_read_main_flag_file_from_e) {
- setting->flag -= fss_extended_read_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_extended_read_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_extended_read_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_extended_read_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_extended_read_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_extended_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_extended_read_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_extended_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_read_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_extended_read_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_read_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_extended_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_extended_read_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_extended_read_setting_load_
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters.array[parameter_code[i]].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", 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.%]%r", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
break;
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_extended_read_long_columns_s, parameter_name[i]);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_extended_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_extended_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_extended_read_long_pipe_s, fss_extended_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, fss_extended_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_extended_read_parameter_line_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_extended_read_long_pipe_s, fss_extended_read_long_line_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_extended_read_long_pipe_s, fss_extended_read_long_line_s);
}
status = F_status_set_error(F_parameter);
length = data.argv[index].used;
if (!length) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_delimit_s, main->error.notable);
fl_print_format("%[' must not be empty.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_extended_read_parameter_select_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_select_s, main->error.notable);
fl_print_format("%[' parameter requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
fss_extended_read_depths_resize(0, &data.depths);
status = F_status_set_error(F_parameter);
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
if (data->depths.array[i].depth == data->depths.array[j].depth) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value '%]", main->error.to.stream, f_string_eol_s, 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("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
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_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_read_long_depth_s, main->error.notable);
fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
return F_status_set_error(F_parameter);
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_extended_write_parameter_from_bytesequence_e, fss_extended_write_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_write_parameter_from_bytesequence_e) {
- if (setting->mode & fss_extended_write_mode_from_codepoint_e) {
- setting->mode -= fss_extended_write_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_extended_write_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_write_parameter_from_codepoint_e) {
- if (setting->mode & fss_extended_write_mode_from_bytesequence_e) {
- setting->mode -= fss_extended_write_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_extended_write_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_extended_write_parameter_to_bytesequence_e, fss_extended_write_parameter_to_codepoint_e, fss_extended_write_parameter_to_combining_e, fss_extended_write_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_extended_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_extended_write_parameter_to_bytesequence_e) {
- if (setting->mode & fss_extended_write_mode_to_codepoint_e) {
- setting->mode -= fss_extended_write_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_extended_write_mode_to_combining_e) {
- setting->mode -= fss_extended_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_write_mode_to_width_e) {
- setting->mode -= fss_extended_write_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_write_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_extended_write_parameter_to_codepoint_e) {
- if (setting->mode & fss_extended_write_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_write_mode_to_combining_e) {
- setting->mode -= fss_extended_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_extended_write_mode_to_width_e) {
- setting->mode -= fss_extended_write_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_write_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_extended_write_parameter_to_combining_e) {
- if (setting->mode & fss_extended_write_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_write_mode_to_codepoint_e) {
- setting->mode -= fss_extended_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_write_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_write_mode_to_width_e;
- }
-
- setting->mode |= fss_extended_write_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_extended_write_parameter_to_width_e) {
- if (setting->mode & fss_extended_write_mode_to_bytesequence_e) {
- setting->mode -= fss_extended_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_extended_write_mode_to_codepoint_e) {
- setting->mode -= fss_extended_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_extended_write_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_extended_write_mode_to_combining_e;
- }
-
- setting->mode |= fss_extended_write_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_extended_write_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_extended_write_parameter_to_file_e].values.used > 1) {
- fss_extended_write_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_extended_write_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_extended_write_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_extended_write_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_extended_write_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_extended_write_main_flag_file_to_e;
- }
- else {
- fss_extended_write_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_extended_write_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_extended_write_parameter_to_file_e].result == f_console_result_found_e) {
- fss_extended_write_print_error_no_value(main, setting, fss_extended_write_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_extended_write_main_flag_file_to_e) {
- setting->flag -= fss_extended_write_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_extended_write_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_extended_write_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_extended_write_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_extended_write_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_extended_write_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_extended_write_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_extended_write_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_extended_write_parameter_from_file_e].result == f_console_result_found_e) {
- fss_extended_write_print_error_no_value(main, setting, fss_extended_write_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_extended_write_main_flag_file_from_e) {
- setting->flag -= fss_extended_write_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_extended_write_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_extended_write_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_extended_write_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_extended_write_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_extended_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_extended_write_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_extended_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_write_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_extended_write_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_extended_write_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_extended_write_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_extended_write_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_extended_write_setting_load_
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_extended_write_parameter_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[fss_extended_write_parameter_file_e].values.used > 1) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_file_s, main->error.notable);
fl_print_format("%[' may only be specified once.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_extended_write_parameter_content_e].locations.used && main->parameters.array[fss_extended_write_parameter_partial_e].locations.used) {
if (main->parameters.array[fss_extended_write_parameter_content_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter, but not both.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
f_array_length_t location_sub_content = main->parameters.array[fss_extended_write_parameter_content_e].locations_sub.array[0];
if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
location_sub_content = main->parameters.array[fss_extended_write_parameter_content_e].locations_sub.array[main->parameters.array[fss_extended_write_parameter_content_e].locations_sub.used - 1];
if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
}
else if (!(main->pipe & fll_program_data_pipe_input_e)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[fss_extended_write_parameter_partial_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter cannot be used when processing a pipe.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_extended_write_parameter_prepend_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error(status)) break;
if (status == F_false) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must only contain white space.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
} // for
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must not be an empty string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_extended_write_parameter_ignore_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, main->error.notable);
fl_print_format("%[' was specified, but no values were given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
const f_array_length_t total_arguments = main->parameters.array[fss_extended_write_parameter_ignore_e].values.used;
if (total_locations * 2 > total_arguments) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_ignore_s, main->error.notable);
fl_print_format("%[' requires two values.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = fss_extended_write_process_pipe(main, output, quote, &buffer);
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
- else if (main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_extended_write_parameter_file_e].result == f_console_result_none_e) {
+ else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_extended_write_parameter_file_e].result == f_console_result_none_e) {
// Ensure there is always a newline at the end, unless in quiet mode.
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_extended_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_extended_write_error_parameter_at_least_once_print_
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_extended_write_error_parameter_value_missing_print_
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe FSS-0001 (Extended) standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[U+000A%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[) in objects.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_extended_write_error_parameter_unsupported_eol_print_
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_identify_parameter_from_bytesequence_e, fss_identify_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_identify_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_identify_parameter_from_bytesequence_e) {
- if (setting->mode & fss_identify_mode_from_codepoint_e) {
- setting->mode -= fss_identify_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_identify_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_identify_parameter_from_codepoint_e) {
- if (setting->mode & fss_identify_mode_from_bytesequence_e) {
- setting->mode -= fss_identify_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_identify_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_identify_parameter_to_bytesequence_e, fss_identify_parameter_to_codepoint_e, fss_identify_parameter_to_combining_e, fss_identify_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_identify_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_identify_parameter_to_bytesequence_e) {
- if (setting->mode & fss_identify_mode_to_codepoint_e) {
- setting->mode -= fss_identify_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_identify_mode_to_combining_e) {
- setting->mode -= fss_identify_mode_to_combining_e;
- }
-
- if (setting->mode & fss_identify_mode_to_width_e) {
- setting->mode -= fss_identify_mode_to_width_e;
- }
-
- setting->mode |= fss_identify_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_identify_parameter_to_codepoint_e) {
- if (setting->mode & fss_identify_mode_to_bytesequence_e) {
- setting->mode -= fss_identify_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_identify_mode_to_combining_e) {
- setting->mode -= fss_identify_mode_to_combining_e;
- }
-
- if (setting->mode & fss_identify_mode_to_width_e) {
- setting->mode -= fss_identify_mode_to_width_e;
- }
-
- setting->mode |= fss_identify_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_identify_parameter_to_combining_e) {
- if (setting->mode & fss_identify_mode_to_bytesequence_e) {
- setting->mode -= fss_identify_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_identify_mode_to_codepoint_e) {
- setting->mode -= fss_identify_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_identify_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_identify_mode_to_width_e;
- }
-
- setting->mode |= fss_identify_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_identify_parameter_to_width_e) {
- if (setting->mode & fss_identify_mode_to_bytesequence_e) {
- setting->mode -= fss_identify_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_identify_mode_to_codepoint_e) {
- setting->mode -= fss_identify_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_identify_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_identify_mode_to_combining_e;
- }
-
- setting->mode |= fss_identify_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_identify_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_identify_parameter_to_file_e].values.used > 1) {
- fss_identify_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_identify_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_identify_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_identify_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_identify_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_identify_main_flag_file_to_e;
- }
- else {
- fss_identify_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_identify_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_identify_parameter_to_file_e].result == f_console_result_found_e) {
- fss_identify_print_error_no_value(main, setting, fss_identify_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_identify_main_flag_file_to_e) {
- setting->flag -= fss_identify_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_identify_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_identify_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_identify_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_identify_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_identify_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_identify_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_identify_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_identify_parameter_from_file_e].result == f_console_result_found_e) {
- fss_identify_print_error_no_value(main, setting, fss_identify_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_identify_main_flag_file_from_e) {
- setting->flag -= fss_identify_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_identify_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_identify_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_identify_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_identify_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_identify_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_identify_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_identify_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_identify_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_identify_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_identify_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_identify_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_identify_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_identify_setting_load_
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_identify_parameter_line_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_line_s, main->error.notable);
fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_identify_parameter_total_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_identify_parameter_object_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_identify_long_object_s, fss_identify_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_identify_long_object_s, fss_identify_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_identify_parameter_content_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_identify_long_content_s, fss_identify_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_identify_long_content_s, fss_identify_long_total_s);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_identify_parameter_name_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable);
fl_print_format("%[' requires a string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
const f_string_range_t range = macro_f_string_range_t_initialize2(length);
if (length == 0) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable);
fl_print_format("%[' does not allow zero length strings.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
break;
}
else if (status == F_false) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%Q%]", main->error.to.stream, main->error.notable, data.argv[index], main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_identify_long_name_s, main->error.notable);
fl_print_format("%[' may only contain word characters or the dash (minus)y character.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_payload_read_parameter_from_bytesequence_e, fss_payload_read_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_payload_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_payload_read_parameter_from_bytesequence_e) {
- if (setting->mode & fss_payload_read_mode_from_codepoint_e) {
- setting->mode -= fss_payload_read_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_payload_read_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_payload_read_parameter_from_codepoint_e) {
- if (setting->mode & fss_payload_read_mode_from_bytesequence_e) {
- setting->mode -= fss_payload_read_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_payload_read_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_payload_read_parameter_to_bytesequence_e, fss_payload_read_parameter_to_codepoint_e, fss_payload_read_parameter_to_combining_e, fss_payload_read_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_payload_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_payload_read_parameter_to_bytesequence_e) {
- if (setting->mode & fss_payload_read_mode_to_codepoint_e) {
- setting->mode -= fss_payload_read_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_payload_read_mode_to_combining_e) {
- setting->mode -= fss_payload_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_payload_read_mode_to_width_e) {
- setting->mode -= fss_payload_read_mode_to_width_e;
- }
-
- setting->mode |= fss_payload_read_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_payload_read_parameter_to_codepoint_e) {
- if (setting->mode & fss_payload_read_mode_to_bytesequence_e) {
- setting->mode -= fss_payload_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_payload_read_mode_to_combining_e) {
- setting->mode -= fss_payload_read_mode_to_combining_e;
- }
-
- if (setting->mode & fss_payload_read_mode_to_width_e) {
- setting->mode -= fss_payload_read_mode_to_width_e;
- }
-
- setting->mode |= fss_payload_read_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_payload_read_parameter_to_combining_e) {
- if (setting->mode & fss_payload_read_mode_to_bytesequence_e) {
- setting->mode -= fss_payload_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_payload_read_mode_to_codepoint_e) {
- setting->mode -= fss_payload_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_payload_read_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_payload_read_mode_to_width_e;
- }
-
- setting->mode |= fss_payload_read_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_payload_read_parameter_to_width_e) {
- if (setting->mode & fss_payload_read_mode_to_bytesequence_e) {
- setting->mode -= fss_payload_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_payload_read_mode_to_codepoint_e) {
- setting->mode -= fss_payload_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_payload_read_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_payload_read_mode_to_combining_e;
- }
-
- setting->mode |= fss_payload_read_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_payload_read_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_payload_read_parameter_to_file_e].values.used > 1) {
- fss_payload_read_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_payload_read_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_payload_read_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_payload_read_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_payload_read_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_payload_read_main_flag_file_to_e;
- }
- else {
- fss_payload_read_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_payload_read_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_payload_read_parameter_to_file_e].result == f_console_result_found_e) {
- fss_payload_read_print_error_no_value(main, setting, fss_payload_read_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_payload_read_main_flag_file_to_e) {
- setting->flag -= fss_payload_read_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_payload_read_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_payload_read_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_payload_read_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_payload_read_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_payload_read_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_payload_read_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_payload_read_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_payload_read_parameter_from_file_e].result == f_console_result_found_e) {
- fss_payload_read_print_error_no_value(main, setting, fss_payload_read_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_payload_read_main_flag_file_from_e) {
- setting->flag -= fss_payload_read_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_payload_read_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_payload_read_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_payload_read_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_payload_read_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_payload_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_payload_read_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_payload_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_payload_read_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_payload_read_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_payload_read_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_payload_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_payload_read_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_payload_read_setting_load_
for (f_array_length_t i = 0; i < 6; ++i) {
if (main->parameters.array[parameter_code[i]].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", 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.%]%r", main->error.to.stream, main->error.context, parameter_message[i], main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
break;
for (f_array_length_t i = 0; i < 5; ++i) {
if (main->parameters.array[parameter_code[i]].result == parameter_match[i]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_payload_read_long_columns_s, parameter_name[i]);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_payload_read_long_columns_s, parameter_name[i]);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && main->parameters.array[fss_payload_read_parameter_pipe_e].result == f_console_result_found_e) {
if (main->parameters.array[fss_payload_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_payload_read_long_pipe_s, fss_payload_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, fss_payload_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_payload_read_parameter_line_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_payload_read_long_pipe_s, fss_payload_read_long_line_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_payload_read_long_pipe_s, fss_payload_read_long_line_s);
}
status = F_status_set_error(F_parameter);
length = data.argv[index].used;
if (!length) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_delimit_s, main->error.notable);
fl_print_format("%[' must not be empty.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
if (F_status_is_error_not(status) && main->parameters.array[fss_payload_read_parameter_select_e].result == f_console_result_found_e) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_select_s, main->error.notable);
fl_print_format("%[' parameter requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
fss_payload_read_depths_resize(0, &data.depths);
status = F_status_set_error(F_parameter);
}
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
if (data->depths.array[i].depth == data->depths.array[j].depth) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity < f_console_verbosity_normal_e) {
+ fss_payload_read_print_line_first(setting, main->error, F_true);
- fl_print_format("%r%[%QThe value '%]", main->error.to.stream, f_string_eol_s, 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("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, main->error.notable);
- fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- funlockfile(main->error.to.stream);
+ fll_program_print_error_parameter_must_specify_once_value(main->error, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, data->depths.array[i].depth);
}
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_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_read_long_depth_s, main->error.notable);
fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[j].depth, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
return F_status_set_error(F_parameter);
const f_string_static_t file_name = fss_payload_read_file_identify(input.start, data->files);
if (F_status_set_fine(status) == F_none || F_status_set_fine(status) == F_none_eos || F_status_set_fine(status) == F_none_stop || F_status_set_fine(status) == F_data_not_eos || F_status_set_fine(status) == F_data_not_stop) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe file '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%]", main->error.to.stream, main->error.notable, file_name, main->error.notable);
fl_print_format("%[%r%]", main->error.to.stream, main->error.notable, f_fss_string_payload_s, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
else {
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { fss_payload_write_parameter_from_bytesequence_e, fss_payload_write_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_payload_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_payload_write_parameter_from_bytesequence_e) {
- if (setting->mode & fss_payload_write_mode_from_codepoint_e) {
- setting->mode -= fss_payload_write_mode_from_codepoint_e;
- }
-
- setting->mode |= fss_payload_write_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == fss_payload_write_parameter_from_codepoint_e) {
- if (setting->mode & fss_payload_write_mode_from_bytesequence_e) {
- setting->mode -= fss_payload_write_mode_from_bytesequence_e;
- }
-
- setting->mode |= fss_payload_write_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { fss_payload_write_parameter_to_bytesequence_e, fss_payload_write_parameter_to_codepoint_e, fss_payload_write_parameter_to_combining_e, fss_payload_write_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- fss_payload_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == fss_payload_write_parameter_to_bytesequence_e) {
- if (setting->mode & fss_payload_write_mode_to_codepoint_e) {
- setting->mode -= fss_payload_write_mode_to_codepoint_e;
- }
-
- if (setting->mode & fss_payload_write_mode_to_combining_e) {
- setting->mode -= fss_payload_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_payload_write_mode_to_width_e) {
- setting->mode -= fss_payload_write_mode_to_width_e;
- }
-
- setting->mode |= fss_payload_write_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == fss_payload_write_parameter_to_codepoint_e) {
- if (setting->mode & fss_payload_write_mode_to_bytesequence_e) {
- setting->mode -= fss_payload_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_payload_write_mode_to_combining_e) {
- setting->mode -= fss_payload_write_mode_to_combining_e;
- }
-
- if (setting->mode & fss_payload_write_mode_to_width_e) {
- setting->mode -= fss_payload_write_mode_to_width_e;
- }
-
- setting->mode |= fss_payload_write_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == fss_payload_write_parameter_to_combining_e) {
- if (setting->mode & fss_payload_write_mode_to_bytesequence_e) {
- setting->mode -= fss_payload_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_payload_write_mode_to_codepoint_e) {
- setting->mode -= fss_payload_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_payload_write_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= fss_payload_write_mode_to_width_e;
- }
-
- setting->mode |= fss_payload_write_mode_to_combining_e;
- }
- else if (choices.array[choice] == fss_payload_write_parameter_to_width_e) {
- if (setting->mode & fss_payload_write_mode_to_bytesequence_e) {
- setting->mode -= fss_payload_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & fss_payload_write_mode_to_codepoint_e) {
- setting->mode -= fss_payload_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[fss_payload_write_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= fss_payload_write_mode_to_combining_e;
- }
-
- setting->mode |= fss_payload_write_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[fss_payload_write_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[fss_payload_write_parameter_to_file_e].values.used > 1) {
- fss_payload_write_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[fss_payload_write_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[fss_payload_write_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[fss_payload_write_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[fss_payload_write_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= fss_payload_write_main_flag_file_to_e;
- }
- else {
- fss_payload_write_print_error_parameter_file_name_empty(main, setting, main->parameters.array[fss_payload_write_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[fss_payload_write_parameter_to_file_e].result == f_console_result_found_e) {
- fss_payload_write_print_error_no_value(main, setting, fss_payload_write_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & fss_payload_write_main_flag_file_to_e) {
- setting->flag -= fss_payload_write_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[fss_payload_write_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[fss_payload_write_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[fss_payload_write_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[fss_payload_write_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- fss_payload_write_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- fss_payload_write_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= fss_payload_write_main_flag_file_from_e;
- }
- else if (main->parameters.array[fss_payload_write_parameter_from_file_e].result == f_console_result_found_e) {
- fss_payload_write_print_error_no_value(main, setting, fss_payload_write_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & fss_payload_write_main_flag_file_from_e) {
- setting->flag -= fss_payload_write_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[fss_payload_write_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- fss_payload_write_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & fss_payload_write_mode_to_bytesequence_e)) {
- if (main->parameters.array[fss_payload_write_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[fss_payload_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = fss_payload_write_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[fss_payload_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= fss_payload_write_main_flag_header_e;
- }
-
- if (main->parameters.array[fss_payload_write_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= fss_payload_write_main_flag_separate_e;
- }
-
if (main->parameters.array[fss_payload_write_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= fss_payload_write_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_fss_payload_write_setting_load_
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_payload_write_parameter_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[fss_payload_write_parameter_file_e].values.used > 1) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
-
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_file_s, main->error.notable);
- fl_print_format("%[' may only be specified once.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- funlockfile(main->error.to.stream);
+ if (main->error.verbosity < f_console_verbosity_normal_e) {
+ fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_enable_s, fss_payload_write_long_file_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_payload_write_parameter_content_e].locations.used && main->parameters.array[fss_payload_write_parameter_partial_e].locations.used) {
if (main->parameters.array[fss_payload_write_parameter_content_e].result == f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter, but not both.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
location_sub_content = main->parameters.array[fss_payload_write_parameter_content_e].locations_sub.array[i];
if (location_object > location_content || location_object == location_content && location_sub_object > location_sub_content) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QEach '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
}
else if (!(main->pipe & fll_program_data_pipe_input_e)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis requires either piped data or the use of the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_content_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status) && (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[fss_payload_write_parameter_partial_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThis '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter cannot be used when processing a pipe.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_payload_write_parameter_prepend_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error(status)) break;
if (status == F_false) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must only contain white space.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
} // for
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_prepend_s, main->error.notable);
fl_print_format("%[' must not be an empty string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (F_status_is_error_not(status)) {
if (main->parameters.array[fss_payload_write_parameter_ignore_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, main->error.notable);
fl_print_format("%[' was specified, but no values were given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
const f_array_length_t total_arguments = main->parameters.array[fss_payload_write_parameter_ignore_e].values.used;
if (total_locations * 2 > total_arguments) {
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_ignore_s, main->error.notable);
fl_print_format("%[' requires two values.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
status = F_status_set_error(F_parameter);
}
status = fss_payload_write_process_pipe(main, output, quote, &buffer);
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input pipe%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
}
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QWhile processing the '%]%[input arguments%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, main->error.notable, main->error.notable);
fl_print_format("%['.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
}
- else if (main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_payload_write_parameter_file_e].result == f_console_result_none_e) {
+ else if (main->error.verbosity > f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[fss_payload_write_parameter_file_e].result == f_console_result_none_e) {
// Ensure there is always a newline at the end, unless in quiet mode.
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
// Ensure a newline is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
if (F_status_is_error(status)) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QMust specify the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_object_s, main->error.notable);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_payload_write_long_partial_s, main->error.notable);
fl_print_format("%[' parameter.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_payload_write_error_parameter_same_times_print_
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe FSS-000E (Payload) standard does not support end of line character '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[\\n%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[U+000A%]", main->error.to.stream, main->error.notable, main->error.notable);
fl_print_format("%[) in objects.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_payload_write_error_parameter_unsupported_eol_print_
return;
}
- flockfile(main->error.to.stream);
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, symbol, parameter, main->error.notable);
fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
#endif // _di_fss_payload_write_error_parameter_value_missing_print_
for (; range.start <= range.stop; ++range.start) {
if (block.string[range.start] == fss_payload_write_pipe_content_start_s.string[0]) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QThe FSS-000E (Payload) standard only supports one content per object.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ fss_status_code_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true);
+ fss_status_code_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
{
f_array_length_t choice = 0;
if (setting->flag & fss_status_code_main_flag_error_e) {
if (setting->flag & fss_status_code_main_flag_warning_e) {
if (!(setting->flag & fss_status_code_main_flag_number_e)) {
+ setting->status = F_status_set_error(F_parameter);
+
fss_status_code_print_line_first(setting, main->error, F_true);
fss_status_code_print_error_cannot_error_warning_number(setting, main->error);
fss_status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
}
if (setting->flag & fss_status_code_main_flag_fine_e) {
+ setting->status = F_status_set_error(F_parameter);
+
fss_status_code_print_line_first(setting, main->error, F_true);
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_status_code_long_error_s, fss_status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_status_code_long_error_s, fss_status_code_long_fine_s);
fss_status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
}
else if (setting->flag & fss_status_code_main_flag_warning_e && setting->flag & fss_status_code_main_flag_fine_e) {
+ setting->status = F_status_set_error(F_parameter);
+
fss_status_code_print_line_first(setting, main->error, F_true);
- fll_program_parameter_long_print_cannot_use_with(main->error, fss_status_code_long_warning_s, fss_status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, fss_status_code_long_warning_s, fss_status_code_long_fine_s);
fss_status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) {
+ setting->status = F_status_set_error(F_parameter);
+
fss_status_code_print_line_first(setting, main->error, F_true);
fss_status_code_print_error_no_fss_status_codes(setting, main->error);
fss_status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
}
#ifndef _di_fss_status_code_main_
void fss_status_code_main(fll_program_data_t * const main, fss_status_code_setting_t * const setting) {
- if (!main || !setting) {
- fss_status_code_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_parameter, "fss_status_code_main", F_true);
- fss_status_code_print_line_last(setting, main->error, F_true);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (F_status_is_error(setting->status)) return;
+ if (!main || !setting || F_status_is_error(setting->status)) return;
setting->status = F_none;
#endif
#ifndef _di_fss_status_code_print_error_cannot_error_warning_number_
- void fss_status_code_print_error_cannot_error_warning_number(fss_status_code_setting_t * const setting, const fl_print_t print) {
+ f_status_t fss_status_code_print_error_cannot_error_warning_number(fss_status_code_setting_t * const setting, const fl_print_t print) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
f_file_stream_lock(print.to);
fl_print_format("%[' parameter.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
f_file_stream_unlock(print.to);
+
+ return F_none;
}
#endif // _di_fss_status_code_print_error_cannot_error_warning_number_
#ifndef _di_fss_status_code_print_error_no_fss_status_codes_
- void fss_status_code_print_error_no_fss_status_codes(fss_status_code_setting_t * const setting, const fl_print_t print) {
+ f_status_t fss_status_code_print_error_no_fss_status_codes(fss_status_code_setting_t * const setting, const fl_print_t print) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
fll_print_format("%[No status code is specified.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+
+ return F_none;
}
#endif // _di_fss_status_code_print_error_no_fss_status_codes_
#endif // _di_fss_status_code_print_help_
#ifndef _di_fss_status_code_print_line_first_
- void fss_status_code_print_line_first(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t fss_status_code_print_line_first(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
if (lock) {
fll_print_dynamic_raw(setting->line_first, print.to.stream);
else {
f_print_dynamic_raw(setting->line_first, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_fss_status_code_print_line_first_
#ifndef _di_fss_status_code_print_line_last_
- void fss_status_code_print_line_last(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t fss_status_code_print_line_last(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
- if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+ if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return F_output_not;
if (lock) {
fll_print_dynamic_raw(setting->line_last, print.to.stream);
else {
f_print_dynamic_raw(setting->line_last, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_fss_status_code_print_line_last_
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_fss_status_code_print_error_cannot_error_warning_number_
- extern void fss_status_code_print_error_cannot_error_warning_number(fss_status_code_setting_t * const setting, const fl_print_t print);
+ extern f_status_t fss_status_code_print_error_cannot_error_warning_number(fss_status_code_setting_t * const setting, const fl_print_t print);
#endif // _di_fss_status_code_print_error_cannot_error_warning_number_
/**
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_fss_status_code_print_error_no_fss_status_codes_
- extern void fss_status_code_print_error_no_fss_status_codes(fss_status_code_setting_t * const setting, const fl_print_t print);
+ extern f_status_t fss_status_code_print_error_no_fss_status_codes(fss_status_code_setting_t * const setting, const fl_print_t print);
#endif // _di_fss_status_code_print_error_no_fss_status_codes_
/**
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_fss_status_code_print_help_
extern f_status_t fss_status_code_print_help(fss_status_code_setting_t * const setting, const fl_print_t print);
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_fss_status_code_print_line_first_
- extern void fss_status_code_print_line_first(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t fss_status_code_print_line_first(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_fss_status_code_print_line_first_
/**
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_fss_status_code_print_line_last_
- extern void fss_status_code_print_line_last(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t fss_status_code_print_line_last(fss_status_code_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_fss_status_code_print_line_last_
#ifdef __cplusplus
return;
}
-
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { iki_read_parameter_from_bytesequence_e, iki_read_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- iki_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == iki_read_parameter_from_bytesequence_e) {
- if (setting->mode & iki_read_mode_from_codepoint_e) {
- setting->mode -= iki_read_mode_from_codepoint_e;
- }
-
- setting->mode |= iki_read_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == iki_read_parameter_from_codepoint_e) {
- if (setting->mode & iki_read_mode_from_bytesequence_e) {
- setting->mode -= iki_read_mode_from_bytesequence_e;
- }
-
- setting->mode |= iki_read_mode_from_codepoint_e;
- }
- }
-
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { iki_read_parameter_to_bytesequence_e, iki_read_parameter_to_codepoint_e, iki_read_parameter_to_combining_e, iki_read_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- iki_read_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == iki_read_parameter_to_bytesequence_e) {
- if (setting->mode & iki_read_mode_to_codepoint_e) {
- setting->mode -= iki_read_mode_to_codepoint_e;
- }
-
- if (setting->mode & iki_read_mode_to_combining_e) {
- setting->mode -= iki_read_mode_to_combining_e;
- }
-
- if (setting->mode & iki_read_mode_to_width_e) {
- setting->mode -= iki_read_mode_to_width_e;
- }
-
- setting->mode |= iki_read_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == iki_read_parameter_to_codepoint_e) {
- if (setting->mode & iki_read_mode_to_bytesequence_e) {
- setting->mode -= iki_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & iki_read_mode_to_combining_e) {
- setting->mode -= iki_read_mode_to_combining_e;
- }
-
- if (setting->mode & iki_read_mode_to_width_e) {
- setting->mode -= iki_read_mode_to_width_e;
- }
-
- setting->mode |= iki_read_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == iki_read_parameter_to_combining_e) {
- if (setting->mode & iki_read_mode_to_bytesequence_e) {
- setting->mode -= iki_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & iki_read_mode_to_codepoint_e) {
- setting->mode -= iki_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[iki_read_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= iki_read_mode_to_width_e;
- }
-
- setting->mode |= iki_read_mode_to_combining_e;
- }
- else if (choices.array[choice] == iki_read_parameter_to_width_e) {
- if (setting->mode & iki_read_mode_to_bytesequence_e) {
- setting->mode -= iki_read_mode_to_bytesequence_e;
- }
-
- if (setting->mode & iki_read_mode_to_codepoint_e) {
- setting->mode -= iki_read_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[iki_read_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= iki_read_mode_to_combining_e;
- }
-
- setting->mode |= iki_read_mode_to_width_e;
- }
- }
}
f_string_static_t * const args = main->parameters.arguments.array;
- if (main->parameters.array[iki_read_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[iki_read_parameter_to_file_e].values.used > 1) {
- iki_read_print_error_parameter_file_to_too_many(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (args[main->parameters.array[iki_read_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[iki_read_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[iki_read_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
-
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[iki_read_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
-
- setting->flag |= iki_read_main_flag_file_to_e;
- }
- else {
- iki_read_print_error_parameter_file_name_empty(main, setting, main->parameters.array[iki_read_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- }
- else if (main->parameters.array[iki_read_parameter_to_file_e].result == f_console_result_found_e) {
- iki_read_print_error_no_value(main, setting, iki_read_long_to_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- main->output.to = main->message.to;
-
- if (setting->flag & iki_read_main_flag_file_to_e) {
- setting->flag -= iki_read_main_flag_file_to_e;
- }
- }
-
- if (main->parameters.array[iki_read_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[iki_read_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_from.used = main->parameters.array[iki_read_parameter_from_file_e].values.used;
-
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
- for (; i < setting->path_files_from.used; ++i) {
-
- index = main->parameters.array[iki_read_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
-
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- iki_read_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- iki_read_print_error_parameter_file_name_empty(main, setting, index);
-
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
- } // for
-
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= iki_read_main_flag_file_from_e;
- }
- else if (main->parameters.array[iki_read_parameter_from_file_e].result == f_console_result_found_e) {
- iki_read_print_error_no_value(main, setting, iki_read_long_from_file_s);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
- else {
- if (setting->flag & iki_read_main_flag_file_from_e) {
- setting->flag -= iki_read_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[iki_read_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- iki_read_print_error_no_from(main, setting);
-
- setting->status = F_status_set_error(F_parameter);
- }
-
- if (!(setting->mode & iki_read_mode_to_bytesequence_e)) {
- if (main->parameters.array[iki_read_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = iki_read_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
-
- if (main->parameters.array[iki_read_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= iki_read_main_flag_header_e;
- }
-
- if (main->parameters.array[iki_read_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= iki_read_main_flag_separate_e;
- }
-
if (main->parameters.array[iki_read_parameter_strip_invalid_e].result == f_console_result_found_e) {
setting->flag |= iki_read_main_flag_strip_invalid_e;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_iki_read_setting_load_
if (main->parameters.remaining.used > 0 || (main->pipe & fll_program_data_pipe_input_e)) {
if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_at_s, main->error.notable);
fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
data.at = number;
if (main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_at_s, iki_read_long_whole_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_at_s, iki_read_long_whole_s);
}
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[iki_read_parameter_line_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_line_s, main->error.notable);
fl_print_format("%[' requires a positive number.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[iki_read_parameter_name_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_name_s, main->error.notable);
fl_print_format("%[' requires a string.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
if (main->parameters.array[iki_read_parameter_replace_e].result != f_console_result_none_e) {
if (main->parameters.array[iki_read_parameter_replace_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_replace_e].values.used % 2 != 0) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_replace_s, main->error.notable);
fl_print_format("%[' requires 2 strings.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_replace_s, iki_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_replace_s, iki_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (main->parameters.array[iki_read_parameter_substitute_e].result != f_console_result_none_e) {
if (main->parameters.array[iki_read_parameter_substitute_e].result == f_console_result_found_e || main->parameters.array[iki_read_parameter_substitute_e].values.used % 3 != 0) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ f_file_stream_lock(main->error.to);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, main->error.notable);
fl_print_format("%[' requires 3 strings.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ f_file_stream_unlock(main->error.to);
}
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_substitute_s, iki_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_substitute_s, iki_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (main->parameters.array[iki_read_parameter_literal_e].result == f_console_result_found_e) {
if (main->parameters.array[iki_read_parameter_object_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_literal_s, iki_read_long_object_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_literal_s, iki_read_long_object_s);
}
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[iki_read_parameter_content_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_literal_s, iki_read_long_content_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_literal_s, iki_read_long_content_s);
}
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_literal_s, iki_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_literal_s, iki_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[iki_read_parameter_object_e].result == f_console_result_found_e) {
if (main->parameters.array[iki_read_parameter_content_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_object_s, iki_read_long_content_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_object_s, iki_read_long_content_s);
}
status = F_status_set_error(F_parameter);
}
if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_object_s, iki_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_object_s, iki_read_long_total_s);
}
status = F_status_set_error(F_parameter);
if (main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
if (main->parameters.array[iki_read_parameter_total_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_program_parameter_long_print_cannot_use_with(main->error, iki_read_long_whole_s, iki_read_long_total_s);
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, iki_read_long_whole_s, iki_read_long_total_s);
}
status = F_status_set_error(F_parameter);
}
if (F_status_is_error(status)) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_dynamic_raw(f_string_eol_s, main->error.to.stream);
}
}
}
else {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
+ if (main->error.verbosity > f_console_verbosity_quiet_e) {
fll_print_format("%r%[%QYou failed to specify one or more files.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
}
// Ensure a new line is always put at the end of the program execution, unless in quiet mode.
if (main->output.verbosity != f_console_verbosity_quiet_e) {
if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ f_file_stream_flush(main->output.to);
}
- fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+ fll_print_dynamic_raw(f_string_eol_s, main->message.to.stream);
}
iki_read_data_delete(&data);
const f_string_static_t iki_write_program_name_long_s = macro_f_string_static_t_initialize(IKI_WRITE_program_name_long_s, 0, IKI_WRITE_program_name_long_s_length);
#endif // _di_iki_write_program_name_
+#ifndef _di_iki_write_strings_
+ const f_string_static_t iki_write_object_s = macro_f_string_static_t_initialize(IKI_WRITE_object_s, 0, IKI_WRITE_object_s_length);
+#endif // _di_iki_write_strings_
+
#ifndef _di_iki_write_parameters_
const f_string_static_t iki_write_short_file_s = macro_f_string_static_t_initialize(IKI_WRITE_short_file_s, 0, IKI_WRITE_short_file_s_length);
const f_string_static_t iki_write_short_content_s = macro_f_string_static_t_initialize(IKI_WRITE_short_content_s, 0, IKI_WRITE_short_content_s_length);
if (!setting) return F_status_set_error(F_parameter);
+ f_string_dynamic_resize(0, &setting->escaped);
+ f_string_dynamic_resize(0, &setting->buffer);
+ f_string_dynamic_resize(0, &setting->object);
+ f_string_dynamic_resize(0, &setting->content);
+
+ f_string_dynamics_resize(0, &setting->objects);
+ f_string_dynamics_resize(0, &setting->contents);
+
return F_none;
}
#endif // _di_iki_write_setting_delete_
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
{
f_array_length_t choice = 0;
if (F_status_is_error(setting->status)) {
iki_write_print_line_first(setting, main->error, F_true);
fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_context", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
return;
}
if (F_status_is_error(setting->status)) {
iki_write_print_line_first(setting, main->error, F_true);
fll_error_print(main->error, F_status_set_fine(setting->status), "fll_program_parameter_process_verbosity", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
return;
}
return;
}
+ }
- // Identify and prioritize "from" mode parameters.
- {
- uint16_t choices_array[2] = { iki_write_parameter_from_bytesequence_e, iki_write_parameter_from_codepoint_e };
- choices.array = choices_array;
- choices.used = 2;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- iki_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
+ main->output.to.id = F_type_descriptor_output_d;
+ main->output.to.stream = F_type_output_d;
+ main->output.to.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
- if (choices.array[choice] == iki_write_parameter_from_bytesequence_e) {
- if (setting->mode & iki_write_mode_from_codepoint_e) {
- setting->mode -= iki_write_mode_from_codepoint_e;
- }
+ if (main->parameters.array[iki_write_parameter_file_e].result == f_console_result_additional_e) {
+ if (main->parameters.array[iki_write_parameter_file_e].values.used > 1) {
+ setting->status = F_status_set_error(F_parameter);
- setting->mode |= iki_write_mode_from_bytesequence_e;
- }
- else if (choices.array[choice] == iki_write_parameter_from_codepoint_e) {
- if (setting->mode & iki_write_mode_from_bytesequence_e) {
- setting->mode -= iki_write_mode_from_bytesequence_e;
- }
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_parameter_must_specify_once(main->error, f_console_symbol_long_enable_s, iki_write_long_file_s);
+ iki_write_print_line_last(setting, main->error, F_true);
- setting->mode |= iki_write_mode_from_codepoint_e;
- }
+ return;
}
- // Identify and prioritize "to" mode parameters.
- {
- uint16_t choices_array[4] = { iki_write_parameter_to_bytesequence_e, iki_write_parameter_to_codepoint_e, iki_write_parameter_to_combining_e, iki_write_parameter_to_width_e };
- choices.array = choices_array;
- choices.used = 4;
- choice = 1;
-
- setting->status = f_console_parameter_prioritize_right(main->parameters, choices, &choice);
-
- if (F_status_is_error(setting->status)) {
- iki_write_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_prioritize_right", F_true);
-
- return;
- }
-
- if (choices.array[choice] == iki_write_parameter_to_bytesequence_e) {
- if (setting->mode & iki_write_mode_to_codepoint_e) {
- setting->mode -= iki_write_mode_to_codepoint_e;
- }
-
- if (setting->mode & iki_write_mode_to_combining_e) {
- setting->mode -= iki_write_mode_to_combining_e;
- }
+ f_string_static_t * const args = main->parameters.arguments.array;
- if (setting->mode & iki_write_mode_to_width_e) {
- setting->mode -= iki_write_mode_to_width_e;
- }
+ const f_array_length_t index = main->parameters.array[iki_write_parameter_file_e].values.array[0];
- setting->mode |= iki_write_mode_to_bytesequence_e;
- }
- else if (choices.array[choice] == iki_write_parameter_to_codepoint_e) {
- if (setting->mode & iki_write_mode_to_bytesequence_e) {
- setting->mode -= iki_write_mode_to_bytesequence_e;
- }
-
- if (setting->mode & iki_write_mode_to_combining_e) {
- setting->mode -= iki_write_mode_to_combining_e;
- }
+ main->output.to.id = -1;
+ main->output.to.stream = 0;
- if (setting->mode & iki_write_mode_to_width_e) {
- setting->mode -= iki_write_mode_to_width_e;
- }
+ setting->status = f_file_stream_open(args[index], f_string_empty_s, &main->output.to);
- setting->mode |= iki_write_mode_to_codepoint_e;
- }
- else if (choices.array[choice] == iki_write_parameter_to_combining_e) {
- if (setting->mode & iki_write_mode_to_bytesequence_e) {
- setting->mode -= iki_write_mode_to_bytesequence_e;
- }
+ if (F_status_is_error(setting->status)) {
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[index], f_file_operation_open_s, fll_error_file_type_file_e);
+ iki_write_print_line_last(setting, main->error, F_true);
- if (setting->mode & iki_write_mode_to_codepoint_e) {
- setting->mode -= iki_write_mode_to_codepoint_e;
- }
-
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[iki_write_parameter_to_width_e].result == f_console_result_found_e) {
- setting->mode |= iki_write_mode_to_width_e;
- }
-
- setting->mode |= iki_write_mode_to_combining_e;
- }
- else if (choices.array[choice] == iki_write_parameter_to_width_e) {
- if (setting->mode & iki_write_mode_to_bytesequence_e) {
- setting->mode -= iki_write_mode_to_bytesequence_e;
- }
+ return;
+ }
- if (setting->mode & iki_write_mode_to_codepoint_e) {
- setting->mode -= iki_write_mode_to_codepoint_e;
- }
+ setting->flag |= iki_write_main_flag_file_to_e;
+ }
+ else if (main->parameters.array[iki_write_parameter_file_e].result == f_console_result_found_e) {
+ setting->status = F_status_set_error(F_parameter);
- // --to_width may be specified with --to_combining.
- if (main->parameters.array[iki_write_parameter_to_combining_e].result == f_console_result_found_e) {
- setting->mode |= iki_write_mode_to_combining_e;
- }
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_write_long_file_s);
+ iki_write_print_line_last(setting, main->error, F_true);
- setting->mode |= iki_write_mode_to_width_e;
- }
- }
+ return;
}
- f_string_static_t * const args = main->parameters.arguments.array;
+ if (main->parameters.array[iki_write_parameter_object_e].result == f_console_result_additional_e) {
+ f_array_lengths_t * const values = &main->parameters.array[iki_write_parameter_object_e].values;
- if (main->parameters.array[iki_write_parameter_to_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[iki_write_parameter_to_file_e].values.used > 1) {
- iki_write_print_error_parameter_file_to_too_many(main, setting);
+ setting->objects.used = 0;
- setting->status = F_status_set_error(F_parameter);
+ setting->status = f_string_dynamics_resize(values->used, &setting->objects);
+
+ if (F_status_is_error(setting->status)) {
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_resize", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
return;
}
- if (args[main->parameters.array[iki_write_parameter_to_file_e].values.array[0]].used) {
- setting->path_files_to.used = 0;
-
- setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
-
- setting->path_files_to.array[setting->path_files_to.used].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[iki_write_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
-
- ++setting->path_files_to.used;
-
- setting->status = f_file_stream_open(args[main->parameters.array[iki_write_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
+ // Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
+ for (f_array_length_t index = 0; setting->objects.used < values->used; ) {
- if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[iki_write_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
-
- return;
- }
+ index = values->array[setting->objects.used];
- setting->flag |= iki_write_main_flag_file_to_e;
- }
- else {
- iki_write_print_error_parameter_file_name_empty(main, setting, main->parameters.array[iki_write_parameter_to_file_e].values.array[0]);
-
- setting->status = F_status_set_error(F_parameter);
+ setting->objects.array[setting->objects.used].string = main->parameters.arguments.array[index].string;
+ setting->objects.array[setting->objects.used].used = main->parameters.arguments.array[index].used;
+ setting->objects.array[setting->objects.used++].size = 0;
+ } // for
- return;
- }
+ setting->flag |= iki_write_main_flag_object_e;
}
- else if (main->parameters.array[iki_write_parameter_to_file_e].result == f_console_result_found_e) {
- iki_write_print_error_no_value(main, setting, iki_write_long_to_file_s);
-
+ else if (main->parameters.array[iki_write_parameter_object_e].result == f_console_result_found_e) {
setting->status = F_status_set_error(F_parameter);
- return;
- }
- else {
- main->output.to = main->message.to;
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_write_long_object_s);
+ iki_write_print_line_last(setting, main->error, F_true);
- if (setting->flag & iki_write_main_flag_file_to_e) {
- setting->flag -= iki_write_main_flag_file_to_e;
- }
+ return;
}
- if (main->parameters.array[iki_write_parameter_from_file_e].result == f_console_result_additional_e) {
- setting->path_files_from.used = 0;
-
- setting->status = f_string_dynamics_increase_by(main->parameters.array[iki_write_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
+ if (main->parameters.array[iki_write_parameter_content_e].result == f_console_result_additional_e) {
+ f_array_lengths_t * const values = &main->parameters.array[iki_write_parameter_content_e].values;
- setting->path_files_from.used = main->parameters.array[iki_write_parameter_from_file_e].values.used;
+ setting->contents.used = 0;
- f_array_length_t i = 0;
- f_array_length_t index = 0;
+ setting->status = f_string_dynamics_resize(values->used, &setting->contents);
- for (; i < setting->path_files_from.used; ++i) {
+ if (F_status_is_error(setting->status)) {
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_resize", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
- index = main->parameters.array[iki_write_parameter_from_file_e].values.array[i];
- setting->path_files_from.array[i].used = 0;
-
- setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
+ return;
+ }
- if (args[index].used) {
- if (f_file_exists(args[index], F_true) != F_true) {
- iki_write_print_error_parameter_file_not_found(main, setting, F_true, args[index]);
+ // Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
+ for (f_array_length_t index = 0; setting->contents.used < values->used; ) {
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_file_found_not);
- }
- }
- }
- else {
- iki_write_print_error_parameter_file_name_empty(main, setting, index);
+ index = values->array[setting->contents.used];
- if (F_status_is_error_not(setting->status)) {
- setting->status = F_status_set_error(F_parameter);
- }
- }
+ setting->contents.array[setting->contents.used].string = main->parameters.arguments.array[index].string;
+ setting->contents.array[setting->contents.used].used = main->parameters.arguments.array[index].used;
+ setting->contents.array[setting->contents.used++].size = 0;
} // for
- if (F_status_is_error(setting->status)) return;
-
- setting->flag |= iki_write_main_flag_file_from_e;
+ setting->flag |= iki_write_main_flag_content_e;
}
- else if (main->parameters.array[iki_write_parameter_from_file_e].result == f_console_result_found_e) {
- iki_write_print_error_no_value(main, setting, iki_write_long_from_file_s);
-
+ else if (main->parameters.array[iki_write_parameter_content_e].result == f_console_result_found_e) {
setting->status = F_status_set_error(F_parameter);
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, iki_write_long_content_s);
+ iki_write_print_line_last(setting, main->error, F_true);
+
return;
}
- else {
- if (setting->flag & iki_write_main_flag_file_from_e) {
- setting->flag -= iki_write_main_flag_file_from_e;
- }
- }
-
- if (F_status_is_error(setting->status)) return;
-
- if (main->parameters.array[iki_write_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
- iki_write_print_error_no_from(main, setting);
+ if (!(main->pipe & fll_program_data_pipe_input_e) && !(setting->flag & (iki_write_main_flag_content_e | iki_write_parameter_object_e))) {
setting->status = F_status_set_error(F_parameter);
- }
- if (!(setting->mode & iki_write_mode_to_bytesequence_e)) {
- if (main->parameters.array[iki_write_parameter_separate_e].result == f_console_result_found_e || main->parameters.array[iki_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->prepend = iki_write_string_prepend_padding_s;
- setting->append = f_string_eol_s;
- }
- else {
- setting->prepend = f_string_space_s;
- }
- }
+ iki_write_print_line_first(setting, main->error, F_true);
+ iki_write_print_error_main_missing(setting, main->error);
+ iki_write_print_line_last(setting, main->error, F_true);
- if (main->parameters.array[iki_write_parameter_headers_e].result == f_console_result_found_e) {
- setting->flag |= iki_write_main_flag_header_e;
+ return;
}
- if (main->parameters.array[iki_write_parameter_separate_e].result == f_console_result_found_e) {
- setting->flag |= iki_write_main_flag_separate_e;
- }
+ setting->quote = f_iki_syntax_quote_double_s;
- if (main->parameters.array[iki_write_parameter_strip_invalid_e].result == f_console_result_found_e) {
- setting->flag |= iki_write_main_flag_strip_invalid_e;
+ if (main->parameters.array[iki_write_parameter_double_e].result == f_console_result_found_e) {
+ if (main->parameters.array[iki_write_parameter_single_e].result == f_console_result_found_e) {
+ if (main->parameters.array[iki_write_parameter_double_e].location < main->parameters.array[iki_write_parameter_single_e].location) {
+ setting->quote = f_iki_syntax_quote_single_s;
+ }
+ }
+ }
+ else if (main->parameters.array[iki_write_parameter_single_e].result == f_console_result_found_e) {
+ setting->quote = f_iki_syntax_quote_single_s;
}
-
- setting->valid_not = main->message.set->error;
}
#endif // _di_iki_write_setting_load_
#endif // _di_iki_write_program_name_
/**
+ * Special strings used by this program.
+ */
+#ifndef _di_iki_write_strings_
+ #define IKI_WRITE_object_s "object"
+
+ #define IKI_WRITE_object_s_length 6
+
+ extern const f_string_static_t iki_write_object_s;
+#endif // _di_iki_write_strings_
+
+/**
* The program defines.
*/
#ifndef _di_iki_write_defines_
*
* iki_write_main_flag_*_e:
* - none: No modes in use.
- * - file_from: Using a specified source file.
+ * - content: The Content being written is specified.
+ * - double: Operate using double quotes.
* - file_to: Using a specified destination file.
* - help: Print help.
- * - header: Enable printing of headers.
- * - separate: Enable printing of separators.
- * - strip_invalid: Using strip invalid character mode.
- * - verify: Using verify mode.
+ * - object: The Object being written is specified.
+ * - single: Operate using single quotes.
* - version: Print version.
*/
#ifndef _di_iki_write_main_flag_e_
enum {
- iki_write_main_flag_none_e = 0x0,
- iki_write_main_flag_file_from_e = 0x1,
- iki_write_main_flag_file_to_e = 0x2,
- iki_write_main_flag_header_e = 0x4,
- iki_write_main_flag_help_e = 0x8,
- iki_write_main_flag_separate_e = 0x10,
- iki_write_main_flag_strip_invalid_e = 0x20,
- iki_write_main_flag_verify_e = 0x40,
- iki_write_main_flag_version_e = 0x80,
+ iki_write_main_flag_none_e = 0x0,
+ iki_write_main_flag_content_e = 0x1,
+ iki_write_main_flag_double_e = 0x2,
+ iki_write_main_flag_file_to_e = 0x4,
+ iki_write_main_flag_help_e = 0x8,
+ iki_write_main_flag_object_e = 0x10,
+ iki_write_main_flag_single_e = 0x20,
+ iki_write_main_flag_version_e = 0x40,
};
#endif // _di_iki_write_main_flag_e_
*
* line_first: A string expected to represent either "\n" or NULL to allow for easy handling of when to print first new line or not.
* line_last: A string expected to represent either "\n" or NULL to allow for easy handling of when to print last new line or not.
+ *
+ * quote: This holds the quote used during processing.
+ *
+ * escaped: A buffer used for escaping strings during processing.
+ * buffer: A buffer used during processing the file.
+ * object: A buffer used to hold an Object during processing.
+ * content: A buffer used to hold a Content during processing.
+ *
+ * objects: An array of objects passed as values to the "--object" parameter.
+ * contents: An array of objects passed as values to the "--content" parameter and must match the length of objects.
*/
#ifndef _di_iki_write_setting_t_
typedef struct {
f_string_static_t line_first;
f_string_static_t line_last;
+
+ f_string_static_t quote;
+
+ f_string_dynamic_t escaped;
+ f_string_dynamic_t buffer;
+ f_string_dynamic_t object;
+ f_string_dynamic_t content;
+
+ f_string_dynamics_t objects;
+ f_string_dynamics_t contents;
} iki_write_setting_t;
#define iki_write_setting_t_initialize \
F_none, \
f_string_static_t_initialize, \
f_string_static_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamic_t_initialize, \
+ f_string_dynamics_t_initialize, \
+ f_string_dynamics_t_initialize, \
}
#endif // _di_iki_write_setting_t_
#endif
#ifndef _di_iki_write_main_
- f_status_t iki_write_main(fll_program_data_t * const main, iki_write_setting_t * const setting) {
+ void iki_write_main(fll_program_data_t * const main, iki_write_setting_t * const setting) {
- f_status_t status = F_none;
+ if (!main || !setting || F_status_is_error(setting->status)) return;
- // Load parameters.
- status = f_console_parameter_process(arguments, &main->parameters);
- if (F_status_is_error(status)) return;
+ setting->status = F_none;
- {
- f_array_length_t choice = 0;
- f_uint16s_t choices = f_uint16s_t_initialize;
-
- // Identify and prioritize "color context" parameters.
- {
- uint16_t choices_array[3] = { iki_write_parameter_no_color_e, iki_write_parameter_light_e, iki_write_parameter_dark_e };
- choices.array = choices_array;
- choices.used = 3;
-
- const uint8_t modes[3] = { f_color_mode_color_not_e, f_color_mode_light_e, f_color_mode_dark_e };
-
- status = fll_program_parameter_process_context(choices, modes, F_true, main);
-
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context", F_true);
-
- return;
- }
- }
-
- // Identify and prioritize "verbosity" parameters.
- {
- uint16_t choices_array[5] = { iki_write_parameter_verbosity_quiet_e, iki_write_parameter_verbosity_error_e, iki_write_parameter_verbosity_verbose_e, iki_write_parameter_verbosity_debug_e, iki_write_parameter_verbosity_normal_e };
- choices.array = choices_array;
- choices.used = 5;
-
- const uint8_t verbosity[5] = { f_console_verbosity_quiet_e, f_console_verbosity_error_e, f_console_verbosity_verbose_e, f_console_verbosity_debug_e, f_console_verbosity_normal_e };
-
- status = fll_program_parameter_process_verbosity(choices, verbosity, F_true, main);
-
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity", F_true);
-
- return;
- }
- }
- }
-
- iki_write_data_t data = iki_write_data_t_initialize;
- data.main = main;
- data.argv = main->parameters.arguments.array;
-
- status = F_none;
-
- if (main->parameters.array[iki_write_parameter_help_e].result == f_console_result_found_e) {
+ if (setting->flag & iki_write_main_flag_help_e) {
iki_write_print_help(setting, main->message);
- iki_write_data_delete(&data);
-
- return F_none;
+ return;
}
- if (main->parameters.array[iki_write_parameter_version_e].result == f_console_result_found_e) {
+ if (setting->flag & iki_write_main_flag_version_e) {
fll_program_print_version(main->message, iki_write_program_version_s);
- iki_write_data_delete(&data);
-
- return F_none;
+ return;
}
- f_file_t file = f_file_t_initialize;
+ setting->escaped.used = 0;
- file.id = F_type_descriptor_output_d;
- file.stream = F_type_output_d;
- file.flag = F_file_flag_create_d | F_file_flag_write_only_d | F_file_flag_append_d;
+ if (main->pipe & fll_program_data_pipe_input_e) {
+ bool object_ended = F_false;
- if (F_status_is_error_not(status)) {
- if (main->parameters.array[iki_write_parameter_file_e].result == f_console_result_additional_e) {
- if (main->parameters.array[iki_write_parameter_file_e].values.used > 1) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ f_array_length_t previous = 0;
+ f_string_range_t range = f_string_range_t_initialize;
+ f_status_t status = F_none;
+ f_file_t pipe = f_file_t_initialize;
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_file_s, main->error.notable);
- fl_print_format("%[' may only be specified once.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+ pipe.id = F_type_descriptor_input_d;
+ pipe.size_read = 1;
- funlockfile(main->error.to.stream);
- }
+ setting->buffer.used = 0;
+ setting->object.used = 0;
+ setting->content.used = 0;
- status = F_status_set_error(F_parameter);
- }
- else {
- const f_array_length_t index = main->parameters.array[iki_write_parameter_file_e].values.array[0];
+ range.start = 0;
- file.id = -1;
- file.stream = 0;
+ do {
+ if (!((++main->signal_check) % iki_write_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ setting->status = F_status_set_error(F_interrupt);
- status = f_file_stream_open(data.argv[index], f_string_empty_s, &file);
-
- if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, data.argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
+ return;
}
- }
- }
- else if (main->parameters.array[iki_write_parameter_file_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
-
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_file_s, main->error.notable);
- fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- funlockfile(main->error.to.stream);
+ main->signal_check = 0;
}
- status = F_status_set_error(F_parameter);
- }
- }
-
- if (F_status_is_error_not(status) && main->parameters.array[iki_write_parameter_object_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
-
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable);
- fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- funlockfile(main->error.to.stream);
- }
-
- status = F_status_set_error(F_parameter);
- }
+ if (status != F_none_eof) {
+ status = f_file_read(pipe, &setting->buffer);
- if (F_status_is_error_not(status) && main->parameters.array[iki_write_parameter_content_e].result == f_console_result_found_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ if (F_status_is_error(status)) {
+ setting->status = F_status_set_error(F_pipe);
- fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable);
- fl_print_format("%[' is specified, but no value is given.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_read", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+ iki_write_print_line_last(setting, main->error, F_true);
- funlockfile(main->error.to.stream);
- }
+ return;
+ }
- status = F_status_set_error(F_parameter);
- }
+ if (!setting->buffer.used) {
+ setting->status = F_status_set_error(F_parameter);
- if (F_status_is_error_not(status) && !(main->pipe & fll_program_data_pipe_input_e)) {
- if (main->parameters.array[iki_write_parameter_object_e].result != f_console_result_additional_e && main->parameters.array[iki_write_parameter_content_e].result != f_console_result_additional_e) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_pipe_missing_content(main->error);
+ iki_write_print_line_last(setting, main->error, F_true);
- fl_print_format("%r%[%QNo main provided, either pipe the main or use the '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable);
- fl_print_format("%[' and the '%]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable);
- fl_print_format("%[' parameters.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
+ return;
+ }
- funlockfile(main->error.to.stream);
+ range.stop = setting->buffer.used - 1;
}
- status = F_status_set_error(F_parameter);
- }
- }
+ previous = range.start;
+ setting->status = f_string_dynamic_seek_to(setting->buffer, f_string_ascii_feed_form_s.string[0], &range);
- if (F_status_is_error_not(status)) {
- if (main->parameters.array[iki_write_parameter_object_e].values.used != main->parameters.array[iki_write_parameter_content_e].values.used) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(main->error.to.stream);
-
- fl_print_format("%r%[%QThe parameters '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_content_s, main->error.notable);
- fl_print_format("%[' and '%]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, iki_write_long_object_s, main->error.notable);
- fl_print_format("%[' must be specified the same number of times.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
-
- funlockfile(main->error.to.stream);
+ if (setting->status == F_data_not_stop) {
+ setting->status = F_status_set_error(F_parameter);
}
- status = F_status_set_error(F_parameter);
- }
- }
+ if (F_status_is_error(setting->status)) {
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_seek_to", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
- data.quote = f_iki_syntax_quote_double_s;
-
- if (F_status_is_error_not(status)) {
- if (main->parameters.array[iki_write_parameter_double_e].result == f_console_result_found_e) {
- if (main->parameters.array[iki_write_parameter_single_e].result == f_console_result_found_e) {
- if (main->parameters.array[iki_write_parameter_double_e].location < main->parameters.array[iki_write_parameter_single_e].location) {
- data.quote = f_iki_syntax_quote_single_s;
- }
+ return;
}
- }
- else if (main->parameters.array[iki_write_parameter_single_e].result == f_console_result_found_e) {
- data.quote = f_iki_syntax_quote_single_s;
- }
- }
-
- if (F_status_is_error_not(status)) {
- f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
-
- if (main->pipe & fll_program_data_pipe_input_e) {
- f_file_t pipe = f_file_t_initialize;
-
- pipe.id = F_type_descriptor_input_d;
- pipe.size_read = 1;
-
- f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
- f_string_dynamic_t object = f_string_dynamic_t_initialize;
- f_string_dynamic_t content = f_string_dynamic_t_initialize;
- bool object_ended = F_false;
+ if (object_ended && previous == range.start) {
+ setting->status = F_status_set_error(F_parameter);
- f_array_length_t previous = 0;
- f_string_range_t range = f_string_range_t_initialize;
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_pipe_invalid_form_feed(main->error);
+ iki_write_print_line_last(setting, main->error, F_true);
- range.start = 0;
-
- for (f_status_t status_pipe = F_none; ; ) {
-
- if (!((++main->signal_check) % iki_write_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
-
- break;
- }
-
- main->signal_check = 0;
- }
-
- if (status_pipe != F_none_eof) {
- status_pipe = f_file_read(pipe, &buffer);
-
- if (F_status_is_error(status_pipe)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_to", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
-
- status = F_status_set_error(F_pipe);
-
- break;
- }
-
- if (!buffer.used) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_print_format("%r%[%QThe pipe has no content.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
- }
-
- status = F_status_set_error(F_parameter);
-
- break;
- }
-
- range.stop = buffer.used - 1;
- }
-
- previous = range.start;
- status = f_string_dynamic_seek_to(buffer, f_string_ascii_feed_form_s.string[0], &range);
-
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_seek_to", F_true);
-
- break;
- }
-
- if (status == F_data_not_stop) {
- status = F_status_set_error(F_parameter);
-
- fll_error_print(main->error, F_parameter, "f_string_dynamic_seek_line", F_true);
-
- break;
- }
-
- if (object_ended && previous == range.start) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_print_format("%r%[%QThe pipe has incorrectly placed form-feed characters (\\f).%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
- }
-
- status = F_status_set_error(F_parameter);
-
- break;
- }
+ return;
+ }
- range.stop = range.start - 1;
- range.start = previous;
+ range.stop = range.start - 1;
+ range.start = previous;
- if (object_ended) {
- content.used = 0;
+ if (object_ended) {
+ setting->content.used = 0;
- if (buffer.used) {
- status = f_string_dynamic_partial_append_nulless(buffer, range, &content);
+ if (setting->buffer.used) {
+ setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->content);
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true);
+ if (F_status_is_error(setting->status)) {
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_partial_append_nulless", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
- break;
- }
+ return;
}
-
- status = iki_write_process(&data, file, object, content, &escaped);
- if (F_status_is_error(status)) break;
-
- fll_print_dynamic_raw(f_string_eol_s, file.stream);
-
- object_ended = F_false;
}
- else {
- object.used = 0;
- status = f_string_dynamic_partial_append_nulless(buffer, range, &object);
+ setting->status = iki_write_process(main, setting, setting->object, setting->content);
+ if (F_status_is_error(setting->status)) return;
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true);
+ fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
- break;
- }
-
- object_ended = F_true;
- }
-
- // Restore the range, positioned after the new line.
- range.start = range.stop + 2;
- range.stop = buffer.used - 1;
+ object_ended = F_false;
+ }
+ else {
+ setting->object.used = 0;
- // only clear the buffer and reset the start when the entire buffer has been processed.
- if (range.start > range.stop) {
- range.start = 0;
- buffer.used = 0;
- }
+ setting->status = f_string_dynamic_partial_append_nulless(setting->buffer, range, &setting->object);
- if (status_pipe == F_none_eof && !buffer.used && !object_ended) break;
- } // for
+ if (F_status_is_error(setting->status)) {
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_partial_append_nulless", F_true);
+ iki_write_print_line_last(setting, main->error, F_true);
- if (F_status_is_error_not(status) && object_ended) {
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- fll_print_format("%r%[%QThe pipe has an object without content.%]%r", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
+ return;
}
- status = F_status_set_error(F_parameter);
+ object_ended = F_true;
}
- f_string_dynamic_resize(0, &buffer);
- f_string_dynamic_resize(0, &object);
- f_string_dynamic_resize(0, &content);
- }
+ // Restore the range, positioned after the new line.
+ range.start = range.stop + 2;
+ range.stop = setting->buffer.used - 1;
- if (F_status_is_error_not(status)) {
- for (f_array_length_t i = 0; i < main->parameters.array[iki_write_parameter_object_e].values.used; ++i) {
-
- if (!((++main->signal_check) % iki_write_signal_check_d)) {
- if (fll_program_standard_signal_received(main)) {
- status = F_status_set_error(F_interrupt);
+ // Only clear the buffer and reset the start when the entire buffer has been processed.
+ if (range.start > range.stop) {
+ range.start = 0;
+ setting->buffer.used = 0;
+ }
- break;
- }
+ } while (status != F_none_eof || setting->buffer.used || object_ended);
- main->signal_check = 0;
- }
+ if (object_ended) {
+ setting->status = F_status_set_error(F_parameter);
- status = iki_write_process(&data, file, data.argv[main->parameters.array[iki_write_parameter_object_e].values.array[i]], data.argv[main->parameters.array[iki_write_parameter_content_e].values.array[i]], &escaped);
- if (F_status_is_error(status)) break;
+ iki_write_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_pipe_object_without_content(main->error);
+ iki_write_print_line_last(setting, main->error, F_true);
- fll_print_dynamic_raw(f_string_eol_s, file.stream);
- } // for
-
- // Ensure there is always a new line at the end, unless in quiet mode.
- if (F_status_is_error_not(status) && main->error.verbosity != f_console_verbosity_quiet_e && main->error.verbosity != f_console_verbosity_error_e && main->parameters.array[iki_write_parameter_file_e].result == f_console_result_none_e) {
- fll_print_dynamic_raw(f_string_eol_s, file.stream);
- }
+ return;
}
-
- f_string_dynamic_resize(0, &escaped);
}
- if (main->parameters.array[iki_write_parameter_file_e].result == f_console_result_additional_e) {
- f_file_stream_flush(output);
- f_file_stream_close(&file);
- }
+ for (f_array_length_t i = 0; i < setting->objects.used; ++i) {
- // Ensure a new line is always put at the end of the program execution, unless in quiet mode.
- if (main->error.verbosity != f_console_verbosity_quiet_e) {
- if (F_status_is_error(status)) {
- if (F_status_set_fine(status) == F_interrupt) {
- fflush(main->output.to.stream);
+ if (!((++main->signal_check) % iki_write_signal_check_d)) {
+ if (fll_program_standard_signal_received(main)) {
+ setting->status = F_status_set_error(F_interrupt);
+
+ return;
}
- fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+ main->signal_check = 0;
}
- }
- iki_write_data_delete(&data);
+ setting->status = iki_write_process(main, setting, setting->objects.array[i], setting->contents.array[i]);
+ if (F_status_is_error(setting->status)) return;
+
+ fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
+ } // for
- return status;
+ // Ensure a new line is always put at the end of the program execution, unless in quiet mode.
+ iki_write_print_line_last(setting, main->message, F_true);
}
#endif // _di_iki_write_main_
// IKI Write includes.
#include <program/iki_write/common.h>
+#include <program/iki_write/print.h>
#ifdef __cplusplus
extern "C" {
* F_parameter (with error bit) if main is NULL or setting is NULL.
*/
#ifndef _di_iki_write_main_
- extern f_status_t iki_write_main(fll_program_data_t * const main, iki_write_setting_t * const setting);
+ extern void iki_write_main(fll_program_data_t * const main, iki_write_setting_t * const setting);
#endif // _di_iki_write_main_
#ifdef __cplusplus
fll_program_standard_set_down(&data);
- return F_status_is_error(status) ? 1 : 0;
+ return F_status_is_error(setting.status) ? 1 : 0;
}
fll_program_print_help_option(print, iki_write_short_object_s, iki_write_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " The Object to write.");
fll_program_print_help_option(print, iki_write_short_single_s, iki_write_long_single_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use single quotes.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, iki_write_program_name_s, f_string_empty_s);
fl_print_format("%r %[Notes:%]%r", print.to.stream, f_string_eol_s, print.set->important, print.set->important, f_string_eol_s);
#endif // _di_iki_write_print_help_
#ifndef _di_iki_write_print_line_first_
- void iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
if (lock) {
fll_print_dynamic_raw(setting->line_first, print.to.stream);
else {
f_print_dynamic_raw(setting->line_first, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_iki_write_print_line_first_
#ifndef _di_iki_write_print_line_last_
- void iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
- if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return;
- if (setting->flag & iki_write_main_flag_verify_e) return;
- if ((setting->flag & iki_write_main_flag_file_to_e) && !F_status_is_error(setting->status)) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+ if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return F_output_not;
if (lock) {
fll_print_dynamic_raw(setting->line_last, print.to.stream);
else {
f_print_dynamic_raw(setting->line_last, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_iki_write_print_line_last_
+#ifndef _di_iki_write_print_error_main_missing_
+ f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QNo main provided, either pipe the main data or use the '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%r%r%]", print.to.stream, print.set->notable, f_console_symbol_long_enable_s, iki_write_long_object_s, print.set->notable);
+ fl_print_format("%[' and the '%]", print.to.stream, print.set->error, print.set->error);
+ fl_print_format("%[%r%r%]", print.to.stream, print.set->notable, f_console_symbol_long_enable_s, iki_write_long_content_s, print.set->notable);
+ fl_print_format("%[' parameters.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_iki_write_print_error_main_missing_
+
+#ifndef _di_iki_write_print_error_object_not_valid_
+ f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object) {
+
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ f_file_stream_lock(print.to);
+
+ fl_print_format("%[%QThe object '%]", print.to.stream, print.set->error, print.prefix, print.set->error);
+ fl_print_format("%[%Q%]", print.to.stream, print.set->notable, object, print.set->notable);
+ fl_print_format("%[' is not a valid IKI Object.%]%r", print.to.stream, print.set->error, print.set->error, f_string_eol_s);
+
+ f_file_stream_unlock(print.to);
+
+ return F_none;
+ }
+#endif // _di_iki_write_print_error_object_not_valid_
+
#ifdef __cplusplus
} // extern "C"
#endif
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_iki_write_print_help_
extern f_status_t iki_write_print_help(iki_write_setting_t * const setting, const fl_print_t print);
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_iki_write_print_line_first_
- extern void iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t iki_write_print_line_first(iki_write_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_iki_write_print_line_first_
/**
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_iki_write_print_line_last_
- extern void iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t iki_write_print_line_last(iki_write_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_iki_write_print_line_last_
+/**
+ * Print error message about "main" Object being missing.
+ *
+ * @param setting
+ * The main program settings.
+ * This does not alter setting.status.
+ * @param print
+ * Designates the how and where to print.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_iki_write_print_error_main_missing_
+ extern f_status_t iki_write_print_error_main_missing(iki_write_setting_t * const setting, const fl_print_t print);
+#endif // _di_iki_write_print_error_main_missing_
+
+/**
+ * Print error message about an Object not being valid.
+ *
+ * @param setting
+ * The main program settings.
+ * This does not alter setting.status.
+ * @param print
+ * Designates the how and where to print.
+ * @param object
+ * The a string representing the object that is missing.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ */
+#ifndef _di_iki_write_print_error_object_not_valid_
+ extern f_status_t iki_write_print_error_object_not_valid(iki_write_setting_t * const setting, const fl_print_t print, const f_string_static_t object);
+#endif // _di_iki_write_print_error_object_not_valid_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern "C" {
#endif
-#ifndef _di_iki_write_data_delete_
- void iki_write_data_delete(iki_write_data_t *data) {
-
- // Nothing to deallocate.
- }
-#endif // _di_iki_write_data_delete_
-
#ifdef __cplusplus
} // extern "C"
#endif
#endif
/**
- * The program data.
- *
- * argv: The argument structure in the progam data parameters for simplifying syntax.
- * main: The main program data.
- * quote: The quote to use when writing.
- */
-#ifndef _di_iki_write_data_t_
- typedef struct {
- fll_program_data_t *main;
- f_string_static_t *argv;
-
- f_string_static_t quote;
- } iki_write_data_t;
-
- #define iki_write_data_t_initialize \
- { \
- 0, \
- 0, \
- f_string_static_t_initialize, \
- }
-#endif // _di_iki_write_data_t_
-
-/**
* Provide common/generic definitions.
*
* iki_write_common_allocation_*:
#define iki_write_common_allocation_small_d 16
#endif // _di_iki_write_common_
-/**
- * Deallocate program data.
- *
- * @param data
- * The program data.
- *
- * @return
- * F_none on success.
- */
-#ifndef _di_iki_write_data_delete_
- extern void iki_write_data_delete(iki_write_data_t *data) F_attribute_visibility_internal_d;
-#endif // _di_iki_write_data_delete_
-
#ifdef __cplusplus
} // extern "C"
#endif
#endif
#ifndef _di_iki_write_process_
- f_status_t iki_write_process(fll_program_data_t * const main, status_code_setting_t * const setting, iki_write_data_t * const data, const f_file_t output, const f_string_static_t object, const f_string_static_t content, f_string_dynamic_t *escaped) {
+ f_status_t iki_write_process(fll_program_data_t * const main, iki_write_setting_t * const setting, const f_string_static_t object, const f_string_static_t content) {
if (!object.used) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(data->main->error.to.stream);
-
- fl_print_format("%r%[%QThe object is missing, it must not have a length of %]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[0%]", data->main->error.to.stream, data->main->error.notable, data->main->error.notable);
- fl_print_format("%[.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- funlockfile(data->main->error.to.stream);
- }
+ fll_program_print_error_missing_variable_not_zero(main->error, iki_write_object_s);
return F_status_set_error(F_failure);
}
f_status_t status = f_iki_object_is(object);
if (status == F_false) {
- if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
- flockfile(data->main->error.to.stream);
-
- fl_print_format("%r%[%QThe object '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
- fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->error.notable, object, data->main->error.notable);
- fl_print_format("%[' is not a valid IKI object.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s);
-
- funlockfile(data->main->error.to.stream);
- }
+ iki_write_print_error_object_not_valid(setting, main->error, object);
return F_status_set_error(F_failure);
}
- else if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "f_iki_object_is", F_true);
+
+ if (F_status_is_error(status)) {
+ fll_error_print(main->error, F_status_set_fine(status), "f_iki_object_is", F_true);
return F_status_set_error(F_failure);
}
- escaped->used = 0;
+ setting->escaped.used = 0;
- status = fll_iki_content_escape(content, data->quote, escaped);
+ status = fll_iki_content_escape(content, setting->quote, &setting->escaped);
if (F_status_is_error(status)) {
- fll_error_print(data->main->error, F_status_set_fine(status), "fll_iki_content_escape", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "fll_iki_content_escape", F_true);
return F_status_set_error(F_failure);
}
- fl_print_format("%Q%r%r%Q%r", output, object, f_iki_syntax_separator_s, data->quote, *escaped, data->quote);
+ fl_print_format("%Q%r%r%Q%r", main->output.to.stream, object, f_iki_syntax_separator_s, setting->quote, setting->escaped, setting->quote);
return F_none;
}
/**
* Process a given object and content, printing the IKI if valid or an error if invalid.
*
- * @param data
- * The program data.
- * @param output
- * The file to output to.
+ * @param main
+ * The main program data.
+ * @param setting
+ * The main program settings.
* @param object
* The object to validate and print.
* @param content
* The content to escape and print.
- * @param escaped
- * A string buffer used as a string cache to save the string into while escaping.
*
* @return
* F_none on success.
+ *
* F_failure (with error bit) for any othe failure.
*/
#ifndef _di_iki_write_process_
- extern f_status_t iki_write_process(fll_program_data_t * const main, status_code_setting_t * const setting, iki_write_data_t * const data, const f_file_t output, const f_string_static_t object, const f_string_static_t content, f_string_dynamic_t *escaped) F_attribute_visibility_internal_d;
+ extern f_status_t iki_write_process(fll_program_data_t * const main, iki_write_setting_t * const setting, const f_string_static_t object, const f_string_static_t content) F_attribute_visibility_internal_d;
#endif // _di_iki_write_process_
#ifdef __cplusplus
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ status_code_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true);
+ status_code_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
{
f_array_length_t choice = 0;
if (setting->flag & status_code_main_flag_error_e) {
if (setting->flag & status_code_main_flag_warning_e) {
if (!(setting->flag & status_code_main_flag_number_e)) {
+ setting->status = F_status_set_error(F_parameter);
+
status_code_print_line_first(setting, main->error, F_true);
status_code_print_error_cannot_error_warning_number(setting, main->error);
status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
}
if (setting->flag & status_code_main_flag_fine_e) {
+ setting->status = F_status_set_error(F_parameter);
+
status_code_print_line_first(setting, main->error, F_true);
- fll_program_parameter_long_print_cannot_use_with(main->error, status_code_long_error_s, status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, status_code_long_error_s, status_code_long_fine_s);
status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
}
else if (setting->flag & status_code_main_flag_warning_e && setting->flag & status_code_main_flag_fine_e) {
+ setting->status = F_status_set_error(F_parameter);
+
status_code_print_line_first(setting, main->error, F_true);
- fll_program_parameter_long_print_cannot_use_with(main->error, status_code_long_warning_s, status_code_long_fine_s);
+ fll_program_print_error_parameter_cannot_use_with(main->error, f_console_symbol_long_enable_s, status_code_long_warning_s, status_code_long_fine_s);
status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
if (main->parameters.remaining.used == 0 && !(main->pipe & fll_program_data_pipe_input_e)) {
+ setting->status = F_status_set_error(F_parameter);
+
status_code_print_line_first(setting, main->error, F_true);
status_code_print_error_no_status_codes(setting, main->error);
status_code_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
-
return;
}
}
#endif
#ifndef _di_status_code_print_error_cannot_error_warning_number_
- void status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print) {
+ f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
f_file_stream_lock(print.to);
fl_print_format("%[' parameter.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
f_file_stream_unlock(print.to);
+
+ return F_none;
}
#endif // _di_status_code_print_error_cannot_error_warning_number_
#ifndef _di_status_code_print_error_no_status_codes_
- void status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print) {
+ f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
fll_print_format("%[No status code is specified.%]%r", print.to.stream, print.context, print.context, f_string_eol_s);
+
+ return F_none;
}
#endif // _di_status_code_print_error_no_status_codes_
fll_program_print_help_option(print, status_code_short_error_s, status_code_long_error_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true or F_false if status code is an error or print number with error code bit set.");
fll_program_print_help_option(print, status_code_short_number_s, status_code_long_number_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Convert status code name to number.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, status_code_program_name_s, status_code_program_help_parameters_s);
f_print_dynamic_raw(setting->line_last, print.to.stream);
#endif // _di_status_code_print_help_
#ifndef _di_status_code_print_line_first_
- void status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
if (lock) {
fll_print_dynamic_raw(setting->line_first, print.to.stream);
else {
f_print_dynamic_raw(setting->line_first, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_status_code_print_line_first_
#ifndef _di_status_code_print_line_last_
- void status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
- if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+ if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return F_output_not;
if (lock) {
fll_print_dynamic_raw(setting->line_last, print.to.stream);
else {
f_print_dynamic_raw(setting->line_last, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_status_code_print_line_last_
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_status_code_print_error_cannot_error_warning_number_
- extern void status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print);
+ extern f_status_t status_code_print_error_cannot_error_warning_number(status_code_setting_t * const setting, const fl_print_t print);
#endif // _di_status_code_print_error_cannot_error_warning_number_
/**
* This does not alter setting.status.
* @param print
* Designates the how and where to print.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_status_code_print_error_no_status_codes_
- extern void status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print);
+ extern f_status_t status_code_print_error_no_status_codes(status_code_setting_t * const setting, const fl_print_t print);
#endif // _di_status_code_print_error_no_status_codes_
/**
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_status_code_print_help_
extern f_status_t status_code_print_help(status_code_setting_t * const setting, const fl_print_t print);
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_status_code_print_line_first_
- extern void status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t status_code_print_line_first(status_code_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_status_code_print_line_first_
/**
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_status_code_print_line_last_
- extern void status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t status_code_print_line_last(status_code_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_status_code_print_line_last_
#ifdef __cplusplus
#ifndef _di_status_code_main_
void status_code_main(fll_program_data_t * const main, status_code_setting_t * const setting) {
- if (!main || !setting) {
- status_code_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_parameter, "status_code_main", F_true);
- status_code_print_line_last(setting, main->error, F_true);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (F_status_is_error(setting->status)) return;
+ if (!main || !setting || F_status_is_error(setting->status)) return;
setting->status = F_none;
if (setting->flag & status_code_main_flag_number_e) {
if (main->pipe & fll_program_data_pipe_input_e) {
- // @todo call status_code_process_number() here for all main from pipe that is space separated.
+ // @todo call status_code_process_number() here for all main from pipe that are space separated.
}
if (main->parameters.remaining.used) {
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_signal);
+ setting->status = F_status_set_error(F_interrupt);
- break;
+ return;
}
main->signal_check = 0;
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_signal);
+ setting->status = F_status_set_error(F_interrupt);
- break;
+ return;
}
main->signal_check = 0;
if (fll_program_standard_signal_received(main)) {
fll_program_print_signal_received(main->warning, setting->line_first, main->signal_received);
- setting->status = F_status_set_error(F_signal);
+ setting->status = F_status_set_error(F_interrupt);
- break;
+ return;
}
main->signal_check = 0;
f_string_dynamics_resize(0, &setting->path_files_from);
f_string_dynamics_resize(0, &setting->path_files_to);
+ f_string_dynamics_resize(0, &setting->remaining);
return F_none;
}
// Load parameters.
setting->status = f_console_parameter_process(arguments, &main->parameters);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_console_parameter_process", F_true);
+ utf8_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
{
f_array_length_t choice = 0;
if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_additional_e) {
if (main->parameters.array[utf8_parameter_to_file_e].values.used > 1) {
- utf8_print_error_parameter_file_to_too_many(main, setting);
-
setting->status = F_status_set_error(F_parameter);
+ utf8_print_error_parameter_file_to_too_many(main, setting);
+ utf8_print_line_last(setting, main->error, F_true);
+
return;
}
setting->path_files_to.used = 0;
setting->status = f_string_dynamics_increase_by(1, &setting->path_files_to);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_increase_by", F_true);
+ utf8_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
setting->path_files_to.array[setting->path_files_to.used].used = 0;
setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], &setting->path_files_to.array[0]);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true);
+ utf8_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
++setting->path_files_to.used;
setting->status = f_file_stream_open(args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_open_mode_append_s, &main->output.to);
if (F_status_is_error(setting->status)) {
+ utf8_print_line_first(setting, main->error, F_true);
fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[main->parameters.array[utf8_parameter_to_file_e].values.array[0]], f_file_operation_open_s, fll_error_file_type_file_e);
+ utf8_print_line_last(setting, main->error, F_true);
return;
}
setting->flag |= utf8_main_flag_file_to_e;
}
else {
+ utf8_print_line_first(setting, main->error, F_true);
utf8_print_error_parameter_file_name_empty(main, setting, main->parameters.array[utf8_parameter_to_file_e].values.array[0]);
+ utf8_print_line_last(setting, main->error, F_true);
setting->status = F_status_set_error(F_parameter);
}
}
else if (main->parameters.array[utf8_parameter_to_file_e].result == f_console_result_found_e) {
- utf8_print_error_no_value(main, setting, utf8_long_to_file_s);
-
setting->status = F_status_set_error(F_parameter);
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, utf8_long_to_file_s);
+ utf8_print_line_last(setting, main->error, F_true);
+
return;
}
else {
setting->path_files_from.used = 0;
setting->status = f_string_dynamics_increase_by(main->parameters.array[utf8_parameter_from_file_e].values.used, &setting->path_files_from);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamics_increase_by", F_true);
+ utf8_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
setting->path_files_from.used = main->parameters.array[utf8_parameter_from_file_e].values.used;
setting->path_files_from.array[i].used = 0;
setting->status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &setting->path_files_from.array[i]);
- if (F_status_is_error(setting->status)) return;
+
+ if (F_status_is_error(setting->status)) {
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true);
+
+ break;
+ }
if (args[index].used) {
if (f_file_exists(args[index], F_true) != F_true) {
}
} // for
- if (F_status_is_error(setting->status)) return;
+ if (F_status_is_error(setting->status)) {
+ utf8_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
setting->flag |= utf8_main_flag_file_from_e;
}
else if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_found_e) {
- utf8_print_error_no_value(main, setting, utf8_long_from_file_s);
-
setting->status = F_status_set_error(F_parameter);
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_program_print_error_parameter_missing_value(main->error, f_console_symbol_long_enable_s, utf8_long_from_file_s);
+ utf8_print_line_last(setting, main->error, F_true);
+
return;
}
else {
}
}
- if (F_status_is_error(setting->status)) return;
+ if (main->parameters.remaining.used) {
+ setting->remaining.used = 0;
+
+ setting->status = f_string_dynamics_resize(main->parameters.remaining.used, &setting->remaining);
+
+ if (F_status_is_error(setting->status)) {
+ utf8_print_line_first(setting, main->error, F_true);
+ fll_error_print(main->error, F_status_set_fine(setting->status), "f_string_dynamic_append_nulless", F_true);
+ utf8_print_line_last(setting, main->error, F_true);
+
+ return;
+ }
+
+ // Construct the array without allocating any more memory by setting this as a static string (used > 0, size = 0).
+ for (f_array_length_t index = 0; setting->remaining.used < main->parameters.remaining.used; ) {
+
+ index = main->parameters.remaining.array[setting->remaining.used];
+
+ setting->remaining.array[setting->remaining.used].string = main->parameters.arguments.array[index].string;
+ setting->remaining.array[setting->remaining.used].used = main->parameters.arguments.array[index].used;
+ setting->remaining.array[setting->remaining.used++].size = 0;
+ } // for
+ }
if (main->parameters.array[utf8_parameter_from_file_e].result == f_console_result_none_e && !((main->pipe & fll_program_data_pipe_input_e) || main->parameters.remaining.used)) {
+ setting->status = F_status_set_error(F_parameter);
+
utf8_print_error_no_from(main, setting);
+ utf8_print_line_last(setting, main->error, F_true);
- setting->status = F_status_set_error(F_parameter);
+ return;
}
if (!(setting->mode & utf8_mode_to_bytesequence_e)) {
* - codepoint: The input format is codepoint (U+XXXX or U+XXXXXX).
*
* utf8_mode_to_*_e:
- * - bytesequence: The outout format is bytesequence.
- * - codepoint: The outout format is codepoint (U+XXXX or U+XXXXXX).
- * - combining: The outout format is whether or not character is combining (may be used with "width").
- * - width: The outout format is how wide the character is (may be used with "combining").
+ * - bytesequence: The output format is bytesequence.
+ * - codepoint: The output format is codepoint (U+XXXX or U+XXXXXX).
+ * - combining: The output format is whether or not character is combining (may be used with "width").
+ * - width: The output format is how wide the character is (may be used with "combining").
*/
#ifndef _di_utf8_modes_e_
enum {
* Flags used to represent flags passed to the main function.
*
* utf8_main_flag_*_e:
- * - none: No modes in use.
- * - file_from: Using a specified source file.
- * - file_to: Using a specified destination file.
- * - help: Print help.
- * - header: Enable printing of headers.
- * - separate: Enable printing of separators.
- * - strip_invalid: Using strip invalid character mode.
- * - verify: Using verify mode.
- * - version: Print version.
+ * - none: No modes in use.
+ * - file_from: Using a specified source file.
+ * - file_to: Using a specified destination file.
+ * - header: Enable printing of headers.
+ * - help: Print help.
+ * - separate: Enable printing of separators.
+ * - strip_invalid: Using strip invalid character mode.
+ * - verify: Using verify mode.
+ * - version: Print version.
*/
#ifndef _di_utf8_main_flag_e_
enum {
*
* path_files_from: An array of all "from" file paths for when the flag utf8_main_flag_file_from_e is set.
* path_files_to: An array of all "to" file paths for when the flag utf8_main_flag_file_to_e is set.
+ * remaining: An array containing all remaining arguments passed to the program.
*/
#ifndef _di_utf8_setting_t_
typedef struct {
f_string_dynamics_t path_files_from;
f_string_dynamics_t path_files_to;
+ f_string_dynamics_t remaining;
} utf8_setting_t;
#define utf8_setting_t_initialize \
f_string_dynamic_t_initialize, \
f_string_dynamics_t_initialize, \
f_string_dynamics_t_initialize, \
+ f_string_dynamics_t_initialize, \
}
#endif // _di_utf8_setting_t_
#endif
#ifndef _di_utf8_print_bytesequence_
- void utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+ f_status_t utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, sequence, setting->append);
+
+ return F_none;
}
#endif // _di_utf8_print_bytesequence_
#ifndef _di_utf8_print_character_invalid_
- void utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid) {
+ f_status_t utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid) {
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
- if (!invalid.used) return;
+ if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
+ if (!invalid.used) return F_output_not;
if ((setting->mode & utf8_mode_to_combining_e) || (setting->mode & utf8_mode_to_width_e)) {
utf8_print_combining_or_width(main, setting, invalid);
fl_print_format("%]%r", main->output.to.stream, setting->valid_not, setting->append);
}
+
+ return F_none;
}
#endif // _di_utf8_print_character_invalid_
#ifndef _di_utf8_print_codepoint_
- void utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint) {
+ f_status_t utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint) {
if (codepoint < 0x10000) {
fl_print_format("%rU+%04_U%r", main->output.to.stream, setting->prepend, codepoint, setting->append);
else {
fl_print_format("%rU+%06_U%r", main->output.to.stream, setting->prepend, codepoint, setting->append);
}
+
+ return F_none;
}
#endif // _di_utf8_print_codepoint_
#ifndef _di_utf8_print_combining_or_width_
- void utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+ f_status_t utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
if (setting->mode & utf8_mode_to_combining_e) {
f_status_t status = f_utf_is_combining(sequence.string, sequence.used);
else if (setting->mode & utf8_mode_to_width_e) {
utf8_print_width(main, setting, sequence);
}
+
+ return F_none;
}
#endif // _di_utf8_print_combining_or_width_
#ifndef _di_utf8_print_error_combining_or_width_
- void utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting) {
+ f_status_t utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting) {
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+ if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, utf8_string_unknown_s, setting->valid_not, setting->append);
+
+ return F_none;
}
#endif // _di_utf8_print_error_combining_or_width_
#ifndef _di_utf8_print_error_decode_
- void utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid) {
+ f_status_t utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid) {
- if (main->error.verbosity == f_console_verbosity_quiet_e) return;
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+ if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+ if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
utf8_print_line_first(setting, main->error, F_false);
fl_print_format("%[%ui%]", main->error.to.stream, main->context.set.notable, F_status_set_fine(status), main->context.set.notable);
fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
}
+
+ return F_none;
}
#endif // _di_utf8_print_error_decode_
#ifndef _di_utf8_print_error_encode_
- void utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint) {
+ f_status_t utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint) {
- if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+ if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not;
utf8_print_line_first(setting, main->error, F_false);
fl_print_format("%[%ui%]", main->error.to.stream, main->context.set.notable, F_status_set_fine(status), main->context.set.notable);
fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
}
+
+ return F_none;
}
#endif // _di_utf8_print_error_encode_
#ifndef _di_utf8_print_error_no_from_
- void utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting) {
+ f_status_t utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting) {
- if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+ if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not;
utf8_print_line_first(setting, main->error, F_true);
fll_print_format("%[%QNo from sources are specified, please pipe data, designate a file, or add parameters.%]%r", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s);
- }
-#endif // _di_utf8_print_error_no_from_
-
-#ifndef _di_utf8_print_error_no_value_
- void utf8_print_error_no_value(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t parameter) {
-
- if (main->error.verbosity == f_console_verbosity_quiet_e) return;
-
- f_file_stream_lock(main->error.to);
-
- utf8_print_line_first(setting, main->error, F_false);
- fl_print_format("%[%QThe parameter '%]", main->error.to.stream, main->context.set.error, main->error.prefix, main->context.set.error);
- fl_print_format("%[%r%r%]", main->error.to.stream, main->context.set.notable, f_console_symbol_long_enable_s, parameter, main->context.set.notable);
- fl_print_format("%[' is specified, but no value was given.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
-
- f_file_stream_unlock(main->error.to);
+ return F_none;
}
-#endif // _di_utf8_print_error_no_value_
+#endif // _di_utf8_print_error_no_from_
#ifndef _di_utf8_print_error_parameter_file_name_empty_
- void utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) {
+ f_status_t utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) {
- if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+ if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not;
f_file_stream_lock(main->error.to);
fl_print_format("%[.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
f_file_stream_unlock(main->error.to);
+
+ return F_none;
}
#endif // _di_utf8_print_error_parameter_file_name_empty_
#ifndef _di_utf8_print_error_parameter_file_not_found_
- void utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name) {
+ f_status_t utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name) {
- if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+ if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not;
f_file_stream_lock(main->error.to);
fl_print_format("%['.%]%r", main->error.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
f_file_stream_unlock(main->error.to);
+
+ return F_none;
}
#endif // _di_utf8_print_error_parameter_file_not_found_
#ifndef _di_utf8_print_error_parameter_file_to_too_many_
- void utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting) {
+ f_status_t utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting) {
- if (main->error.verbosity == f_console_verbosity_quiet_e) return;
+ if (main->error.verbosity == f_console_verbosity_quiet_e) return F_output_not;
utf8_print_line_first(setting, main->error, F_true);
- fll_print_format("%[%QToo many %r files specified, there may only be one to file.%]%r", main->error.to.stream, main->context.set.error, main->error.prefix, utf8_string_to_s, main->context.set.error, f_string_eol_s);
+ fll_print_format("%[%QToo many '%r' files specified, there may only be one '%r' file.%]%r", main->error.to.stream, main->context.set.error, main->error.prefix, utf8_string_to_s, utf8_string_to_s, main->context.set.error, f_string_eol_s);
+
+ return F_none;
}
#endif // _di_utf8_print_error_parameter_file_to_too_many_
#ifndef _di_utf8_print_flush_
- void utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting) {
+ f_status_t utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting) {
- if (setting->flag & utf8_main_flag_verify_e) return;
+ if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
if (setting->status == F_interrupt) {
if (main->output.verbosity != f_console_verbosity_quiet_e) {
}
}
}
+
+ return F_none;
}
#endif // _di_utf8_print_flush_
fll_program_print_help_option(print, utf8_short_strip_invalid_s, utf8_long_strip_invalid_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Strip invalid Unicode characters (do not print invalid sequences).");
fll_program_print_help_option(print, utf8_short_verify_s, utf8_long_verify_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Only perform verification of valid sequences.");
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+ f_print_dynamic_raw(f_string_eol_s, print.to.stream);
+
fll_program_print_help_usage(print, utf8_program_name_s, utf8_program_help_parameters_s);
fl_print_format("%r The default behavior is to assume the expected input is byte sequence from the command line to be print.to to the screen as codepoints.%r%r", print.to.stream, f_string_eol_s, f_string_eol_s, f_string_eol_s);
#endif // _di_utf8_print_help_
#ifndef _di_utf8_print_line_first_
- void utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
if (lock) {
fll_print_dynamic_raw(setting->line_first, print.to.stream);
else {
f_print_dynamic_raw(setting->line_first, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_utf8_print_line_first_
#ifndef _di_utf8_print_line_last_
- void utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock) {
+ f_status_t utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock) {
- if (print.verbosity == f_console_verbosity_quiet_e) return;
- if (print.verbosity == f_console_verbosity_error_e && !F_status_is_error(setting->status)) return;
- if (setting->flag & utf8_main_flag_verify_e) return;
- if ((setting->flag & utf8_main_flag_file_to_e) && !F_status_is_error(setting->status)) return;
+ if (print.verbosity == f_console_verbosity_quiet_e) return F_output_not;
+
+ if (!F_status_is_error(setting->status)) {
+ if (print.verbosity == f_console_verbosity_error_e) return F_output_not;
+ if (setting->flag & (utf8_main_flag_verify_e | utf8_main_flag_file_to_e)) return F_output_not;
+ }
if (lock) {
fll_print_dynamic_raw(setting->line_last, print.to.stream);
else {
f_print_dynamic_raw(setting->line_last, print.to.stream);
}
+
+ return F_none;
}
#endif // _di_utf8_print_line_last_
#ifndef _di_utf8_print_raw_bytesequence_
- void utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width) {
+ f_status_t utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width) {
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+ if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
f_string_static_t character = macro_f_string_static_t_initialize(0, 0, width);
}
fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, character, setting->valid_not, setting->append);
+
+ return F_none;
}
#endif // _di_utf8_print_raw_bytesequence_
#ifndef _di_utf8_print_raw_codepoint_
- void utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw) {
+ f_status_t utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw) {
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+ if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, raw, setting->valid_not, setting->append);
+
+ return F_none;
}
#endif // _di_utf8_print_raw_codepoint_
#ifndef _di_utf8_print_raw_combining_or_width_
- void utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width) {
+ f_status_t utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width) {
- if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return;
+ if (setting->flag & (utf8_main_flag_strip_invalid_e | utf8_main_flag_verify_e)) return F_output_not;
if (setting->mode & utf8_mode_to_combining_e) {
utf8_print_error_combining_or_width(main, setting);
fl_print_format("%r%[%r%]%r", main->output.to.stream, setting->prepend, setting->valid_not, *character, setting->valid_not, setting->append);
}
+
+ return F_none;
}
#endif // _di_utf8_print_raw_combining_or_width_
#ifndef _di_utf8_print_section_header_file_
- void utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index) {
+ f_status_t utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index) {
- if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return;
- if (setting->flag & utf8_main_flag_verify_e) return;
+ if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
+ if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
- flockfile(main->output.to.stream);
+ f_file_stream_lock(main->output.to);
if ((main->pipe & fll_program_data_pipe_input_e) || index) {
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
- funlockfile(main->output.to.stream);
+ f_file_stream_unlock(main->output.to);
+
+ return F_none;
}
#endif // _di_utf8_print_section_header_file_
#ifndef _di_utf8_print_section_header_parameter_
- void utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) {
+ f_status_t utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index) {
- if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return;
- if (setting->flag & utf8_main_flag_verify_e) return;
+ if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
+ if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
- flockfile(main->output.to.stream);
+ f_file_stream_lock(main->output.to);
if ((main->pipe & fll_program_data_pipe_input_e) || (setting->flag & utf8_main_flag_file_from_e) || index) {
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
fl_print_format("%[%ul%]:%r", main->output.to.stream, main->output.set->notable, index, main->output.set->notable, f_string_eol_s);
}
- funlockfile(main->output.to.stream);
+ f_file_stream_unlock(main->output.to);
+
+ return F_none;
}
#endif // _di_utf8_print_section_header_parameter_
#ifndef _di_utf8_print_section_header_pipe_
- void utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting) {
+ f_status_t utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting) {
- if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return;
- if (setting->flag & utf8_main_flag_verify_e) return;
+ if (!(setting->flag & (utf8_main_flag_header_e | utf8_main_flag_separate_e))) return F_output_not;
+ if (setting->flag & utf8_main_flag_verify_e) return F_output_not;
- flockfile(main->output.to.stream);
+ f_file_stream_lock(main->output.to);
f_print_dynamic_raw(setting->line_first, main->output.to.stream);
fl_print_format("%[Pipe%]:%r", main->output.to.stream, main->output.set->title, main->output.set->title, f_string_eol_s);
}
- funlockfile(main->output.to.stream);
+ f_file_stream_unlock(main->output.to);
+
+ return F_none;
}
#endif // _di_utf8_print_section_header_pipe_
#ifndef _di_utf8_print_width_
- void utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
+ f_status_t utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence) {
f_status_t status = f_utf_is_wide(sequence.string, sequence.used);
if (status == F_true) {
fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_width_2_s, setting->append);
- return;
+ return F_output_not;
}
if (status == F_false) {
if (status == F_true) {
fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_width_1_s, setting->append);
- return;
+ return F_output_not;
}
if (status == F_false) {
fl_print_format("%r%r%r", main->output.to.stream, setting->prepend, utf8_string_width_0_s, setting->append);
- return;
+ return F_output_not;
}
}
utf8_print_error_combining_or_width(main, setting);
+
+ return F_none;
}
#endif // _di_utf8_print_width_
* Assumed to always be non-NULL.
* @param sequence
* A byte sequences representing a single character to print.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_bytesequence_
- extern void utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
+ extern f_status_t utf8_print_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
#endif // _di_utf8_print_bytesequence_
/**
* @param invalid
* The byte sequence string or unicode codepoint string representing a single character to print.
*
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ *
* @see utf8_print_combining_or_width()
*/
#ifndef _di_utf8_print_character_invalid_
- extern void utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid);
+ extern f_status_t utf8_print_character_invalid(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t invalid);
#endif // _di_utf8_print_character_invalid_
/**
* @param codepoint
* The codepoint to print.
* This is the code that represents a single character.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_codepoint_
- extern void utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint);
+ extern f_status_t utf8_print_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const uint32_t codepoint);
#endif // _di_utf8_print_codepoint_
/**
* A byte sequences representing a single character to print.
*
* @see utf8_print_width()
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_combining_or_width_
- extern void utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
+ extern f_status_t utf8_print_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
#endif // _di_utf8_print_combining_or_width_
/**
* The main program settings.
*
* Assumed to always be non-NULL.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_error_combining_or_width_
- extern void utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern f_status_t utf8_print_error_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting);
#endif // _di_utf8_print_error_combining_or_width_
/**
* Assumed to always be non-NULL.
* @param invalid
* The byte sequence string or unicode codepoint string representing a single character to print.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_error_decode_
- extern void utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid);
+ extern f_status_t utf8_print_error_decode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const f_string_static_t invalid);
#endif // _di_utf8_print_error_decode_
/**
* Assumed to always be non-NULL.
* @param codepoint
* The codepoint that is invalid.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_error_encode_
- extern void utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint);
+ extern f_status_t utf8_print_error_encode(fll_program_data_t * const main, utf8_setting_t * const setting, const f_status_t status, const uint32_t codepoint);
#endif // _di_utf8_print_error_encode_
/**
* The main program settings.
*
* Assumed to always be non-NULL.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_error_no_from_
- extern void utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern f_status_t utf8_print_error_no_from(fll_program_data_t * const main, utf8_setting_t * const setting);
#endif // _di_utf8_print_error_no_from_
/**
- * Print error message for when no sources are provided.
- *
- * @param main
- * The main program data.
- * @param setting
- * The main program settings.
- *
- * Assumed to always be non-NULL.
- * @param parameter
- * The long parameter name.
- */
-#ifndef _di_utf8_print_error_no_value_
- extern void utf8_print_error_no_value(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t parameter);
-#endif // _di_utf8_print_error_no_value_
-
-/**
* Print error message for when the file parameter is an empty string.
*
* @param main
* Assumed to always be non-NULL.
* @param index
* The index within the argv[] array where the empty string is found.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_error_parameter_file_name_empty_
- extern void utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index);
+ extern f_status_t utf8_print_error_parameter_file_name_empty(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index);
#endif // _di_utf8_print_error_parameter_file_name_empty_
/**
* If FALSE, then this is a to file (destination file).
* @param name
* The file path name.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_error_parameter_file_not_found_
- extern void utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name);
+ extern f_status_t utf8_print_error_parameter_file_not_found(fll_program_data_t * const main, utf8_setting_t * const setting, const bool from, const f_string_static_t name);
#endif // _di_utf8_print_error_parameter_file_not_found_
/**
* The main program settings.
*
* Assumed to always be non-NULL.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_error_parameter_file_to_too_many_
- extern void utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern f_status_t utf8_print_error_parameter_file_to_too_many(fll_program_data_t * const main, utf8_setting_t * const setting);
#endif // _di_utf8_print_error_parameter_file_to_too_many_
/**
* @param setting
* The main program settings.
* This does not alter setting.status.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_flush_
- extern void utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern f_status_t utf8_print_flush(fll_program_data_t * const main, utf8_setting_t * const setting);
#endif // _di_utf8_print_flush_
/**
*
* @return
* F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_help_
extern f_status_t utf8_print_help(utf8_setting_t * const setting, const fl_print_t print);
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_line_first_
- extern void utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t utf8_print_line_first(utf8_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_utf8_print_line_first_
/**
* @param lock
* If TRUE, then lock the stream.
* If FALSE, then do not lock or unlock the stream.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_line_last_
- extern void utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock);
+ extern f_status_t utf8_print_line_last(utf8_setting_t * const setting, const fl_print_t print, const bool lock);
#endif // _di_utf8_print_line_last_
/**
* The raw string in integer format.
* @param width
* The width the raw character represents (a value inclusively from 1 to 4).
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_raw_bytesequence_
- extern void utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width);
+ extern f_status_t utf8_print_raw_bytesequence(fll_program_data_t * const main, utf8_setting_t * const setting, const f_utf_char_t raw, const uint8_t width);
#endif // _di_utf8_print_raw_bytesequence_
/**
* Assumed to always be non-NULL.
* @param raw
* The raw string already in codepoint format.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_raw_codepoint_
- extern void utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw);
+ extern f_status_t utf8_print_raw_codepoint(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t raw);
#endif // _di_utf8_print_raw_codepoint_
/**
* @param width
* The pre-calculated width.
*
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
+ *
* @see utf8_print_width()
*/
#ifndef _di_utf8_print_raw_combining_or_width_
- extern void utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width);
+ extern f_status_t utf8_print_raw_combining_or_width(fll_program_data_t * const main, utf8_setting_t * const setting, const uint8_t width);
#endif // _di_utf8_print_raw_combining_or_width_
/**
* The name of the file.
* @param index
* The index position of the file.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_section_header_file_
- extern void utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index);
+ extern f_status_t utf8_print_section_header_file(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t name, const f_array_length_t index);
#endif // _di_utf8_print_section_header_file_
/**
* Assumed to always be non-NULL.
* @param index
* The index position of the parameter.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_section_header_parameter_
- extern void utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index);
+ extern f_status_t utf8_print_section_header_parameter(fll_program_data_t * const main, utf8_setting_t * const setting, const f_array_length_t index);
#endif // _di_utf8_print_section_header_parameter_
/**
* The main program settings.
*
* Assumed to always be non-NULL.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_section_header_pipe_
- extern void utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting);
+ extern f_status_t utf8_print_section_header_pipe(fll_program_data_t * const main, utf8_setting_t * const setting);
#endif // _di_utf8_print_section_header_pipe_
/**
* Assumed to always be non-NULL.
* @param sequence
* A byte sequences representing a single character whose width is to be printed.
+ *
+ * @return
+ * F_none on success.
+ * F_output_not on success, but no printing is performed.
*/
#ifndef _di_utf8_print_width_
- extern void utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
+ extern f_status_t utf8_print_width(fll_program_data_t * const main, utf8_setting_t * const setting, const f_string_static_t sequence);
#endif // _di_utf8_print_width_
#ifdef __cplusplus
#ifndef _di_utf8_main_
void utf8_main(fll_program_data_t * const main, utf8_setting_t * const setting) {
- if (!main || !setting) {
- utf8_print_line_first(setting, main->error, F_true);
- fll_error_print(main->error, F_parameter, "utf8_main", F_true);
- utf8_print_line_last(setting, main->error, F_true);
-
- setting->status = F_status_set_error(F_parameter);
-
- return;
- }
-
- if (F_status_is_error(setting->status)) return;
+ if (!main || !setting || F_status_is_error(setting->status)) return;
setting->status = F_none;
if (setting->flag & utf8_main_flag_header_e) {
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
- else if ((setting->flag & utf8_main_flag_separate_e) && ((setting->flag & utf8_main_flag_file_from_e) || main->parameters.remaining.used)) {
+ else if ((setting->flag & (utf8_main_flag_separate_e | utf8_main_flag_file_from_e)) || setting->remaining.used) {
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
}
}
+ // Process "from" files.
if (F_status_is_error_not(setting->status) && setting->status != F_interrupt && (setting->flag & utf8_main_flag_file_from_e)) {
- f_array_length_t i = 0;
- f_array_length_t index = 0;
-
f_file_t file = macro_f_file_t_initialize(0, -1, F_file_flag_read_only_d, 32768, F_file_default_write_size_d);
- f_string_static_t * const args = main->parameters.arguments.array;
-
- for (; i < main->parameters.array[utf8_parameter_from_file_e].values.used && setting->status != F_interrupt; ++i) {
+ for (f_array_length_t i = 0; i < setting->path_files_from.used && setting->status != F_interrupt; ++i) {
if (!((++main->signal_check) % utf8_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {
main->signal_check = 0;
}
- index = main->parameters.array[utf8_parameter_from_file_e].values.array[i];
-
- utf8_print_section_header_file(main, setting, args[index], i);
+ utf8_print_section_header_file(main, setting, setting->path_files_from.array[i], i);
- setting->status = f_file_stream_open(args[index], f_string_empty_s, &file);
+ setting->status = f_file_stream_open(setting->path_files_from.array[i], f_string_empty_s, &file);
if (F_status_is_error(setting->status)) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, args[index], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), "f_file_stream_open", F_true, setting->path_files_from.array[i], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
if (setting->flag & utf8_main_flag_header_e) {
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
- else if ((setting->flag & utf8_main_flag_separate_e) && (main->parameters.remaining.used || i + 1 < main->parameters.array[utf8_parameter_from_file_e].values.used)) {
+ else if ((setting->flag & utf8_main_flag_separate_e) && (setting->remaining.used || setting->path_files_from.used)) {
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
}
if (F_status_is_error(setting->status) && F_status_set_fine(setting->status) != F_utf_fragment && F_status_set_fine(setting->status) != F_complete_not_utf) {
- fll_error_file_print(main->error, F_status_set_fine(setting->status), setting->mode & utf8_mode_from_bytesequence_e ? "utf8_process_file_bytesequence" : "utf8_process_file_codepoint", F_true, args[index], f_file_operation_process_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(setting->status), setting->mode & utf8_mode_from_bytesequence_e ? "utf8_process_file_bytesequence" : "utf8_process_file_codepoint", F_true, setting->path_files_from.array[i], f_file_operation_process_s, fll_error_file_type_file_e);
break;
}
} // for
}
- if (F_status_is_error_not(setting->status) && setting->status != F_interrupt && main->parameters.remaining.used) {
- for (f_array_length_t i = 0; F_status_is_error_not(setting->status) && i < main->parameters.remaining.used; ++i) {
+ // Process remaining parameters.
+ if (F_status_is_error_not(setting->status) && setting->status != F_interrupt && setting->remaining.used) {
+ for (f_array_length_t i = 0; F_status_is_error_not(setting->status) && i < setting->remaining.used; ++i) {
if (!((++main->signal_check) % utf8_signal_check_d)) {
if (fll_program_standard_signal_received(main)) {