Use fewer macros.
Update documentation in regards to return codes and related functions (much more work is needed here than is currently done).
Reduce nesting where obviously possible.
Fix typos and mistakes in words for documentation, comments, and prints.
Use "(pipe)" for designating the pipe input source.
Correctly identify last file when getting file name string.
Fix naming mistakes in programs where the "_read" is missing.
Add appropriate newlines to get code more up to date with latest practices.
Update comments to start with upper case letter where noticed.
Fix ordering of functions where they were noticed to be out of order.
do {
if (objects->used == objects->size) {
- macro_f_fss_objects_t_increase(status2, F_fss_default_allocation_step_small_d, (*objects))
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, objects);
if (F_status_is_error(status2)) return status2;
- macro_f_fss_contents_t_increase(status2, F_fss_default_allocation_step_small_d, (*contents))
+ status2 = f_string_rangess_increase(F_fss_default_allocation_step_small_d, contents);
if (F_status_is_error(status2)) return status2;
if (objects_quoted) {
- macro_f_fss_quotes_t_increase(status2, F_fss_default_allocation_step_small_d, (*objects_quoted))
+ status2 = f_type_uint8s_increase(F_fss_default_allocation_step_small_d, objects_quoted);
if (F_status_is_error(status2)) return status2;
}
}
++objects_quoted->used;
}
- macro_f_fss_content_t_increase(status2, F_fss_default_allocation_step_small_d, contents->array[contents->used])
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]);
if (F_status_is_error(status2)) return status2;
++contents->used;
else if (status == F_fss_found_object_content_not) {
found_data = F_true;
- macro_f_fss_content_t_increase(status2, F_fss_default_allocation_step_small_d, contents->array[contents->used])
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]);
if (F_status_is_error(status2)) return status2;
break;
*
* Errors (with error bit) from: fl_fss_basic_content_read().
* Errors (with error bit) from: fl_fss_basic_object_read().
+ *
+ * @see fl_fss_basic_content_read()
+ * @see fl_fss_basic_object_read()
*/
#ifndef _di_fll_fss_basic_read_
extern f_status_t fll_fss_basic_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits);
* F_parameter (with error bit) if a parameter is invalid.
* F_utf (with error bit) is returned on failure to read/process a UTF-8 character.
*
+ * Errors (with error bit) from: f_string_dynamic_increase().
* Errors (with error bit) from: fl_fss_basic_content_write().
* Errors (with error bit) from: fl_fss_basic_object_write().
- * Errors (with error bit) from: f_string_dynamic_increase_by().
+ *
+ * @see f_string_dynamic_increase()
+ * @see fl_fss_basic_content_write()
+ * @see fl_fss_basic_object_write()
*/
#ifndef _di_fll_fss_basic_write_string_
extern f_status_t fll_fss_basic_write_string(const f_string_static_t object, const f_string_static_t content, const f_fss_quote_t quote, f_state_t state, f_string_dynamic_t *destination);
if (status == F_fss_found_object || status == F_fss_found_object_content_not) {
++objects->used;
- macro_f_fss_content_t_increase(status2, F_fss_default_allocation_step_small_d, contents->array[contents->used])
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]);
if (F_status_is_error(status2)) return status2;
++contents->used;
return F_none_stop;
}
- else {
- if (range->start >= buffer.used) {
- return F_data_not_eos;
- }
- return F_data_not_stop;
+ if (range->start >= buffer.used) {
+ return F_data_not_eos;
}
+
+ return F_data_not_stop;
}
if (status == F_fss_found_object) {
break;
}
- else if (status == F_fss_found_object_content_not) {
+
+ if (status == F_fss_found_object_content_not) {
found_data = F_true;
- macro_f_fss_content_t_increase(status2, F_fss_default_allocation_step_small_d, contents->array[contents->used])
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]);
if (F_status_is_error(status2)) return status2;
break;
return status;
}
- else if (status == F_data_not_eos || status == F_data_not_stop) {
+
+ if (status == F_data_not_eos || status == F_data_not_stop) {
// If at least some valid object was found, then return F_none equivalents.
if (objects->used > initial_used) {
return status;
}
- else if (status != F_fss_found_object && status != F_fss_found_content && status != F_fss_found_content_not && status != F_fss_found_object_content_not) {
+
+ if (status != F_fss_found_object && status != F_fss_found_content && status != F_fss_found_content_not && status != F_fss_found_object_content_not) {
return status;
}
- else if (range->start >= range->stop || range->start >= buffer.used) {
+
+ if (range->start >= range->stop || range->start >= buffer.used) {
// When content is found, the range->start is incremented, if content is found at range->stop, then range->start will be > range.stop.
if (status == F_fss_found_object || status == F_fss_found_content || status == F_fss_found_content_not || status == F_fss_found_object_content_not) {
* F_none on success.
* F_none_eos on success after reaching the end of the buffer.
* F_none_stop on success after reaching stopping point.
- * F_data_not_eol if there is no data to write and EOL was reached (@todo review related code and detemine what this is doing).
* F_data_not_eos no data to write due start location being greater than or equal to buffer size.
* F_data_not_stop no data to write due start location being greater than stop location.
*
*
* Errors (with error bit) from: fl_fss_basic_list_content_read().
* Errors (with error bit) from: fl_fss_basic_list_object_read().
+ *
+ * @see fl_fss_basic_list_content_read()
+ * @see fl_fss_basic_list_object_read()
*/
#ifndef _di_fll_fss_basic_list_read_
extern f_status_t fll_fss_basic_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
*
* Errors (with error bit) from: fl_fss_basic_list_content_write().
* Errors (with error bit) from: fl_fss_basic_list_object_write().
- * Errors (with error bit) from: f_string_dynamic_increase_by().
+ *
+ * @see fl_fss_basic_list_content_write()
+ * @see fl_fss_basic_list_object_write()
*/
#ifndef _di_fll_fss_basic_list_write_string_
extern f_status_t fll_fss_basic_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, f_state_t state, f_string_dynamic_t *destination);
*
* Errors (with error bit) from: fl_fss_embedded_list_content_write().
* Errors (with error bit) from: fl_fss_embedded_list_object_write().
- * Errors (with error bit) from: f_string_dynamic_increase_by().
+ *
+ * @see fl_fss_embedded_list_content_write()
+ * @see fl_fss_embedded_list_object_write()
*/
#ifndef _di_fll_fss_embedded_list_write_string_
extern f_status_t fll_fss_embedded_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_dynamic_t *destination);
do {
if (objects->used == objects->size) {
- macro_f_fss_objects_t_increase(status2, F_fss_default_allocation_step_small_d, (*objects));
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, objects);
if (F_status_is_error(status2)) return status2;
- macro_f_fss_contents_t_increase(status2, F_fss_default_allocation_step_small_d, (*contents));
+ status2 = f_string_rangess_increase(F_fss_default_allocation_step_small_d, contents);
if (F_status_is_error(status2)) return status2;
if (objects_quoted) {
- macro_f_fss_quotes_t_increase(status2, F_fss_default_allocation_step_small_d, (*objects_quoted));
+ status2 = f_type_uint8s_increase(F_fss_default_allocation_step_small_d, objects_quoted);
if (F_status_is_error(status2)) return status2;
}
++objects_quoted->used;
}
- macro_f_fss_content_t_increase(status2, F_fss_default_allocation_step_small_d, contents->array[contents->used])
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]);
if (F_status_is_error(status2)) return status2;
++contents->used;
if (contents_quoted) {
- macro_f_fss_quotes_t_increase(status2, F_fss_default_allocation_step_small_d, contents_quoted->array[contents_quoted->used])
+ status2 = f_type_uint8s_increase(F_fss_default_allocation_step_small_d, &contents_quoted->array[contents_quoted->used]);
if (F_status_is_error(status2)) return status2;
++contents_quoted->used;
found_data = F_true;
if (contents_quoted) {
- macro_f_fss_quotes_t_increase(status2, F_fss_default_allocation_step_small_d, contents_quoted->array[contents_quoted->used])
+ status2 = f_type_uint8s_increase(F_fss_default_allocation_step_small_d, &contents_quoted->array[contents_quoted->used]);
if (F_status_is_error(status2)) return status2;
quoted_content = &contents_quoted->array[contents_quoted->used];
*
* Errors (with error bit) from: fl_fss_extended_content_read().
* Errors (with error bit) from: fl_fss_extended_object_read().
+ *
+ * @see fl_fss_extended_content_read()
+ * @see fl_fss_extended_object_read()
*/
#ifndef _di_fll_fss_extended_read_
extern f_status_t fll_fss_extended_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quotes_t *objects_quoted, f_fss_quotess_t *contents_quoted, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits);
*
* Errors (with error bit) from: fl_fss_extended_content_write().
* Errors (with error bit) from: fl_fss_extended_object_write().
- * Errors (with error bit) from: f_string_dynamic_increase_by().
+ *
+ * @see fl_fss_extended_content_write()
+ * @see fl_fss_extended_object_write()
*/
#ifndef _di_fll_fss_extended_write_string_
extern f_status_t fll_fss_extended_write_string(const f_string_static_t object, const f_string_statics_t contents, const f_fss_quote_t quote, f_state_t state, f_string_dynamic_t *destination);
if (status == F_fss_found_object || status == F_fss_found_object_content_not) {
++objects->used;
- macro_f_fss_content_t_increase(status2, F_fss_default_allocation_step_small_d, contents->array[contents->used])
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]);
if (F_status_is_error(status2)) return status2;
++contents->used;
else if (status == F_fss_found_object_content_not) {
found_data = F_true;
- macro_f_fss_content_t_increase(status2, F_fss_default_allocation_step_small_d, contents->array[contents->used])
+ status2 = f_string_ranges_increase(F_fss_default_allocation_step_small_d, &contents->array[contents->used]);
if (F_status_is_error(status2)) return status2;
break;
*
* Errors (with error bit) from: fl_fss_extended_list_content_read().
* Errors (with error bit) from: fl_fss_extended_list_object_read().
+ *
+ * @see fl_fss_extended_list_content_read()
+ * @see fl_fss_extended_list_object_read()
*/
#ifndef _di_fll_fss_extended_list_read_
extern f_status_t fll_fss_extended_list_read(const f_string_static_t buffer, f_state_t state, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_delimits_t *objects_delimits, f_fss_delimits_t *contents_delimits, f_fss_comments_t *comments);
*
* Errors (with error bit) from: fl_fss_extended_list_content_write().
* Errors (with error bit) from: fl_fss_extended_list_object_write().
- * Errors (with error bit) from: f_string_dynamic_increase_by().
+ *
+ * @see fl_fss_extended_list_content_write()
+ * @see fl_fss_extended_list_object_write()
*/
#ifndef _di_fll_fss_extended_list_write_string_
extern f_status_t fll_fss_extended_list_write_string(const f_string_static_t object, const f_string_static_t content, const f_string_static_t *content_prepend, const f_string_ranges_t *ignore, f_state_t state, f_string_dynamic_t *destination);
f_print_character(f_string_eol_s[0], file.stream);
- fll_program_print_help_option(file, context, fss_basic_list_short_at_s, fss_basic_list_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
- fll_program_print_help_option(file, context, fss_basic_list_short_content_s, fss_basic_list_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
- fll_program_print_help_option(file, context, fss_basic_list_short_columns_s, fss_basic_list_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns.");
- fll_program_print_help_option(file, context, fss_basic_list_short_delimit_s, fss_basic_list_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits.");
- fll_program_print_help_option(file, context, fss_basic_list_short_depth_s, fss_basic_list_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth.");
- fll_program_print_help_option(file, context, fss_basic_list_short_empty_s, fss_basic_list_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing.");
- fll_program_print_help_option(file, context, fss_basic_list_short_line_s, fss_basic_list_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line.");
- fll_program_print_help_option(file, context, fss_basic_list_short_name_s, fss_basic_list_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
- fll_program_print_help_option(file, context, fss_basic_list_short_object_s, fss_basic_list_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
- fll_program_print_help_option(file, context, fss_basic_list_short_pipe_s, fss_basic_list_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
- fll_program_print_help_option(file, context, fss_basic_list_short_raw_s, fss_basic_list_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes.");
- fll_program_print_help_option(file, context, fss_basic_list_short_select_s, fss_basic_list_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
- fll_program_print_help_option(file, context, fss_basic_list_short_total_s, fss_basic_list_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
- fll_program_print_help_option(file, context, fss_basic_list_short_trim_s, fss_basic_list_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric index.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Content (default).");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of columns.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Designate how to handle applying delimits.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object at this numeric depth.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Include empty Content when processing.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print only the Content at the given line.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select Object with this name.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the Object.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print using the special pipe format.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_raw_s, fss_basic_list_read_long_raw_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print with the original quotes and escapes.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Select sub-Content at this index.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print the total number of lines.");
+ fll_program_print_help_option(file, context, fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Trim Object names on select or print.");
fll_program_print_help_usage(file, context, fss_basic_list_program_name_s, "filename(s)");
fl_print_format(" All numeric positions (indexes) start at 0 instead of 1.%c", file.stream, f_string_eol_s[0]);
fl_print_format(" For example, a file of 17 lines would range from 0 to 16.%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" When using the %[%s%s%] option, an order of operations is enforced on the parameters.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_depth_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" When using the %[%s%s%] option, an order of operations is enforced on the parameters.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" When this order of operations is in effect, parameters to the right of a depth parameter are influenced by that depth parameter:%c", file.stream, f_string_eol_s[0]);
- fl_print_format(" %[%s%s%]: An Object index at the specified depth.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_at_s, context.set.notable, f_string_eol_s[0]);
- fl_print_format(" %[%s%s%]: A new depth within the specified depth, indexed from the root.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_depth_s, context.set.notable, f_string_eol_s[0]);
- fl_print_format(" %[%s%s%]: An Object name at the specified depth.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_name_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object index at the specified depth.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: A new depth within the specified depth, indexed from the root.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" %[%s%s%]: An Object name at the specified depth.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" The parameter %[%s%s%] must be in numeric order, but values in between may be skipped.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_depth_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] must be in numeric order, but values in between may be skipped.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" ('-d 0 -a 1 -d 2 -a 2' would specify index 1 at depth 0, any index at depth 1, and index 2 at depth 2.)%c", file.stream, f_string_eol_s[0]);
fl_print_format(" ('-d 2 -a 1 -d 0 -a 2' would be invalid because depth 2 is before depth 1.)%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" The parameter %[%s%s%] selects a Content column.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_select_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] selects a Content column.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" Specify both %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_object_s, context.set.notable);
- fl_print_format(" and the %[%s%s%] parameters to get the total objects.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_total_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" Specify both %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object_s, context.set.notable);
+ fl_print_format(" and the %[%s%s%] parameters to get the total objects.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" When both %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_at_s, context.set.notable);
- fl_print_format(" and %[%s%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_name_s, context.set.notable);
- fl_print_format(" the %[%s%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_at_s, context.set.notable);
- fl_print_format(" %[%s%s%] parameter value.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_name_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
+ fl_print_format(" When both %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable);
+ fl_print_format(" and %[%s%s%] parameters are specified (at the same depth),", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable);
+ fl_print_format(" the %[%s%s%] parameter value will be treated as a position relative to the specified", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_at_s, context.set.notable);
+ fl_print_format(" %[%s%s%] parameter value.%c%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_name_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" This program may support parameters, such as %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_depth_s, context.set.notable);
- fl_print_format(" or %[%s%s%], even if not supported by the standard.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_select_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" This program may support parameters, such as %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable);
+ fl_print_format(" or %[%s%s%], even if not supported by the standard.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" This is done to help ensure consistency for scripting.%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" For parameters like %[%s%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_depth_s, context.set.notable);
+ fl_print_format(" For parameters like %[%s%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_depth_s, context.set.notable);
fl_print_format(" if the standard doesn't support nested Content, then only a depth of 0 would be valid.%c", file.stream, f_string_eol_s[0]);
- fl_print_format(" For parameters like %[%s%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_select_s, context.set.notable);
+ fl_print_format(" For parameters like %[%s%s%],", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable);
fl_print_format(" if the standard doesn't support multiple Content groups, then only a select of 0 would be valid.%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" The parameter %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_trim_s, context.set.notable);
+ fl_print_format(" The parameter %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_trim_s, context.set.notable);
fl_print_format(" will remove leading and trailing whitespaces when selecting objects or when printing objects.%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" When specifying both the %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_object_s, context.set.notable);
- fl_print_format(" parameter and the %[%s%s%] parameter, the entire Object and Content are printed, including the formatting.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_content_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" When specifying both the %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_object_s, context.set.notable);
+ fl_print_format(" parameter and the %[%s%s%] parameter, the entire Object and Content are printed, including the formatting.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_content_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" Both the Object and Content printed are already escaped.%c", file.stream, f_string_eol_s[0]);
fl_print_format(" Both the Object and Content are separated by an EOL.%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" The parameter %[%s%s%] accepts the following:%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_delimit_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" The parameter %[%s%s%] accepts the following:%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" - %[%s%]: Do not apply delimits.%c", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" - %[%s%]: (default) Apply all delimits.%c", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" - %[%s%]: Apply delimits for Objects.%c", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_object_s, context.set.notable, f_string_eol_s[0]);
fl_print_format(" - A number, 0 or greater, followed by a %[%s%]: (such as '1+') apply delimits for Content at the specified depth and any greater depth (numerically).%c", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_greater_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
fl_print_format(" - A number, 0 or lesser, followed by a %[%s%]: (such as '1-') apply delimits for Content at the specified depth and any lesser depth (numerically).%c%c", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_lesser_s, context.set.notable, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_delimit_s, context.set.notable, f_string_eol_s[0]);
+ fl_print_format(" The %[%s%s%] parameter may be specified multiple times to customize the delimit behavior.%c", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable, f_string_eol_s[0]);
- fl_print_format(" The %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_delimit_s, context.set.notable);
+ fl_print_format(" The %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_delimit_s, context.set.notable);
fl_print_format(" values %[%s%]", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_none_s, context.set.notable);
fl_print_format(" and %[%s%],", file.stream, context.set.notable, fss_basic_list_read_delimit_mode_name_all_s, context.set.notable);
fl_print_format(" overrule all other delimit values.%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
- fl_print_format(" The parameters %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_columns_s, context.set.notable);
- fl_print_format(" and %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_long_select_s, context.set.notable);
+ fl_print_format(" The parameters %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, context.set.notable);
+ fl_print_format(" and %[%s%s%]", file.stream, context.set.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_select_s, context.set.notable);
fl_print_format(" refer to a Content column.%c", file.stream, f_string_eol_s[0]);
fl_print_format(" The word \"column\" is being loosely defined to refer to a specific Content.%c", file.stream, f_string_eol_s[0]);
fl_print_format(" This is not to be confused with a depth.%c%c", file.stream, f_string_eol_s[0], f_string_eol_s[0]);
fss_basic_list_read_print_help(main->output.to, main->context);
fss_basic_list_read_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_basic_list_program_version_s);
fss_basic_list_read_main_delete(main);
+
return status;
}
data.files.array = files_array;
data.files.used = 1;
data.files.size = main->remaining.used + 1;
+ data.files.array[0].name = "(pipe)";
+ data.files.array[0].range.start = 1;
+ data.files.array[0].range.stop = 0;
if (main->remaining.used || main->process_pipe) {
{
};
const f_string_t parameter_name[] = {
- fss_basic_list_long_at_s,
- fss_basic_list_long_depth_s,
- fss_basic_list_long_line_s,
- fss_basic_list_long_select_s,
- fss_basic_list_long_name_s,
- fss_basic_list_long_delimit_s,
+ fss_basic_list_read_long_at_s,
+ fss_basic_list_read_long_depth_s,
+ fss_basic_list_read_long_line_s,
+ fss_basic_list_read_long_select_s,
+ fss_basic_list_read_long_name_s,
+ fss_basic_list_read_long_delimit_s,
};
const f_string_t message_positive_number = "positive number";
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
} // for
};
const f_string_t parameter_name[] = {
- fss_basic_list_long_depth_s,
- fss_basic_list_long_line_s,
- fss_basic_list_long_pipe_s,
- fss_basic_list_long_select_s,
- fss_basic_list_long_total_s,
+ fss_basic_list_read_long_depth_s,
+ fss_basic_list_read_long_line_s,
+ fss_basic_list_read_long_pipe_s,
+ fss_basic_list_read_long_select_s,
+ fss_basic_list_read_long_total_s,
};
const uint8_t parameter_match[] = {
flockfile(main->error.to.stream);
fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_columns_s, main->error.notable);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_columns_s, main->error.notable);
fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, parameter_name[i], main->error.notable);
fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
} // for
flockfile(main->error.to.stream);
fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_pipe_s, main->error.notable);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, main->error.notable);
fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_total_s, main->error.notable);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_total_s, main->error.notable);
fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
funlockfile(main->error.to.stream);
flockfile(main->error.to.stream);
fl_print_format("%c%[%sCannot specify the '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_pipe_s, main->error.notable);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_pipe_s, main->error.notable);
fl_print_format("%[' parameter with the '%]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_line_s, main->error.notable);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_read_long_line_s, main->error.notable);
fl_print_format("%[' parameter.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
funlockfile(main->error.to.stream);
if (!((++signal_check) % fss_basic_list_read_signal_check_d)) {
if (fss_basic_list_read_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
flockfile(main->error.to.stream);
fl_print_format("%c%[%sThe value for the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_delimit_s, main->error.notable);
+ fl_print_format("%[%s%s%]", 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.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
else if (fl_string_compare(arguments->argv[location], fss_basic_list_read_delimit_mode_name_none_s, length, fss_basic_list_read_delimit_mode_name_none_s_length) == F_equal_to) {
status = fl_conversion_string_to_number_unsigned(arguments->argv[location], range, &data.delimit_depth);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_long_delimit_s, arguments->argv[location]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_delimit_s, arguments->argv[location]);
break;
}
flockfile(main->error.to.stream);
fl_print_format("%c%[%sThe '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_select_s, main->error.notable);
+ fl_print_format("%[%s%s%]", 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.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
funlockfile(main->error.to.stream);
file.id = F_type_descriptor_input_d;
file.stream = F_type_input_d;
- data.files.array[0].name = 0;
data.files.array[0].range.start = 0;
status = f_file_stream_read(file, &data.buffer);
if (!((++signal_check) % fss_basic_list_read_signal_check_d)) {
if (fss_basic_list_read_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
#ifndef _di_fss_basic_list_read_defines_
#define fss_basic_list_read_signal_check_d 10000
- #define fss_basic_list_pipe_content_end_s '\f'
- #define fss_basic_list_pipe_content_ignore_s '\v'
- #define fss_basic_list_pipe_content_start_s '\b'
-
- #define fss_basic_list_short_at_s "a"
- #define fss_basic_list_short_content_s "c"
- #define fss_basic_list_short_columns_s "C"
- #define fss_basic_list_short_delimit_s "D"
- #define fss_basic_list_short_depth_s "d"
- #define fss_basic_list_short_empty_s "e"
- #define fss_basic_list_short_line_s "l"
- #define fss_basic_list_short_name_s "n"
- #define fss_basic_list_short_object_s "o"
- #define fss_basic_list_short_pipe_s "p"
- #define fss_basic_list_short_raw_s "R"
- #define fss_basic_list_short_select_s "s"
- #define fss_basic_list_short_total_s "t"
- #define fss_basic_list_short_trim_s "T"
-
- #define fss_basic_list_long_at_s "at"
- #define fss_basic_list_long_content_s "content"
- #define fss_basic_list_long_columns_s "columns"
- #define fss_basic_list_long_delimit_s "delimit"
- #define fss_basic_list_long_depth_s "depth"
- #define fss_basic_list_long_empty_s "empty"
- #define fss_basic_list_long_line_s "line"
- #define fss_basic_list_long_name_s "name"
- #define fss_basic_list_long_object_s "object"
- #define fss_basic_list_long_pipe_s "pipe"
- #define fss_basic_list_long_raw_s "raw"
- #define fss_basic_list_long_select_s "select"
- #define fss_basic_list_long_total_s "total"
- #define fss_basic_list_long_trim_s "trim"
+ #define fss_basic_list_read_pipe_content_end_s '\f'
+ #define fss_basic_list_read_pipe_content_ignore_s '\v'
+ #define fss_basic_list_read_pipe_content_start_s '\b'
+
+ #define fss_basic_list_read_short_at_s "a"
+ #define fss_basic_list_read_short_content_s "c"
+ #define fss_basic_list_read_short_columns_s "C"
+ #define fss_basic_list_read_short_delimit_s "D"
+ #define fss_basic_list_read_short_depth_s "d"
+ #define fss_basic_list_read_short_empty_s "e"
+ #define fss_basic_list_read_short_line_s "l"
+ #define fss_basic_list_read_short_name_s "n"
+ #define fss_basic_list_read_short_object_s "o"
+ #define fss_basic_list_read_short_pipe_s "p"
+ #define fss_basic_list_read_short_raw_s "R"
+ #define fss_basic_list_read_short_select_s "s"
+ #define fss_basic_list_read_short_total_s "t"
+ #define fss_basic_list_read_short_trim_s "T"
+
+ #define fss_basic_list_read_long_at_s "at"
+ #define fss_basic_list_read_long_content_s "content"
+ #define fss_basic_list_read_long_columns_s "columns"
+ #define fss_basic_list_read_long_delimit_s "delimit"
+ #define fss_basic_list_read_long_depth_s "depth"
+ #define fss_basic_list_read_long_empty_s "empty"
+ #define fss_basic_list_read_long_line_s "line"
+ #define fss_basic_list_read_long_name_s "name"
+ #define fss_basic_list_read_long_object_s "object"
+ #define fss_basic_list_read_long_pipe_s "pipe"
+ #define fss_basic_list_read_long_raw_s "raw"
+ #define fss_basic_list_read_long_select_s "select"
+ #define fss_basic_list_read_long_total_s "total"
+ #define fss_basic_list_read_long_trim_s "trim"
enum {
fss_basic_list_read_parameter_help_e,
f_console_parameter_t_initialize(f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, 0, 0, f_console_type_inverse_e), \
f_console_parameter_t_initialize(f_console_standard_short_debug_s, f_console_standard_long_debug_s, 0, 0, f_console_type_inverse_e), \
f_console_parameter_t_initialize(f_console_standard_short_version_s, f_console_standard_long_version_s, 0, 0, f_console_type_inverse_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_at_s, fss_basic_list_long_at_s, 0, 1, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_content_s, fss_basic_list_long_content_s, 0, 0, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_columns_s, fss_basic_list_long_columns_s, 0, 0, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_delimit_s, fss_basic_list_long_delimit_s, 0, 1, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_depth_s, fss_basic_list_long_depth_s, 0, 1, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_empty_s, fss_basic_list_long_empty_s, 0, 0, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_line_s, fss_basic_list_long_line_s, 0, 1, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_name_s, fss_basic_list_long_name_s, 0, 1, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_object_s, fss_basic_list_long_object_s, 0, 0, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_pipe_s, fss_basic_list_long_pipe_s, 0, 0, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_raw_s, fss_basic_list_long_raw_s, 0, 0, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_select_s, fss_basic_list_long_select_s, 0, 1, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_total_s, fss_basic_list_long_total_s, 0, 0, f_console_type_normal_e), \
- f_console_parameter_t_initialize(fss_basic_list_short_trim_s, fss_basic_list_long_trim_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_at_s, fss_basic_list_read_long_at_s, 0, 1, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_content_s, fss_basic_list_read_long_content_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_columns_s, fss_basic_list_read_long_columns_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_delimit_s, fss_basic_list_read_long_delimit_s, 0, 1, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_depth_s, fss_basic_list_read_long_depth_s, 0, 1, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_empty_s, fss_basic_list_read_long_empty_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_line_s, fss_basic_list_read_long_line_s, 0, 1, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_name_s, fss_basic_list_read_long_name_s, 0, 1, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_object_s, fss_basic_list_read_long_object_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_pipe_s, fss_basic_list_read_long_pipe_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_raw_s, fss_basic_list_read_long_raw_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_select_s, fss_basic_list_read_long_select_s, 0, 1, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_total_s, fss_basic_list_read_long_total_s, 0, 0, f_console_type_normal_e), \
+ f_console_parameter_t_initialize(fss_basic_list_read_short_trim_s, fss_basic_list_read_long_trim_s, 0, 0, f_console_type_normal_e), \
}
#define fss_basic_list_total_parameters_d 23
status = fl_conversion_string_to_number_unsigned(arguments->argv[position_depth], range, &data->depths.array[i].depth);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_long_depth_s, arguments->argv[position_depth]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_depth_s, arguments->argv[position_depth]);
return status;
}
status = fl_conversion_string_to_number_unsigned(arguments->argv[data->depths.array[i].index_at], range, &data->depths.array[i].value_at);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_long_at_s, arguments->argv[data->depths.array[i].index_at]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_basic_list_read_long_at_s, arguments->argv[data->depths.array[i].index_at]);
return status;
}
fl_print_format("%c%[%sThe value '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
fl_print_format("%[' may only be specified once for the parameter '%]", main->error.to.stream, main->error.context, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_depth_s, main->error.notable);
+ fl_print_format("%[%s%s%]", 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("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
funlockfile(main->error.to.stream);
flockfile(main->error.to.stream);
fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
- fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_basic_list_long_depth_s, main->error.notable);
+ fl_print_format("%[%s%s%]", 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("%[' may not have the value '%]", main->error.to.stream, main->error.context, main->error.context);
fl_print_format("%[%ul%]", main->error.to.stream, main->error.notable, data->depths.array[i].depth, main->error.notable);
fl_print_format("%[' before the value '%]", main->error.to.stream, main->error.context, main->error.context);
}
} // for
+ // When stopped after the end of the buffer, the last file in the list is the correct file.
+ if (at > files.array[files.used - 1].range.stop) {
+ return files.array[files.used - 1].name;
+ }
+
return "";
}
#endif // _di_fss_basic_list_read_file_identify_
if (F_status_is_error(status)) {
const f_string_t file_name = fss_basic_list_read_file_identify(input.start, data->files);
- fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, file_name, "process", fll_error_file_type_file_e);
return status;
}
- else if (status == F_data_not_stop || status == F_data_not_eos) {
+
+ if (status == F_data_not_stop || status == F_data_not_eos) {
if (data->option & fss_basic_list_read_data_option_total_d) {
flockfile(main->output.to.stream);
void fss_basic_list_read_print_content_ignore(fss_basic_list_read_main_t * const main) {
if (main->parameters[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) {
- f_print_character(fss_basic_list_pipe_content_ignore_s, main->output.to.stream);
+ f_print_character(fss_basic_list_read_pipe_content_ignore_s, main->output.to.stream);
}
}
#endif // _di_fss_basic_list_read_print_content_ignore_
void fss_basic_list_read_print_object_end(fss_basic_list_read_main_t * const main) {
if (main->parameters[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) {
- f_print_character(fss_basic_list_pipe_content_start_s, main->output.to.stream);
+ f_print_character(fss_basic_list_read_pipe_content_start_s, main->output.to.stream);
}
else {
if (main->parameters[fss_basic_list_read_parameter_content_e].result == f_console_result_found_e) {
void fss_basic_list_read_print_set_end(fss_basic_list_read_main_t * const main) {
if (main->parameters[fss_basic_list_read_parameter_pipe_e].result == f_console_result_found_e) {
- f_print_character(fss_basic_list_pipe_content_end_s, main->output.to.stream);
+ f_print_character(fss_basic_list_read_pipe_content_end_s, main->output.to.stream);
}
}
#endif // _di_fss_basic_list_read_print_set_end_
#ifndef _di_fss_basic_list_read_print_one_
void fss_basic_list_read_print_one(fss_basic_list_read_main_t * const main) {
+
f_print_character(f_string_ascii_1_s[0], main->output.to.stream);
f_print_character(f_string_eol_s[0], main->output.to.stream);
}
#ifndef _di_fss_basic_list_read_print_zero_
void fss_basic_list_read_print_zero(fss_basic_list_read_main_t * const main) {
+
f_print_character(f_string_ascii_0_s[0], main->output.to.stream);
f_print_character(f_string_eol_s[0], main->output.to.stream);
}
}
#endif // _di_fss_basic_list_read_process_at_
-#ifndef _di_fss_basic_list_read_process_columns_
- f_status_t fss_basic_list_read_process_columns(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) {
-
- if (!(data->option & fss_basic_list_read_data_option_content_d)) {
- flockfile(main->output.to.stream);
-
- fss_basic_list_read_print_zero(main);
-
- funlockfile(main->output.to.stream);
-
- return F_none;
- }
-
- f_array_length_t max = 0;
- uint16_t signal_check = 0;
-
- for (f_array_length_t at = 0; at < data->contents.used; ++at) {
-
- if (!names[at]) continue;
-
- if (!((++signal_check) % fss_basic_list_read_signal_check_d)) {
- if (fss_basic_list_read_signal_received(main)) {
- return F_status_set_error(F_interrupt);
- }
-
- signal_check = 0;
- }
-
- if (data->contents.array[at].used > max) {
- max = data->contents.array[at].used;
- }
- } // for
-
- fll_print_format("%ul%c", main->output.to.stream, max, f_string_eol_s[0]);
-
- return F_none;
- }
-#endif // _di_fss_basic_list_read_process_columns_
-
#ifndef _di_fss_basic_list_read_process_at_line_
f_status_t fss_basic_list_read_process_at_line(fss_basic_list_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_basic_list_read_data_t *data, f_array_length_t *line) {
}
#endif // _di_fss_basic_list_read_process_at_line_
+#ifndef _di_fss_basic_list_read_process_columns_
+ f_status_t fss_basic_list_read_process_columns(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) {
+
+ if (!(data->option & fss_basic_list_read_data_option_content_d)) {
+ flockfile(main->output.to.stream);
+
+ fss_basic_list_read_print_zero(main);
+
+ funlockfile(main->output.to.stream);
+
+ return F_none;
+ }
+
+ f_array_length_t max = 0;
+ uint16_t signal_check = 0;
+
+ for (f_array_length_t at = 0; at < data->contents.used; ++at) {
+
+ if (!names[at]) continue;
+
+ if (!((++signal_check) % fss_basic_list_read_signal_check_d)) {
+ if (fss_basic_list_read_signal_received(main)) {
+ return F_status_set_error(F_interrupt);
+ }
+
+ signal_check = 0;
+ }
+
+ if (data->contents.array[at].used > max) {
+ max = data->contents.array[at].used;
+ }
+ } // for
+
+ fll_print_format("%ul%c", main->output.to.stream, max, f_string_eol_s[0]);
+
+ return F_none;
+ }
+#endif // _di_fss_basic_list_read_process_columns_
+
#ifndef _di_fss_basic_list_read_process_line_
f_status_t fss_basic_list_read_process_line(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) {
if (main->parameters[fss_basic_list_read_parameter_line_e].result == f_console_result_additional_e) {
data->option |= fss_basic_list_read_data_option_line_d;
- status = fss_basic_list_read_load_number(main, fss_basic_list_read_parameter_line_e, fss_basic_list_long_line_s, arguments, &data->line);
+ status = fss_basic_list_read_load_number(main, fss_basic_list_read_parameter_line_e, fss_basic_list_read_long_line_s, arguments, &data->line);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_basic_list_read_parameter_select_e].result == f_console_result_additional_e) {
data->option |= fss_basic_list_read_data_option_select_d;
- status = fss_basic_list_read_load_number(main, fss_basic_list_read_parameter_select_e, fss_basic_list_long_select_s, arguments, &data->select);
+ status = fss_basic_list_read_load_number(main, fss_basic_list_read_parameter_select_e, fss_basic_list_read_long_select_s, arguments, &data->select);
if (F_status_is_error(status)) return status;
}
#endif // _di_fss_basic_list_read_print_zero_
/**
- * Perform the basic read processing on the buffer.
+ * Perform the basic list read processing on the buffer.
*
* This will print an error message on error.
*
#endif // _di_fss_basic_list_read_process_at_
/**
- * Process based on columns parameter.
- *
- * @param main
- * The main program data.
- * @param data
- * The program data.
- * @param names
- * An array of booleans representing whether or not some Object name is to be used.
- * (If TRUE, then the name is to be used and if FALSE, then the name is not to be used.)
- *
- * @return
- * F_none on success.
- */
-#ifndef _di_fss_basic_list_read_process_columns_
- extern f_status_t fss_basic_list_read_process_columns(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d;
-#endif // _di_fss_basic_list_read_process_columns_
-
-/**
* Process based on at parameter for some line.
*
* @param main
#endif // _di_fss_basic_list_read_process_at_line_
/**
+ * Process based on columns parameter.
+ *
+ * @param main
+ * The main program data.
+ * @param data
+ * The program data.
+ * @param names
+ * An array of booleans representing whether or not some Object name is to be used.
+ * (If TRUE, then the name is to be used and if FALSE, then the name is not to be used.)
+ *
+ * @return
+ * F_none on success.
+ */
+#ifndef _di_fss_basic_list_read_process_columns_
+ extern f_status_t fss_basic_list_read_process_columns(fss_basic_list_read_main_t * const main, fss_basic_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d;
+#endif // _di_fss_basic_list_read_process_columns_
+
+/**
* Process based on line parameter.
*
* @param main
f_print_character(f_string_eol_s[0], file.stream);
- fll_program_print_help_option(file, context, fss_basic_list_write_short_file_s, fss_basic_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send file to.");
+ fll_program_print_help_option(file, context, fss_basic_list_write_short_file_s, fss_basic_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to.");
fll_program_print_help_option(file, context, fss_basic_list_write_short_content_s, fss_basic_list_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file.");
fll_program_print_help_option(file, context, fss_basic_list_write_short_double_s, fss_basic_list_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default).");
fll_program_print_help_option(file, context, fss_basic_list_write_short_ignore_s, fss_basic_list_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content.");
if (F_status_is_error(status)) {
fss_basic_list_write_main_delete(main);
+
return F_status_set_error(status);
}
}
if (F_status_is_error(status)) {
fss_basic_list_write_main_delete(main);
+
return status;
}
fss_basic_list_write_print_help(main->output.to, main->context);
fss_basic_list_write_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_basic_list_write_program_version_s);
fss_basic_list_write_main_delete(main);
+
return status;
}
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
if (fss_basic_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (fss_basic_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (fss_basic_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
}
else if (main->error.verbosity != f_console_verbosity_quiet_e && main->parameters[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_character(f_string_eol_s[0], main->error.to.stream);
+ // Ensure there is always a newline at the end, unless in quiet mode.
+ fll_print_character(f_string_eol_s[0], main->output.to.stream);
}
}
macro_f_string_dynamic_t_delete_simple(escaped);
- // object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
+ // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
object.string = 0;
object.used = 0;
object.size = 0;
}
}
- // ensure a newline is always put at the end of the program execution, unless in quiet mode.
+ // 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 (F_status_is_error(status)) {
fll_print_character(f_string_eol_s[0], main->error.to.stream);
fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true);
status_pipe = F_status_set_error(F_pipe);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
break;
}
}
if (block.string[range.start] == fss_basic_list_write_pipe_content_start_s) {
state = 0x2;
++range.start;
+
break;
}
if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s) {
state = 0x3;
++range.start;
+
break;
}
if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s) {
- // this is not used by objects.
+
+ // This is not used by objects.
continue;
}
if (F_status_is_error(status)) break;
- // if the start of content was not found, then fetch the next block.
+ // If the start of content was not found, then fetch the next block.
if (state == 0x1) continue;
- // if the end of the current block is reached, fetch the next block.
+ // If the end of the current block is reached, fetch the next block.
if (range.start > range.stop) continue;
}
}
if (total) {
- if (content.used + total > content.size) {
- status = f_string_dynamic_increase_by(total, &content);
+ status = f_string_dynamic_increase_by(total, &content);
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
- break;
- }
+ if (F_status_is_error(status)) {
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+ break;
}
for (; range.start <= range.stop; ++range.start) {
}
status = F_status_set_error(F_supported_not);
+
break;
}
if (block.string[range.start] == fss_basic_list_write_pipe_content_end_s) {
state = 0x3;
++range.start;
+
break;
}
if (block.string[range.start] == fss_basic_list_write_pipe_content_ignore_s) {
- // this is not used by this program.
+
+ // This is not used by this program.
continue;
}
}
} // for
- // if the pipe ended before finishing, then attempt to wrap up.
+ // If the pipe ended before finishing, then attempt to wrap up.
if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) {
status = fss_basic_list_write_process(main, output, quote, &object, &content, buffer);
}
fss_basic_read_print_help(main->output.to, main->context);
fss_basic_read_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_basic_read_program_version_s);
fss_basic_read_main_delete(main);
+
return status;
}
data.files.array = files_array;
data.files.used = 1;
data.files.size = main->remaining.used + 1;
+ data.files.array[0].name = "(pipe)";
+ data.files.array[0].range.start = 1;
+ data.files.array[0].range.stop = 0;
if (main->remaining.used || main->process_pipe) {
{
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
} // for
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
} // for
if (fss_basic_read_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
else if (fl_string_compare(arguments->argv[location], fss_basic_read_delimit_mode_name_none_s, length, fss_basic_read_delimit_mode_name_none_s_length) == F_equal_to) {
file.id = F_type_descriptor_input_d;
file.stream = F_type_input_d;
- data.files.array[0].name = 0;
data.files.array[0].range.start = 0;
status = f_file_stream_read(file, &data.buffer);
break;
}
- else if (data.buffer.used > data.files.array[data.files.used].range.start) {
+
+ if (data.buffer.used > data.files.array[data.files.used].range.start) {
data.files.array[data.files.used].name = arguments->argv[main->remaining.array[i]];
data.files.array[data.files.used++].range.stop = data.buffer.used - 1;
* delimits: The positions within the buffer representing character delimits.
*/
#ifndef _di_fss_basic_read_data_t_
- #define fss_basic_read_data_option_at 0x1
- #define fss_basic_read_data_option_columns 0x2
- #define fss_basic_read_data_option_content 0x4
- #define fss_basic_read_data_option_empty 0x8
- #define fss_basic_read_data_option_line 0x10
- #define fss_basic_read_data_option_name 0x20
- #define fss_basic_read_data_option_object 0x40
- #define fss_basic_read_data_option_raw 0x80
- #define fss_basic_read_data_option_select 0x100
- #define fss_basic_read_data_option_total 0x200
- #define fss_basic_read_data_option_trim 0x400
+ #define fss_basic_read_data_option_at_d 0x1
+ #define fss_basic_read_data_option_columns_d 0x2
+ #define fss_basic_read_data_option_content_d 0x4
+ #define fss_basic_read_data_option_empty_d 0x8
+ #define fss_basic_read_data_option_line_d 0x10
+ #define fss_basic_read_data_option_name_d 0x20
+ #define fss_basic_read_data_option_object_d 0x40
+ #define fss_basic_read_data_option_raw_d 0x80
+ #define fss_basic_read_data_option_select_d 0x100
+ #define fss_basic_read_data_option_total_d 0x200
+ #define fss_basic_read_data_option_trim_d 0x400
typedef struct {
uint16_t option;
return F_status_set_error(F_parameter);
}
- else if (data->depths.array[i].depth > data->depths.array[j].depth) {
+
+ 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);
}
} // for
+ // When stopped after the end of the buffer, the last file in the list is the correct file.
+ if (at > files.array[files.used - 1].range.stop) {
+ return files.array[files.used - 1].name;
+ }
+
return "";
}
#endif // _di_fss_basic_read_file_identify_
if (F_status_is_error(status)) {
const f_string_t file_name = fss_basic_read_file_identify(input.start, data->files);
- fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_basic_read", F_true, file_name, "process", fll_error_file_type_file_e);
return status;
}
- else if (status == F_data_not_stop || status == F_data_not_eos) {
- if (data->option & fss_basic_read_data_option_total) {
+
+ if (status == F_data_not_stop || status == F_data_not_eos) {
+ if (data->option & fss_basic_read_data_option_total_d) {
fss_basic_read_print_zero(main);
return F_none;
return;
}
- if ((data->option & fss_basic_read_data_option_object) || (data->option & fss_basic_read_data_option_content) && (data->contents.array[at].used || (data->option & fss_basic_read_data_option_empty))) {
+ if ((data->option & fss_basic_read_data_option_object_d) || (data->option & fss_basic_read_data_option_content_d) && (data->contents.array[at].used || (data->option & fss_basic_read_data_option_empty_d))) {
flockfile(main->output.to.stream);
- if (data->option & fss_basic_read_data_option_object) {
- if (data->option & fss_basic_read_data_option_trim) {
- if (data->option & fss_basic_read_data_option_raw) {
+ if (data->option & fss_basic_read_data_option_object_d) {
+ if (data->option & fss_basic_read_data_option_trim_d) {
+ if (data->option & fss_basic_read_data_option_raw_d) {
if (data->quotes.array[at]) {
f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
}
else {
- if (data->option & fss_basic_read_data_option_raw) {
+ if (data->option & fss_basic_read_data_option_raw_d) {
if (data->quotes.array[at]) {
f_print_character_safely(data->quotes.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
}
- if (data->option & fss_basic_read_data_option_content) {
+ if (data->option & fss_basic_read_data_option_content_d) {
fss_basic_read_print_object_end(main);
}
}
- if ((data->option & fss_basic_read_data_option_content) && data->contents.array[at].used) {
- if (data->option & fss_basic_read_data_option_raw) {
+ if ((data->option & fss_basic_read_data_option_content_d) && data->contents.array[at].used) {
+ if (data->option & fss_basic_read_data_option_raw_d) {
f_print_dynamic_partial(data->buffer, data->contents.array[at].array[0], main->output.to.stream);
}
else {
#ifndef _di_fss_basic_read_print_one_
void fss_basic_read_print_one(fss_basic_read_main_t * const main) {
+
f_print_character(f_string_ascii_1_s[0], main->output.to.stream);
f_print_character(f_string_eol_s[0], main->output.to.stream);
}
#ifndef _di_fss_basic_read_print_zero_
void fss_basic_read_print_zero(fss_basic_read_main_t * const main) {
+
f_print_character(f_string_ascii_0_s[0], main->output.to.stream);
f_print_character(f_string_eol_s[0], main->output.to.stream);
}
if (F_status_is_error(status)) return status;
// This standard does not support multiple content groups.
- if ((data->option & fss_basic_read_data_option_select) && data->select) {
+ if ((data->option & fss_basic_read_data_option_select_d) && data->select) {
if (main->parameters[fss_basic_read_parameter_total_e].result == f_console_result_found_e) {
flockfile(main->output.to.stream);
return fss_basic_read_process_at(main, data, names);
}
- if (data->option & fss_basic_read_data_option_columns) {
+ if (data->option & fss_basic_read_data_option_columns_d) {
return fss_basic_read_process_columns(main, data, names);
}
- if (data->option & fss_basic_read_data_option_total) {
+ if (data->option & fss_basic_read_data_option_total_d) {
return fss_basic_read_process_total(main, data, names);
}
- if (data->option & fss_basic_read_data_option_line) {
+ if (data->option & fss_basic_read_data_option_line_d) {
return fss_basic_read_process_line(main, data, names);
}
f_status_t fss_basic_read_process_at(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) {
if (data->depths.array[0].value_at >= data->objects.used) {
- if (data->option & (fss_basic_read_data_option_columns | fss_basic_read_data_option_total)) {
+ if (data->option & (fss_basic_read_data_option_columns_d | fss_basic_read_data_option_total_d)) {
flockfile(main->output.to.stream);
fss_basic_read_print_zero(main);
}
// This standard only has one line per Content; therefore, any line value greater than 0 equates to no line to print.
- if (data->option & fss_basic_read_data_option_line) {
+ if (data->option & fss_basic_read_data_option_line_d) {
if (data->line) {
- if (data->option & fss_basic_read_data_option_total) {
+ if (data->option & fss_basic_read_data_option_total_d) {
flockfile(main->output.to.stream);
fss_basic_read_print_zero(main);
}
if (at == data->depths.array[0].value_at) {
- if (data->option & fss_basic_read_data_option_line) {
+ if (data->option & fss_basic_read_data_option_line_d) {
// This standard only supports one line per Object so when using "--at", the only valid line is line 0.
if (data->line) break;
- if (data->option & fss_basic_read_data_option_total) {
+ if (data->option & fss_basic_read_data_option_total_d) {
flockfile(main->output.to.stream);
fss_basic_read_print_one(main);
fss_basic_read_print_at(main, i, *delimits, except_none, data);
}
}
- else if (data->option & fss_basic_read_data_option_columns) {
+ else if (data->option & fss_basic_read_data_option_columns_d) {
fll_print_format("%ul%c", main->output.to.stream, data->contents.array[i].used, f_string_eol_s[0]);
}
- else if (data->option & fss_basic_read_data_option_total) {
+ else if (data->option & fss_basic_read_data_option_total_d) {
flockfile(main->output.to.stream);
if (data->contents.array[i].used) {
++at;
} // for
- if (data->option & fss_basic_read_data_option_total) {
+ if (data->option & fss_basic_read_data_option_total_d) {
flockfile(main->output.to.stream);
fss_basic_read_print_zero(main);
#ifndef _di_fss_basic_read_process_columns_
f_status_t fss_basic_read_process_columns(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) {
- if (!(data->option & fss_basic_read_data_option_content)) {
+ if (!(data->option & fss_basic_read_data_option_content_d)) {
flockfile(main->output.to.stream);
fss_basic_read_print_zero(main);
return F_status_set_error(F_interrupt);
}
- if (!(data->option & fss_basic_read_data_option_object) && (data->option & fss_basic_read_data_option_content)) {
+ if (!(data->option & fss_basic_read_data_option_object_d) && (data->option & fss_basic_read_data_option_content_d)) {
if (!data->contents.array[i].used) {
- if (data->option & fss_basic_read_data_option_empty) {
+ if (data->option & fss_basic_read_data_option_empty_d) {
if (line == data->line) {
flockfile(main->output.to.stream);
memset(names, F_false, sizeof(bool) * data->objects.used);
- if (data->option & fss_basic_read_data_option_trim) {
+ if (data->option & fss_basic_read_data_option_trim_d) {
for (i = 0; i < data->objects.used; ++i) {
if (fl_string_dynamic_partial_compare_except_trim_dynamic(data->depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, data->delimits) == F_equal_to) {
f_status_t status = F_none;
if (main->parameters[fss_basic_read_parameter_at_e].result == f_console_result_additional_e) {
- data->option |= fss_basic_read_data_option_at;
+ data->option |= fss_basic_read_data_option_at_d;
}
if (main->parameters[fss_basic_read_parameter_columns_e].result == f_console_result_found_e) {
- data->option |= fss_basic_read_data_option_columns;
+ data->option |= fss_basic_read_data_option_columns_d;
}
if (main->parameters[fss_basic_read_parameter_content_e].result == f_console_result_found_e) {
- data->option |= fss_basic_read_data_option_content;
+ data->option |= fss_basic_read_data_option_content_d;
}
if (main->parameters[fss_basic_read_parameter_empty_e].result == f_console_result_found_e) {
- data->option |= fss_basic_read_data_option_empty;
+ data->option |= fss_basic_read_data_option_empty_d;
}
if (main->parameters[fss_basic_read_parameter_line_e].result == f_console_result_additional_e) {
- data->option |= fss_basic_read_data_option_line;
+ data->option |= fss_basic_read_data_option_line_d;
status = fss_basic_read_load_number(main, fss_basic_read_parameter_line_e, fss_basic_read_long_line_s, arguments, &data->line);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_basic_read_parameter_name_e].result == f_console_result_additional_e) {
- data->option |= fss_basic_read_data_option_name;
+ data->option |= fss_basic_read_data_option_name_d;
}
if (main->parameters[fss_basic_read_parameter_object_e].result == f_console_result_found_e) {
- data->option |= fss_basic_read_data_option_object;
+ data->option |= fss_basic_read_data_option_object_d;
}
if (main->parameters[fss_basic_read_parameter_raw_e].result == f_console_result_found_e) {
- data->option |= fss_basic_read_data_option_raw;
+ data->option |= fss_basic_read_data_option_raw_d;
}
if (main->parameters[fss_basic_read_parameter_select_e].result == f_console_result_additional_e) {
- data->option |= fss_basic_read_data_option_select;
+ data->option |= fss_basic_read_data_option_select_d;
status = fss_basic_read_load_number(main, fss_basic_read_parameter_select_e, fss_basic_read_long_select_s, arguments, &data->select);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_basic_read_parameter_total_e].result == f_console_result_found_e) {
- data->option |= fss_basic_read_data_option_total;
+ data->option |= fss_basic_read_data_option_total_d;
}
if (main->parameters[fss_basic_read_parameter_trim_e].result == f_console_result_found_e) {
- data->option |= fss_basic_read_data_option_trim;
+ data->option |= fss_basic_read_data_option_trim_d;
}
// Default to content if neither Object nor Content is explicitly requested.
- if (!(data->option & (fss_basic_read_data_option_content | fss_basic_read_data_option_object))) {
- data->option |= fss_basic_read_data_option_content;
+ if (!(data->option & (fss_basic_read_data_option_content_d | fss_basic_read_data_option_object_d))) {
+ data->option |= fss_basic_read_data_option_content_d;
}
return F_none;
return F_status_set_error(F_interrupt);
}
- if (!(data->option & fss_basic_read_data_option_object) && data->option & fss_basic_read_data_option_content) {
- if (!(data->contents.array[i].used || (data->option & fss_basic_read_data_option_empty))) {
+ if (!(data->option & fss_basic_read_data_option_object_d) && data->option & fss_basic_read_data_option_content_d) {
+ if (!(data->contents.array[i].used || (data->option & fss_basic_read_data_option_empty_d))) {
continue;
}
}
flockfile(main->output.to.stream);
- if (data->option & fss_basic_read_data_option_line) {
+ if (data->option & fss_basic_read_data_option_line_d) {
if (data->line < total) {
fss_basic_read_print_one(main);
}
f_print_character(f_string_eol_s[0], file.stream);
- fll_program_print_help_option(file, context, fss_basic_write_short_file_s, fss_basic_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send file to.");
+ fll_program_print_help_option(file, context, fss_basic_write_short_file_s, fss_basic_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to.");
fll_program_print_help_option(file, context, fss_basic_write_short_content_s, fss_basic_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file.");
fll_program_print_help_option(file, context, fss_basic_write_short_double_s, fss_basic_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default).");
fll_program_print_help_option(file, context, fss_basic_write_short_ignore_s, fss_basic_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content.");
if (F_status_is_error(status)) {
fss_basic_write_main_delete(main);
+
return F_status_set_error(status);
}
}
if (F_status_is_error(status)) {
fss_basic_write_main_delete(main);
+
return status;
}
fss_basic_write_print_help(main->output.to, main->context);
fss_basic_write_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_basic_write_program_version_s);
fss_basic_write_main_delete(main);
+
return status;
}
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
if (fss_basic_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (fss_basic_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
}
else if (main->error.verbosity != f_console_verbosity_quiet_e && main->parameters[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_character(f_string_eol_s[0], main->error.to.stream);
+ // Ensure there is always a newline at the end, unless in quiet mode.
+ fll_print_character(f_string_eol_s[0], main->output.to.stream);
}
}
macro_f_string_dynamic_t_delete_simple(escaped);
- // object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
+ // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
object.string = 0;
object.used = 0;
object.size = 0;
}
}
- // ensure a newline is always put at the end of the program execution, unless in quiet mode.
+ // 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 (F_status_is_error(status)) {
fll_print_character(f_string_eol_s[0], main->error.to.stream);
fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true);
status_pipe = F_status_set_error(F_pipe);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
break;
}
}
if (block.string[range.start] == fss_basic_write_pipe_content_start_s) {
state = 0x2;
++range.start;
+
break;
}
if (block.string[range.start] == fss_basic_write_pipe_content_end_s) {
state = 0x3;
++range.start;
+
break;
}
if (block.string[range.start] == fss_basic_write_pipe_content_ignore_s) {
- // this is not used by objects.
+
+ // This is not used by objects.
continue;
}
if (F_status_is_error(status)) break;
- // if the start of content was not found, then fetch the next block.
+ // If the start of content was not found, then fetch the next block.
if (state == 0x1) continue;
- // if the end of the current block is reached, fetch the next block.
+ // If the end of the current block is reached, fetch the next block.
if (range.start > range.stop) continue;
}
}
if (total) {
- if (content.used + total > content.size) {
- status = f_string_dynamic_increase_by(total, &content);
+ status = f_string_dynamic_increase_by(total, &content);
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
- break;
- }
+ if (F_status_is_error(status)) {
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
+ break;
}
for (; range.start <= range.stop; ++range.start) {
}
status = F_status_set_error(F_supported_not);
+
break;
}
if (block.string[range.start] == fss_basic_write_pipe_content_end_s) {
state = 0x3;
++range.start;
+
break;
}
if (block.string[range.start] == fss_basic_write_pipe_content_ignore_s) {
- // this is not used by this program.
+
+ // This is not used by this program.
continue;
}
}
} // for
- // if the pipe ended before finishing, then attempt to wrap up.
+ // If the pipe ended before finishing, then attempt to wrap up.
if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) {
status = fss_basic_write_process(main, output, quote, &object, &content, buffer);
}
#ifndef _di_fss_embedded_list_read_main_
f_status_t fss_embedded_list_read_main(fss_embedded_list_read_main_t * const main, const f_console_arguments_t *arguments) {
+
f_status_t status = F_none;
{
if (F_status_is_error(status)) {
fss_embedded_list_read_main_delete(main);
+
return status;
}
fss_embedded_list_read_print_help(main->output.to, main->context);
fss_embedded_list_read_main_delete(main);
+
return F_none;
}
fll_program_print_version(main->output.to, fss_embedded_list_read_program_version_s);
fss_embedded_list_read_main_delete(main);
+
return F_none;
}
if (F_status_is_error(status)) {
fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, arguments->argv[main->remaining.array[i]], "open", fll_error_file_type_file_e);
+
break;
}
fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e);
f_file_stream_close(F_true, &file);
+
break;
}
}
f_file_stream_close(F_true, &file);
+
continue;
}
}
if (F_status_is_error(status)) {
fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e);
+
break;
}
if (F_status_is_error(status)) {
fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, arguments->argv[main->remaining.array[i]], "read", fll_error_file_type_file_e);
+
break;
}
f_array_length_t i = 0;
f_array_length_t j = 0;
- // determine the linear order in which all of the three parameter values are to be applied.
+ // Determine the linear order in which all of the three parameter values are to be applied.
if (values_total) {
memset(values_order, 0, values_total);
values_order[k] = main->parameters[fss_embedded_list_read_parameter_at_e].values.array[j];
values_type[k] = fss_embedded_list_read_parameter_at_e;
i++;
+
break;
}
} // for
values_order[k] = main->parameters[fss_embedded_list_read_parameter_name_e].values.array[j];
values_type[k] = fss_embedded_list_read_parameter_name_e;
i++;
+
break;
}
} // for
f_array_length_t i = 0;
f_array_length_t j = 0;
- // comments are not to be part of the file, so remove them.
+ // Comments are not to be part of the file, so remove them.
for (; i < comments->used; ++i) {
+
for (j = comments->array[i].start; j <= comments->array[i].stop; ++j) {
main->buffer.string[j] = F_fss_delimit_placeholder_s;
} // for
bool skip[items->used];
- // setup defaults to be not skipped unless any given parent is skipped.
+ // Setup defaults to be not skipped unless any given parent is skipped.
memset(skip, F_false, sizeof(skip) * items->used);
if (parents.used) {
}
}
- // if the current depth is not the final depth, then recurse into the next depth.
+ // If the current depth is not the final depth, then recurse into the next depth.
if (depths_index + 1 < depths.used) {
bool skip_next[main->nest.depth[depths.array[depths_index + 1].depth - 1].used];
return fss_embedded_list_read_main_process_for_depth(main, arguments, filename, depths, depths_index + 1, line, parents_next, objects_delimits, contents_delimits);
}
- // process objects.
+ // Process objects.
f_array_length_t i = 0;
f_array_length_t j = 0;
return F_none;
}
- // process contents.
+ // Process contents.
bool include_empty = 0;
if (main->parameters[fss_embedded_list_read_parameter_empty_e].result == f_console_result_found_e) {
if (include_empty) {
if (line_current == line) {
fss_embedded_list_read_print_set_end(main);
+
break;
}
if (line_current == line) {
++j;
+
break;
}
}
if (main->buffer.string[j] == f_string_eol_s[0]) {
f_print_character(f_string_eol_s[0], main->output.to.stream);
+
break;
}
if (main->delimit_mode == fss_embedded_list_read_delimit_mode_none_e) {
objects_delimits->used = 0;
contents_delimits->used = 0;
+
return;
}
if (main->delimit_depth >= main->nest.used) {
objects_delimits->used = 0;
contents_delimits->used = 0;
+
return;
}
}
if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_e) {
- // only depth 0 objects are stored in objects_delimits.
+ // Only depth 0 objects are stored in objects_delimits.
if (main->delimit_depth) {
fss_embedded_list_read_process_delimits_objects(main, main->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
}
fss_embedded_list_read_process_delimits_contents(main, main->delimit_depth, original_contents_delimits, original_contents_used, contents_delimits);
}
else {
-
if (main->delimit_mode == fss_embedded_list_read_delimit_mode_depth_lesser_e) {
// only depth 0 objects are stored in objects_delimits.
f_print_character(f_string_eol_s[0], file.stream);
- fll_program_print_help_option(file, context, fss_embedded_list_write_short_file_s, fss_embedded_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send file to.");
+ fll_program_print_help_option(file, context, fss_embedded_list_write_short_file_s, fss_embedded_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to.");
fll_program_print_help_option(file, context, fss_embedded_list_write_short_content_s, fss_embedded_list_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file.");
fll_program_print_help_option(file, context, fss_embedded_list_write_short_double_s, fss_embedded_list_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default).");
fll_program_print_help_option(file, context, fss_embedded_list_write_short_ignore_s, fss_embedded_list_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content.");
#ifndef _di_fss_embedded_list_write_main_
f_status_t fss_embedded_list_write_main(fss_embedded_list_write_main_t * const main, const f_console_arguments_t *arguments) {
+
f_status_t status = F_none;
{
if (F_status_is_error(status)) {
fss_embedded_list_write_main_delete(main);
+
return F_status_set_error(status);
}
}
if (F_status_is_error(status)) {
fss_embedded_list_write_main_delete(main);
+
return status;
}
fss_embedded_list_write_print_help(main->output.to, main->context);
fss_embedded_list_write_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_embedded_list_write_program_version_s);
fss_embedded_list_write_main_delete(main);
+
return status;
}
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
if (fss_embedded_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (fss_embedded_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (fss_embedded_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
}
else if (main->error.verbosity != f_console_verbosity_quiet_e && main->parameters[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_character(f_string_eol_s[0], main->error.to.stream);
+ // Ensure there is always a newline at the end, unless in quiet mode.
+ fll_print_character(f_string_eol_s[0], main->output.to.stream);
}
}
macro_f_string_dynamic_t_delete_simple(escaped);
macro_f_string_ranges_t_delete_simple(ignore);
- // object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
+ // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
object.string = 0;
object.used = 0;
object.size = 0;
}
}
- // ensure a newline is always put at the end of the program execution, unless in quiet mode.
+ // 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 (F_status_is_error(status)) {
fll_print_character(f_string_eol_s[0], main->error.to.stream);
fll_print_dynamic(*buffer, output.stream);
buffer->used = 0;
+
return status;
}
#endif // _di_fss_embedded_list_write_process_
fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true);
status_pipe = F_status_set_error(F_pipe);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
break;
}
}
if (block.string[range.start] == fss_embedded_list_write_pipe_content_start_s) {
state = 0x2;
++range.start;
+
break;
}
if (block.string[range.start] == fss_embedded_list_write_pipe_content_end_s) {
state = 0x3;
++range.start;
+
break;
}
if (F_status_is_error(status)) break;
- // if the start of content was not found, then fetch the next block.
+ // If the start of content was not found, then fetch the next block.
if (state == 0x1) continue;
- // if the end of the current block is reached, fetch the next block.
+ // If the end of the current block is reached, fetch the next block.
if (range.start > range.stop) continue;
}
}
if (total) {
- if (content.used + total > content.size) {
- status = f_string_dynamic_increase_by(total, &content);
+ status = f_string_dynamic_increase_by(total, &content);
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
- break;
- }
+ if (F_status_is_error(status)) {
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
+ break;
}
for (; range.start <= range.stop; ++range.start) {
}
status = F_status_set_error(F_supported_not);
+
break;
}
if (block.string[range.start] == fss_embedded_list_write_pipe_content_end_s) {
state = 0x3;
++range.start;
+
break;
}
fll_error_print(main->error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true);
status = F_status_set_error(F_string_too_large);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_string_too_large, "fss_embedded_list_write_process_pipe", F_true);
+
break;
}
}
}
} // for
- // if the pipe ended before finishing, then attempt to wrap up.
+ // If the pipe ended before finishing, then attempt to wrap up.
if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) {
status = fss_embedded_list_write_process(main, output, quote, &object, &content, ignore, buffer);
}
macro_f_string_dynamic_t_delete_simple(block);
macro_f_string_dynamic_t_delete_simple(object);
macro_f_string_dynamic_t_delete_simple(content);
+
return status;
}
#endif // _di_fss_embedded_list_write_process_pipe_
if (ignore->size + F_fss_default_allocation_step_d > F_array_length_t_size_d) {
if (ignore->size + 1 > F_array_length_t_size_d) {
fll_error_print(main->error, F_string_too_large, "fss_embedded_list_write_process_parameter_ignore", F_true);
+
return F_status_set_error(F_string_too_large);
}
if (F_status_is_error(status)) {
fss_extended_list_read_main_delete(main);
+
return F_status_set_error(status);
}
}
if (F_status_is_error(status)) {
fss_extended_list_read_main_delete(main);
+
return status;
}
fss_extended_list_read_print_help(main->output.to, main->context);
fss_extended_list_read_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_extended_list_read_program_version_s);
fss_extended_list_read_main_delete(main);
+
return status;
}
data.files.array = files_array;
data.files.used = 1;
data.files.size = main->remaining.used + 1;
+ data.files.array[0].name = "(pipe)";
+ data.files.array[0].range.start = 1;
+ data.files.array[0].range.stop = 0;
if (main->remaining.used || main->process_pipe) {
{
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
} // for
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
} // for
if (fss_extended_list_read_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
else if (fl_string_compare(arguments->argv[location], fss_extended_list_read_delimit_mode_name_none_s, length, fss_extended_list_read_delimit_mode_name_none_s_length) == F_equal_to) {
file.id = F_type_descriptor_input_d;
file.stream = F_type_input_d;
- data.files.array[0].name = 0;
data.files.array[0].range.start = 0;
status = f_file_stream_read(file, &data.buffer);
if (fss_extended_list_read_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
* delimits_content: The positions within the buffer representing Content character delimits.
*/
#ifndef _di_fss_extended_list_read_data_t_
- #define fss_extended_list_read_data_option_at 0x1
- #define fss_extended_list_read_data_option_columns 0x2
- #define fss_extended_list_read_data_option_content 0x4
- #define fss_extended_list_read_data_option_empty 0x8
- #define fss_extended_list_read_data_option_line 0x10
- #define fss_extended_list_read_data_option_name 0x20
- #define fss_extended_list_read_data_option_object 0x40
- #define fss_extended_list_read_data_option_raw 0x80
- #define fss_extended_list_read_data_option_select 0x100
- #define fss_extended_list_read_data_option_total 0x200
- #define fss_extended_list_read_data_option_trim 0x400
+ #define fss_extended_list_read_data_option_at_d 0x1
+ #define fss_extended_list_read_data_option_columns_d 0x2
+ #define fss_extended_list_read_data_option_content_d 0x4
+ #define fss_extended_list_read_data_option_empty_d 0x8
+ #define fss_extended_list_read_data_option_line_d 0x10
+ #define fss_extended_list_read_data_option_name_d 0x20
+ #define fss_extended_list_read_data_option_object_d 0x40
+ #define fss_extended_list_read_data_option_raw_d 0x80
+ #define fss_extended_list_read_data_option_select_d 0x100
+ #define fss_extended_list_read_data_option_total_d 0x200
+ #define fss_extended_list_read_data_option_trim_d 0x400
typedef struct {
uint16_t option;
}
} // for
+ // When stopped after the end of the buffer, the last file in the list is the correct file.
+ if (at > files.array[files.used - 1].range.stop) {
+ return files.array[files.used - 1].name;
+ }
+
return "";
}
#endif // _di_fss_extended_list_read_file_identify_
if (F_status_is_error(status)) {
const f_string_t file_name = fss_extended_list_read_file_identify(input.start, data->files);
- fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_extended_list_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_extended_list_read", F_true, file_name, "process", fll_error_file_type_file_e);
return status;
}
- else if (status == F_data_not_stop || status == F_data_not_eos) {
- if (data->option & fss_extended_list_read_data_option_total) {
+
+ if (status == F_data_not_stop || status == F_data_not_eos) {
+ if (data->option & fss_extended_list_read_data_option_total_d) {
fss_extended_list_read_print_zero(main);
return F_none;
return;
}
- if ((data->option & fss_extended_list_read_data_option_object) || ((data->option & fss_extended_list_read_data_option_content) && (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop || (data->option & fss_extended_list_read_data_option_empty)))) {
+ if ((data->option & fss_extended_list_read_data_option_object_d) || ((data->option & fss_extended_list_read_data_option_content_d) && (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop || (data->option & fss_extended_list_read_data_option_empty_d)))) {
flockfile(main->output.to.stream);
- if (data->option & fss_extended_list_read_data_option_object) {
- if (data->option & fss_extended_list_read_data_option_trim) {
+ if (data->option & fss_extended_list_read_data_option_object_d) {
+ if (data->option & fss_extended_list_read_data_option_trim_d) {
fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
}
else {
fss_extended_list_read_print_object_end(main, data);
}
- if (data->option & fss_extended_list_read_data_option_content) {
+ if (data->option & fss_extended_list_read_data_option_content_d) {
if (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop) {
if (data->contents.array[at].used && data->contents.array[at].array[0].start <= data->contents.array[at].array[0].stop) {
fss_extended_list_read_print_content_ignore(main);
return;
}
- if (data->option & fss_extended_list_read_data_option_trim) {
+ if (data->option & fss_extended_list_read_data_option_trim_d) {
fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
}
else {
f_print_character(fss_extended_list_read_pipe_content_start, main->output.to.stream);
}
else {
- if ((data->option & fss_extended_list_read_data_option_object) && (data->option & fss_extended_list_read_data_option_content)) {
+ if ((data->option & fss_extended_list_read_data_option_object_d) && (data->option & fss_extended_list_read_data_option_content_d)) {
f_print_character(f_fss_extended_list_open_s[0], main->output.to.stream);
f_print_character(f_fss_extended_list_open_end_s[0], main->output.to.stream);
}
f_print_character(fss_extended_list_read_pipe_content_end, main->output.to.stream);
}
else {
- if (data->option & fss_extended_list_read_data_option_object) {
- if (data->option & fss_extended_list_read_data_option_content) {
+ if (data->option & fss_extended_list_read_data_option_object_d) {
+ if (data->option & fss_extended_list_read_data_option_content_d) {
f_print_character(f_fss_extended_list_close_s[0], main->output.to.stream);
f_print_character(f_fss_extended_list_close_end_s[0], main->output.to.stream);
}
- else if (!(data->option & fss_extended_list_read_data_option_content)) {
+ else if (!(data->option & fss_extended_list_read_data_option_content_d)) {
f_print_character(f_fss_eol_s[0], main->output.to.stream);
}
}
#ifndef _di_fss_extended_list_read_print_one_
void fss_extended_list_read_print_one(fss_extended_list_read_main_t * const main) {
+
f_print_character(f_string_ascii_1_s[0], main->output.to.stream);
f_print_character(f_string_eol_s[0], main->output.to.stream);
}
#ifndef _di_fss_extended_list_read_print_zero_
void fss_extended_list_read_print_zero(fss_extended_list_read_main_t * const main) {
+
f_print_character(f_string_ascii_0_s[0], main->output.to.stream);
f_print_character(f_string_eol_s[0], main->output.to.stream);
}
if (F_status_is_error(status)) return status;
// This standard does not support multiple content groups.
- if ((data->option & fss_extended_list_read_data_option_select) && data->select) {
+ if ((data->option & fss_extended_list_read_data_option_select_d) && data->select) {
if (main->parameters[fss_extended_list_read_parameter_total_e].result == f_console_result_found_e) {
fss_extended_list_read_print_zero(main);
}
return fss_extended_list_read_process_at(main, data, names);
}
- if (data->option & fss_extended_list_read_data_option_columns) {
+ if (data->option & fss_extended_list_read_data_option_columns_d) {
return fss_extended_list_read_process_columns(main, data, names);
}
- if (data->option & fss_extended_list_read_data_option_total) {
+ if (data->option & fss_extended_list_read_data_option_total_d) {
return fss_extended_list_read_process_total(main, data, names);
}
- if (data->option & fss_extended_list_read_data_option_line) {
+ if (data->option & fss_extended_list_read_data_option_line_d) {
return fss_extended_list_read_process_line(main, data, names);
}
f_array_lengths_t *delimits_object = fss_extended_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
- if (data->option & fss_extended_list_read_data_option_raw) {
+ if (data->option & fss_extended_list_read_data_option_raw_d) {
delimits_object = &except_none;
delimits_content = &except_none;
}
f_status_t fss_extended_list_read_process_at(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) {
if (data->depths.array[0].value_at >= data->objects.used) {
- if (data->option & (fss_extended_list_read_data_option_columns | fss_extended_list_read_data_option_total)) {
+ if (data->option & (fss_extended_list_read_data_option_columns_d | fss_extended_list_read_data_option_total_d)) {
flockfile(main->output.to.stream);
fss_extended_list_read_print_zero(main);
f_array_lengths_t *delimits_object = fss_extended_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
- if (data->option & fss_extended_list_read_data_option_raw) {
+ if (data->option & fss_extended_list_read_data_option_raw_d) {
delimits_object = &except_none;
delimits_content = &except_none;
}
if (!names[i]) continue;
if (at == data->depths.array[0].value_at) {
- if (data->option & fss_extended_list_read_data_option_line) {
+ if (data->option & fss_extended_list_read_data_option_line_d) {
f_array_length_t line = 0;
status = fss_extended_list_read_process_at_line(main, i, *delimits_object, *delimits_content, data, &line);
if (status == F_success) return F_none;
}
- else if (data->option & fss_extended_list_read_data_option_columns) {
+ else if (data->option & fss_extended_list_read_data_option_columns_d) {
fll_print_format("%ul%c", main->output.to.stream, data->contents.array[i].used, f_string_eol_s[0]);
}
- else if (data->option & fss_extended_list_read_data_option_total) {
- if ((data->option & fss_extended_list_read_data_option_object) && !(data->option & fss_extended_list_read_data_option_content)) {
+ else if (data->option & fss_extended_list_read_data_option_total_d) {
+ if ((data->option & fss_extended_list_read_data_option_object_d) && !(data->option & fss_extended_list_read_data_option_content_d)) {
flockfile(main->output.to.stream);
if (data->contents.array[i].used) {
for (; j < data->contents.array[i].used; ++j) {
if (data->contents.array[i].array[0].start > data->contents.array[i].array[0].stop) {
- if (data->option & fss_extended_list_read_data_option_object) {
+ if (data->option & fss_extended_list_read_data_option_object_d) {
total += 2;
}
}
else {
- if (data->option & fss_extended_list_read_data_option_object) {
+ if (data->option & fss_extended_list_read_data_option_object_d) {
total += 2;
}
++at;
} // for
- if (data->option & fss_extended_list_read_data_option_total) {
+ if (data->option & fss_extended_list_read_data_option_total_d) {
flockfile(main->output.to.stream);
fss_extended_list_read_print_zero(main);
}
#endif // _di_fss_extended_list_read_process_at_
-#ifndef _di_fss_extended_list_read_process_columns_
- f_status_t fss_extended_list_read_process_columns(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) {
-
- if (!(data->option & fss_extended_list_read_data_option_content)) {
- flockfile(main->output.to.stream);
-
- fss_extended_list_read_print_zero(main);
-
- funlockfile(main->output.to.stream);
-
- return F_none;
- }
-
- f_array_length_t max = 0;
-
- for (f_array_length_t at = 0; at < data->contents.used; ++at) {
-
- if (!names[at]) continue;
-
- if (data->contents.array[at].used > max) {
- max = data->contents.array[at].used;
- }
- } // for
-
- fll_print_format("%ul%c", main->output.to.stream, max, f_string_eol_s[0]);
-
- return F_none;
- }
-#endif // _di_fss_extended_list_read_process_columns_
-
#ifndef _di_fss_extended_list_read_process_at_line_
f_status_t fss_extended_list_read_process_at_line(fss_extended_list_read_main_t * const main, const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_extended_list_read_data_t *data, f_array_length_t *line) {
- if (data->option & fss_extended_list_read_data_option_object) {
+ if (data->option & fss_extended_list_read_data_option_object_d) {
if (*line == data->line) {
flockfile(main->output.to.stream);
- if (data->option & fss_extended_list_read_data_option_total) {
+ if (data->option & fss_extended_list_read_data_option_total_d) {
fss_extended_list_read_print_one(main);
}
else {
}
// There is only a single Content column for this standard.
- if (data->option & fss_extended_list_read_data_option_content) {
+ if (data->option & fss_extended_list_read_data_option_content_d) {
if (!data->contents.array[at].used) {
return F_none;
}
flockfile(main->output.to.stream);
- if (data->option & fss_extended_list_read_data_option_total) {
+ if (data->option & fss_extended_list_read_data_option_total_d) {
fss_extended_list_read_print_one(main);
}
else {
if (*line == data->line) {
flockfile(main->output.to.stream);
- if (data->option & fss_extended_list_read_data_option_total) {
+ if (data->option & fss_extended_list_read_data_option_total_d) {
fss_extended_list_read_print_one(main);
}
else {
}
#endif // _di_fss_extended_list_read_process_at_line_
+#ifndef _di_fss_extended_list_read_process_columns_
+ f_status_t fss_extended_list_read_process_columns(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) {
+
+ if (!(data->option & fss_extended_list_read_data_option_content_d)) {
+ flockfile(main->output.to.stream);
+
+ fss_extended_list_read_print_zero(main);
+
+ funlockfile(main->output.to.stream);
+
+ return F_none;
+ }
+
+ f_array_length_t max = 0;
+
+ for (f_array_length_t at = 0; at < data->contents.used; ++at) {
+
+ if (!names[at]) continue;
+
+ if (data->contents.array[at].used > max) {
+ max = data->contents.array[at].used;
+ }
+ } // for
+
+ fll_print_format("%ul%c", main->output.to.stream, max, f_string_eol_s[0]);
+
+ return F_none;
+ }
+#endif // _di_fss_extended_list_read_process_columns_
+
#ifndef _di_fss_extended_list_read_process_line_
f_status_t fss_extended_list_read_process_line(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) {
f_array_lengths_t *delimits_object = fss_extended_list_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
f_array_lengths_t *delimits_content = fss_extended_list_read_delimit_content_is(0, data) ? &data->delimits_content : &except_none;
- if (data->option & fss_extended_list_read_data_option_raw) {
+ if (data->option & fss_extended_list_read_data_option_raw_d) {
delimits_object = &except_none;
delimits_content = &except_none;
}
f_status_t status = F_none;
if (main->parameters[fss_extended_list_read_parameter_at_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_list_read_data_option_at;
+ data->option |= fss_extended_list_read_data_option_at_d;
}
if (main->parameters[fss_extended_list_read_parameter_columns_e].result == f_console_result_found_e) {
- data->option |= fss_extended_list_read_data_option_columns;
+ data->option |= fss_extended_list_read_data_option_columns_d;
}
if (main->parameters[fss_extended_list_read_parameter_content_e].result == f_console_result_found_e) {
- data->option |= fss_extended_list_read_data_option_content;
+ data->option |= fss_extended_list_read_data_option_content_d;
}
if (main->parameters[fss_extended_list_read_parameter_empty_e].result == f_console_result_found_e) {
- data->option |= fss_extended_list_read_data_option_empty;
+ data->option |= fss_extended_list_read_data_option_empty_d;
}
if (main->parameters[fss_extended_list_read_parameter_line_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_list_read_data_option_line;
+ data->option |= fss_extended_list_read_data_option_line_d;
status = fss_extended_list_read_load_number(main, fss_extended_list_read_parameter_line_e, fss_extended_list_read_long_line_s, arguments, &data->line);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_extended_list_read_parameter_name_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_list_read_data_option_name;
+ data->option |= fss_extended_list_read_data_option_name_d;
}
if (main->parameters[fss_extended_list_read_parameter_object_e].result == f_console_result_found_e) {
- data->option |= fss_extended_list_read_data_option_object;
+ data->option |= fss_extended_list_read_data_option_object_d;
}
if (main->parameters[fss_extended_list_read_parameter_raw_e].result == f_console_result_found_e) {
- data->option |= fss_extended_list_read_data_option_raw;
+ data->option |= fss_extended_list_read_data_option_raw_d;
}
if (main->parameters[fss_extended_list_read_parameter_select_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_list_read_data_option_select;
+ data->option |= fss_extended_list_read_data_option_select_d;
status = fss_extended_list_read_load_number(main, fss_extended_list_read_parameter_select_e, fss_extended_list_read_long_select_s, arguments, &data->select);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_extended_list_read_parameter_total_e].result == f_console_result_found_e) {
- data->option |= fss_extended_list_read_data_option_total;
+ data->option |= fss_extended_list_read_data_option_total_d;
}
if (main->parameters[fss_extended_list_read_parameter_trim_e].result == f_console_result_found_e) {
- data->option |= fss_extended_list_read_data_option_trim;
+ data->option |= fss_extended_list_read_data_option_trim_d;
}
// Default to content if neither Object nor Content is explicitly requested.
- if (!(data->option & (fss_extended_list_read_data_option_content | fss_extended_list_read_data_option_object))) {
- data->option |= fss_extended_list_read_data_option_content;
+ if (!(data->option & (fss_extended_list_read_data_option_content_d | fss_extended_list_read_data_option_object_d))) {
+ data->option |= fss_extended_list_read_data_option_content_d;
}
return F_none;
if (!names[at]) continue;
- if (data->option & fss_extended_list_read_data_option_object) {
+ if (data->option & fss_extended_list_read_data_option_object_d) {
++total;
// Include the closing brace in the total count.
- if (data->option & fss_extended_list_read_data_option_content) {
+ if (data->option & fss_extended_list_read_data_option_content_d) {
++total;
}
}
// There is only a single Content column for this standard.
- if (data->option & fss_extended_list_read_data_option_content) {
+ if (data->option & fss_extended_list_read_data_option_content_d) {
if (!data->contents.array[at].used) continue;
range.stop = data->contents.array[at].array[0].stop;
// This content has no data, do not even check "include empty" because it cannot be counted as a line.
- if (range.start > range.stop) {
- continue;
- }
+ if (range.start > range.stop) continue;
for (i = range.start; i <= range.stop; ++i) {
flockfile(main->output.to.stream);
- if (data->option & fss_extended_list_read_data_option_line) {
+ if (data->option & fss_extended_list_read_data_option_line_d) {
if (data->line < total) {
fss_extended_list_read_print_one(main);
}
#endif // _di_fss_extended_list_read_print_zero_
/**
- * Perform the basic read processing on the buffer.
+ * Perform the extended list read processing on the buffer.
*
* This will print an error message on error.
*
#endif // _di_fss_extended_list_read_process_at_
/**
- * Process based on columns parameter.
- *
- * @param main
- * The main program data.
- * @param data
- * The program data.
- * @param names
- * An array of booleans representing whether or not some Object name is to be used.
- * (If TRUE, then the name is to be used and if FALSE, then the name is not to be used.)
- *
- * @return
- * F_none on success.
- */
-#ifndef _di_fss_extended_list_read_process_columns_
- extern f_status_t fss_extended_list_read_process_columns(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d;
-#endif // _di_fss_extended_list_read_process_columns_
-
-/**
* Process based on at parameter for some line.
*
* @param main
#endif // _di_fss_extended_list_read_process_at_line_
/**
+ * Process based on columns parameter.
+ *
+ * @param main
+ * The main program data.
+ * @param data
+ * The program data.
+ * @param names
+ * An array of booleans representing whether or not some Object name is to be used.
+ * (If TRUE, then the name is to be used and if FALSE, then the name is not to be used.)
+ *
+ * @return
+ * F_none on success.
+ */
+#ifndef _di_fss_extended_list_read_process_columns_
+ extern f_status_t fss_extended_list_read_process_columns(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) F_attribute_visibility_internal_d;
+#endif // _di_fss_extended_list_read_process_columns_
+
+/**
* Process based on line parameter.
*
* @param main
f_print_character(f_string_eol_s[0], file.stream);
- fll_program_print_help_option(file, context, fss_extended_list_write_short_file_s, fss_extended_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send file to.");
+ fll_program_print_help_option(file, context, fss_extended_list_write_short_file_s, fss_extended_list_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to.");
fll_program_print_help_option(file, context, fss_extended_list_write_short_content_s, fss_extended_list_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file.");
fll_program_print_help_option(file, context, fss_extended_list_write_short_double_s, fss_extended_list_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default).");
fll_program_print_help_option(file, context, fss_extended_list_write_short_ignore_s, fss_extended_list_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content.");
if (F_status_is_error(status)) {
fss_extended_list_write_main_delete(main);
+
return F_status_set_error(status);
}
}
if (F_status_is_error(status)) {
fss_extended_list_write_main_delete(main);
+
return status;
}
fss_extended_list_write_print_help(main->output.to, main->context);
fss_extended_list_write_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_extended_list_write_program_version_s);
fss_extended_list_write_main_delete(main);
+
return status;
}
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
if (fss_extended_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (fss_extended_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (fss_extended_list_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
}
else if (main->error.verbosity != f_console_verbosity_quiet_e && main->parameters[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_character(f_string_eol_s[0], main->error.to.stream);
+ // Ensure there is always a newline at the end, unless in quiet mode.
+ fll_print_character(f_string_eol_s[0], main->output.to.stream);
}
}
macro_f_string_dynamic_t_delete_simple(escaped);
macro_f_string_ranges_t_delete_simple(ignore);
- // object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
+ // Object and content, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
object.string = 0;
object.used = 0;
object.size = 0;
}
}
- // ensure a newline is always put at the end of the program execution, unless in quiet mode.
+ // 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 (F_status_is_error(status)) {
fll_print_character(f_string_eol_s[0], main->error.to.stream);
fll_print_dynamic(*buffer, output.stream);
buffer->used = 0;
+
return status;
}
#endif // _di_fss_extended_list_write_process_
fll_error_print(main->error, F_status_set_fine(status_pipe), "f_file_read_block", F_true);
status_pipe = F_status_set_error(F_pipe);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
break;
}
}
if (block.string[range.start] == fss_extended_list_write_pipe_content_start_s) {
state = 0x2;
++range.start;
+
break;
}
if (block.string[range.start] == fss_extended_list_write_pipe_content_end_s) {
state = 0x3;
++range.start;
+
break;
}
if (block.string[range.start] == fss_extended_list_write_pipe_content_ignore_s) {
- // this is not used by objects.
+
+ // This is not used by objects.
continue;
}
if (F_status_is_error(status)) break;
- // if the start of content was not found, then fetch the next block.
+ // If the start of content was not found, then fetch the next block.
if (state == 0x1) continue;
- // if the end of the current block is reached, fetch the next block.
+ // If the end of the current block is reached, fetch the next block.
if (range.start > range.stop) continue;
}
}
if (total) {
- if (content.used + total > content.size) {
- status = f_string_dynamic_increase_by(total, &content);
+ status = f_string_dynamic_increase_by(total, &content);
- if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
- break;
- }
+ if (F_status_is_error(status)) {
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
+ break;
}
for (; range.start <= range.stop; ++range.start) {
}
status = F_status_set_error(F_supported_not);
+
break;
}
if (block.string[range.start] == fss_extended_list_write_pipe_content_end_s) {
state = 0x3;
range.start++;
+
break;
}
fll_error_print(main->error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true);
status = F_status_set_error(F_string_too_large);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_string_too_large, "fss_extended_list_write_process_pipe", F_true);
+
break;
}
}
}
} // for
- // if the pipe ended before finishing, then attempt to wrap up.
+ // If the pipe ended before finishing, then attempt to wrap up.
if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) {
status = fss_extended_list_write_process(main, output, quote, &object, &content, ignore, buffer);
}
macro_f_string_dynamic_t_delete_simple(block);
macro_f_string_dynamic_t_delete_simple(object);
macro_f_string_dynamic_t_delete_simple(content);
+
return status;
}
#endif // _di_fss_extended_list_write_process_pipe_
data.files.array = files_array;
data.files.used = 1;
data.files.size = main->remaining.used + 1;
+ data.files.array[0].name = "(pipe)";
+ data.files.array[0].range.start = 1;
+ data.files.array[0].range.stop = 0;
if (main->remaining.used || main->process_pipe) {
{
funlockfile(main->error.to.stream);
status = F_status_set_error(F_parameter);
+
break;
}
else if (fl_string_compare(arguments->argv[location], fss_extended_read_delimit_mode_name_none, length, fss_extended_read_delimit_mode_name_none_length) == F_equal_to) {
if (F_status_is_error(status)) {
fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_read_long_delimit_s, arguments->argv[location]);
+
break;
}
file.id = F_type_descriptor_input_d;
file.stream = F_type_input_d;
- data.files.array[0].name = 0;
data.files.array[0].range.start = 0;
status = f_file_stream_read(file, &data.buffer);
break;
}
- else if (data.buffer.used > data.files.array[data.files.used].range.start) {
+
+ if (data.buffer.used > data.files.array[data.files.used].range.start) {
data.files.array[data.files.used].name = arguments->argv[main->remaining.array[i]];
data.files.array[data.files.used++].range.stop = data.buffer.used - 1;
* delimits_content: The positions within the buffer representing Content character delimits.
*/
#ifndef _di_fss_extended_read_data_t_
- #define fss_extended_read_data_option_at 0x1
- #define fss_extended_read_data_option_columns 0x2
- #define fss_extended_read_data_option_content 0x4
- #define fss_extended_read_data_option_empty 0x8
- #define fss_extended_read_data_option_line 0x10
- #define fss_extended_read_data_option_name 0x20
- #define fss_extended_read_data_option_object 0x40
- #define fss_extended_read_data_option_raw 0x80
- #define fss_extended_read_data_option_select 0x100
- #define fss_extended_read_data_option_total 0x200
- #define fss_extended_read_data_option_trim 0x400
+ #define fss_extended_read_data_option_at_d 0x1
+ #define fss_extended_read_data_option_columns_d 0x2
+ #define fss_extended_read_data_option_content_d 0x4
+ #define fss_extended_read_data_option_empty_d 0x8
+ #define fss_extended_read_data_option_line_d 0x10
+ #define fss_extended_read_data_option_name_d 0x20
+ #define fss_extended_read_data_option_object_d 0x40
+ #define fss_extended_read_data_option_raw_d 0x80
+ #define fss_extended_read_data_option_select_d 0x100
+ #define fss_extended_read_data_option_total_d 0x200
+ #define fss_extended_read_data_option_trim_d 0x400
typedef struct {
uint16_t option;
}
} // for
+ // When stopped after the end of the buffer, the last file in the list is the correct file.
+ if (at > files.array[files.used - 1].range.stop) {
+ return files.array[files.used - 1].name;
+ }
+
return "";
}
#endif // _di_fss_extended_read_file_identify_
if (F_status_is_error(status)) {
const f_string_t file_name = fss_extended_read_file_identify(input.start, data->files);
- fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, file_name ? file_name : "-", "process", fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, file_name, "process", fll_error_file_type_file_e);
return status;
}
- else if (status == F_data_not_stop || status == F_data_not_eos) {
- if (data->option & fss_extended_read_data_option_total) {
+
+ if (status == F_data_not_stop || status == F_data_not_eos) {
+ if (data->option & fss_extended_read_data_option_total_d) {
fss_extended_read_print_zero(main);
return F_none;
flockfile(main->output.to.stream);
- if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_content) && (data->contents.array[at].used || (data->option & fss_extended_read_data_option_empty))) {
- if (data->option & fss_extended_read_data_option_object) {
- if (data->option & fss_extended_read_data_option_trim) {
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ if ((data->option & fss_extended_read_data_option_object_d) || (data->option & fss_extended_read_data_option_content_d) && (data->contents.array[at].used || (data->option & fss_extended_read_data_option_empty_d))) {
+ if (data->option & fss_extended_read_data_option_object_d) {
+ if (data->option & fss_extended_read_data_option_trim_d) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) {
f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
fl_print_trim_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) {
f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
else {
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) {
f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
f_print_except_dynamic_partial(data->buffer, data->objects.array[at], delimits_object, main->output.to.stream);
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) {
f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
- if (data->option & fss_extended_read_data_option_content) {
+ if (data->option & fss_extended_read_data_option_content_d) {
fss_extended_read_print_object_end(main);
}
}
bool content_printed = F_false;
- if ((data->option & fss_extended_read_data_option_content) && data->contents.array[at].used) {
- if (data->option & fss_extended_read_data_option_select) {
+ if ((data->option & fss_extended_read_data_option_content_d) && data->contents.array[at].used) {
+ if (data->option & fss_extended_read_data_option_select_d) {
if (data->select < data->contents.array[at].used) {
content_printed = F_true;
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[data->select]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[data->select]) {
f_print_character_safely(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[data->select], delimits_content, main->output.to.stream);
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[data->select]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[data->select]) {
f_print_character_safely(data->quotes_content.array[at].array[data->select] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
content_printed = F_true;
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[i]) {
f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
f_print_except_dynamic_partial(data->buffer, data->contents.array[at].array[i], delimits_content, main->output.to.stream);
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[i]) {
f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
}
- if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_content) && (content_printed || (data->option & fss_extended_read_data_option_empty))) {
+ if ((data->option & fss_extended_read_data_option_object_d) || (data->option & fss_extended_read_data_option_content_d) && (content_printed || (data->option & fss_extended_read_data_option_empty_d))) {
fss_extended_read_print_set_end(main);
}
#ifndef _di_fss_extended_read_print_at_total_
f_status_t fss_extended_read_print_at_total(fss_extended_read_main_t * const main, const f_array_length_t at, fss_extended_read_data_t *data) {
- if (data->option & fss_extended_read_data_option_select) {
- if (data->option & fss_extended_read_data_option_object) {
+ if (data->option & fss_extended_read_data_option_select_d) {
+ if (data->option & fss_extended_read_data_option_object_d) {
flockfile(main->output.to.stream);
fss_extended_read_print_one(main);
}
if (data->select < data->contents.array[at].used) {
- if (data->contents.array[at].array[data->select].start <= data->contents.array[at].array[data->select].stop || (data->option & fss_extended_read_data_option_empty)) {
+ if (data->contents.array[at].array[data->select].start <= data->contents.array[at].array[data->select].stop || (data->option & fss_extended_read_data_option_empty_d)) {
flockfile(main->output.to.stream);
fss_extended_read_print_one(main);
}
}
}
- else if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_empty)) {
+ else if ((data->option & fss_extended_read_data_option_object_d) || (data->option & fss_extended_read_data_option_empty_d)) {
flockfile(main->output.to.stream);
fss_extended_read_print_one(main);
#ifndef _di_fss_extended_read_print_zero_
void fss_extended_read_print_zero(fss_extended_read_main_t * const main) {
+
f_print_character(f_string_ascii_0_s[0], main->output.to.stream);
f_print_character(f_string_eol_s[0], main->output.to.stream);
}
return fss_extended_read_process_at(main, data, names);
}
- if (data->option & fss_extended_read_data_option_columns) {
+ if (data->option & fss_extended_read_data_option_columns_d) {
return fss_extended_read_process_columns(main, data, names);
}
- if (data->option & fss_extended_read_data_option_total) {
+ if (data->option & fss_extended_read_data_option_total_d) {
return fss_extended_read_process_total(main, data, names);
}
- if (data->option & fss_extended_read_data_option_line) {
+ if (data->option & fss_extended_read_data_option_line_d) {
return fss_extended_read_process_line(main, data, names);
}
f_array_lengths_t except_none = f_array_lengths_t_initialize;
f_array_lengths_t *delimits_object = fss_extended_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
- f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select) ? data->select : 0, data) ? &data->delimits_content : &except_none;
+ f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select_d) ? data->select : 0, data) ? &data->delimits_content : &except_none;
- if (data->option & fss_extended_read_data_option_raw) {
+ if (data->option & fss_extended_read_data_option_raw_d) {
delimits_object = &except_none;
delimits_content = &except_none;
}
f_status_t fss_extended_read_process_at(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) {
if (data->depths.array[0].value_at >= data->objects.used) {
- if (data->option & (fss_extended_read_data_option_columns | fss_extended_read_data_option_total)) {
+ if (data->option & (fss_extended_read_data_option_columns_d | fss_extended_read_data_option_total_d)) {
flockfile(main->output.to.stream);
fss_extended_read_print_zero(main);
}
// This standard only has one line per Content; therefore, any line value greater than 0 equates to no line to print.
- if (data->option & fss_extended_read_data_option_line) {
+ if (data->option & fss_extended_read_data_option_line_d) {
if (data->line) {
- if (data->option & fss_extended_read_data_option_total) {
+ if (data->option & fss_extended_read_data_option_total_d) {
flockfile(main->output.to.stream);
fss_extended_read_print_zero(main);
f_array_lengths_t except_none = f_array_lengths_t_initialize;
f_array_lengths_t *delimits_object = fss_extended_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
- f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select) ? data->select : 0, data) ? &data->delimits_content : &except_none;
+ f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select_d) ? data->select : 0, data) ? &data->delimits_content : &except_none;
- if (data->option & fss_extended_read_data_option_raw) {
+ if (data->option & fss_extended_read_data_option_raw_d) {
delimits_object = &except_none;
delimits_content = &except_none;
}
if (!names[i]) continue;
if (at == data->depths.array[0].value_at) {
- if (data->option & fss_extended_read_data_option_line) {
+ if (data->option & fss_extended_read_data_option_line_d) {
// This standard only supports one line per Object so when using "--at", the only valid line is line 0.
if (data->line) break;
- if (data->option & fss_extended_read_data_option_total) {
+ if (data->option & fss_extended_read_data_option_total_d) {
if (fss_extended_read_print_at_total(main, i, data) == F_none) {
break;
}
}
else {
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) {
f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
fss_extended_read_print_at(main, i, *delimits_object, *delimits_content, data);
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_object.array[at]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_object.array[at]) {
f_print_character_safely(data->quotes_object.array[at] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
}
- else if (data->option & fss_extended_read_data_option_columns) {
+ else if (data->option & fss_extended_read_data_option_columns_d) {
fll_print_format("%ul%c", main->output.to.stream, data->contents.array[i].used, f_string_eol_s[0]);
}
- else if (data->option & fss_extended_read_data_option_total) {
+ else if (data->option & fss_extended_read_data_option_total_d) {
if (fss_extended_read_print_at_total(main, i, data) == F_none) {
break;
}
}
else {
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[i]) {
f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
fss_extended_read_print_at(main, i, *delimits_object, *delimits_content, data);
- if ((data->option & fss_extended_read_data_option_raw) && data->quotes_content.array[at].array[i]) {
+ if ((data->option & fss_extended_read_data_option_raw_d) && data->quotes_content.array[at].array[i]) {
f_print_character_safely(data->quotes_content.array[at].array[i] == f_fss_quote_type_single_e ? f_fss_quote_single_s[0] : f_fss_quote_double_s[0], main->output.to.stream);
}
}
++at;
} // for
- if (data->option & fss_extended_read_data_option_total) {
+ if (data->option & fss_extended_read_data_option_total_d) {
flockfile(main->output.to.stream);
fss_extended_read_print_zero(main);
#ifndef _di_fss_extended_read_process_columns_
f_status_t fss_extended_read_process_columns(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) {
- if (!(data->option & fss_extended_read_data_option_content)) {
+ if (!(data->option & fss_extended_read_data_option_content_d)) {
flockfile(main->output.to.stream);
fss_extended_read_print_zero(main);
f_array_lengths_t except_none = f_array_lengths_t_initialize;
f_array_lengths_t *delimits_object = fss_extended_read_delimit_object_is(0, data) ? &data->delimits_object : &except_none;
- f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select) ? data->select : 0, data) ? &data->delimits_content : &except_none;
+ f_array_lengths_t *delimits_content = fss_extended_read_delimit_content_is((data->option & fss_extended_read_data_option_select_d) ? data->select : 0, data) ? &data->delimits_content : &except_none;
- if (data->option & fss_extended_read_data_option_raw) {
+ if (data->option & fss_extended_read_data_option_raw_d) {
delimits_object = &except_none;
delimits_content = &except_none;
}
if (!names[i]) continue;
- if (!(data->option & fss_extended_read_data_option_object) && (data->option & fss_extended_read_data_option_content)) {
+ if (!(data->option & fss_extended_read_data_option_object_d) && (data->option & fss_extended_read_data_option_content_d)) {
if (!data->contents.array[i].used) {
- if (data->option & fss_extended_read_data_option_empty) {
+ if (data->option & fss_extended_read_data_option_empty_d) {
if (line == data->line) {
flockfile(main->output.to.stream);
memset(names, F_false, sizeof(bool) * data->objects.used);
- if (data->option & fss_extended_read_data_option_trim) {
+ if (data->option & fss_extended_read_data_option_trim_d) {
for (i = 0; i < data->objects.used; ++i) {
if (fl_string_dynamic_partial_compare_except_trim_dynamic(data->depths.array[0].value_name, data->buffer, data->objects.array[i], except_none, data->delimits_object) == F_equal_to) {
f_status_t status = F_none;
if (main->parameters[fss_extended_read_parameter_at_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_read_data_option_at;
+ data->option |= fss_extended_read_data_option_at_d;
}
if (main->parameters[fss_extended_read_parameter_columns_e].result == f_console_result_found_e) {
- data->option |= fss_extended_read_data_option_columns;
+ data->option |= fss_extended_read_data_option_columns_d;
}
if (main->parameters[fss_extended_read_parameter_content_e].result == f_console_result_found_e) {
- data->option |= fss_extended_read_data_option_content;
+ data->option |= fss_extended_read_data_option_content_d;
}
if (main->parameters[fss_extended_read_parameter_empty_e].result == f_console_result_found_e) {
- data->option |= fss_extended_read_data_option_empty;
+ data->option |= fss_extended_read_data_option_empty_d;
}
if (main->parameters[fss_extended_read_parameter_line_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_read_data_option_line;
+ data->option |= fss_extended_read_data_option_line_d;
status = fss_extended_read_load_number(main, fss_extended_read_parameter_line_e, fss_extended_read_long_line_s, arguments, &data->line);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_extended_read_parameter_name_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_read_data_option_name;
+ data->option |= fss_extended_read_data_option_name_d;
}
if (main->parameters[fss_extended_read_parameter_object_e].result == f_console_result_found_e) {
- data->option |= fss_extended_read_data_option_object;
+ data->option |= fss_extended_read_data_option_object_d;
}
if (main->parameters[fss_extended_read_parameter_raw_e].result == f_console_result_found_e) {
- data->option |= fss_extended_read_data_option_raw;
+ data->option |= fss_extended_read_data_option_raw_d;
}
if (main->parameters[fss_extended_read_parameter_select_e].result == f_console_result_additional_e) {
- data->option |= fss_extended_read_data_option_select;
+ data->option |= fss_extended_read_data_option_select_d;
status = fss_extended_read_load_number(main, fss_extended_read_parameter_select_e, fss_extended_read_long_select_s, arguments, &data->select);
if (F_status_is_error(status)) return status;
}
if (main->parameters[fss_extended_read_parameter_total_e].result == f_console_result_found_e) {
- data->option |= fss_extended_read_data_option_total;
+ data->option |= fss_extended_read_data_option_total_d;
}
if (main->parameters[fss_extended_read_parameter_trim_e].result == f_console_result_found_e) {
- data->option |= fss_extended_read_data_option_trim;
+ data->option |= fss_extended_read_data_option_trim_d;
}
// Default to content if neither Object nor Content is explicitly requested.
- if (!(data->option & (fss_extended_read_data_option_content | fss_extended_read_data_option_object))) {
- data->option |= fss_extended_read_data_option_content;
+ if (!(data->option & (fss_extended_read_data_option_content_d | fss_extended_read_data_option_object_d))) {
+ data->option |= fss_extended_read_data_option_content_d;
}
return F_none;
f_array_length_t total = 0;
// This standard only has one Content per line, however it has multiple Contents within that line.
- if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_content) && (data->option & fss_extended_read_data_option_empty)) {
+ if ((data->option & fss_extended_read_data_option_object_d) || (data->option & fss_extended_read_data_option_content_d) && (data->option & fss_extended_read_data_option_empty_d)) {
for (f_array_length_t i = 0; i < data->objects.used; ++i) {
if (!names[i]) continue;
if (!names[i]) continue;
if (!data->contents.array[i].used) continue;
- if ((data->option & fss_extended_read_data_option_select) && data->contents.array[i].used <= data->select) {
+ if ((data->option & fss_extended_read_data_option_select_d) && data->contents.array[i].used <= data->select) {
continue;
}
for (j = 0; j < data->contents.array[i].used; ++j) {
if (data->contents.array[i].array[j].start <= data->contents.array[i].array[j].stop) {
- if (data->option & fss_extended_read_data_option_select) {
+ if (data->option & fss_extended_read_data_option_select_d) {
if (j == data->select) {
++total;
flockfile(main->output.to.stream);
- if (data->option & fss_extended_read_data_option_line) {
+ if (data->option & fss_extended_read_data_option_line_d) {
if (data->line < total) {
fss_extended_read_print_one(main);
}
#endif // _di_fss_extended_read_print_zero_
/**
- * Perform the basic read processing on the buffer.
+ * Perform the extended read processing on the buffer.
*
* This will print an error message on error.
*
f_print_character(f_string_eol_s[0], file.stream);
- fll_program_print_help_option(file, context, fss_extended_write_short_file_s, fss_extended_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send file to.");
+ fll_program_print_help_option(file, context, fss_extended_write_short_file_s, fss_extended_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to.");
fll_program_print_help_option(file, context, fss_extended_write_short_content_s, fss_extended_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The Content to file.");
fll_program_print_help_option(file, context, fss_extended_write_short_double_s, fss_extended_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default).");
fll_program_print_help_option(file, context, fss_extended_write_short_ignore_s, fss_extended_write_long_ignore_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Ignore a given range within a Content.");
if (F_status_is_error(status)) {
fss_extended_write_main_delete(main);
+
return status;
}
fss_extended_write_print_help(main->output.to, main->context);
fss_extended_write_main_delete(main);
+
return status;
}
fll_program_print_version(main->output.to, fss_extended_write_program_version_s);
fss_extended_write_main_delete(main);
+
return status;
}
}
status = F_status_set_error(F_parameter);
+
break;
}
} // for
if (!((++signal_check) % fss_extended_write_signal_check_d)) {
if (fss_extended_write_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
+
break;
}
}
else if (main->error.verbosity != f_console_verbosity_quiet_e && main->parameters[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_character(f_string_eol_s[0], main->error.to.stream);
+ // Ensure there is always a newline at the end, unless in quiet mode.
+ fll_print_character(f_string_eol_s[0], main->output.to.stream);
}
}
macro_f_string_dynamic_t_delete_simple(escaped);
- // object, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
+ // Object, though being a "dynamic" type, is being used statically, so clear them up to avoid invalid free().
object.string = 0;
object.used = 0;
object.size = 0;
- // reset contents used, it is dynamically allocated so leave everything else alone.
+ // Reset contents used, it is dynamically allocated so leave everything else alone.
contents.used = 0;
}
fll_print_dynamic(*buffer, output.stream);
buffer->used = 0;
+
return status;
}
#endif // _di_fss_extended_write_process_
if (block.string[range.start] == fss_extended_write_pipe_content_start_s) {
state = 0x2;
++range.start;
+
break;
}
if (block.string[range.start] == fss_extended_write_pipe_content_end_s) {
state = 0x4;
++range.start;
+
break;
}
if (block.string[range.start] == fss_extended_write_pipe_content_ignore_s) {
- // this is not used by objects.
+
+ // This is not used by objects.
continue;
}
if (F_status_is_error(status)) break;
- // if the start of content was not found, then fetch the next block.
+ // If the start of content was not found, then fetch the next block.
if (state == 0x1) continue;
- // if the end of the current block is reached, fetch the next block.
+ // If the end of the current block is reached, fetch the next block.
if (range.start > range.stop) continue;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true);
+
break;
}
}
++contents.used;
+
continue;
}
if (block.string[range.start] == fss_extended_write_pipe_content_end_s) {
state = 0x4;
++range.start;
+
break;
}
if (block.string[range.start] == fss_extended_write_pipe_content_ignore_s) {
- // this is not used by this program.
+ // This is not used by this program.
continue;
}
fss_extended_write_error_parameter_unsupported_eol_print(main);
status = F_status_set_error(F_supported_not);
+
break;
}
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true);
+
break;
}
}
}
} // for
- // if the pipe ended before finishing, then attempt to wrap up.
+ // If the pipe ended before finishing, then attempt to wrap up.
if (F_status_is_error_not(status) && status_pipe == F_none_eof && state) {
status = fss_extended_write_process(main, output, quote, &object, &contents, buffer);
}
macro_f_string_dynamic_t_delete_simple(block);
macro_f_string_dynamic_t_delete_simple(object);
macro_f_string_dynamics_t_delete_simple(contents);
+
return status;
}
#endif // _di_fss_extended_write_process_pipe_
f_print_character(f_string_eol_s[0], file.stream);
- fll_program_print_help_option(file, context, iki_write_short_file_s, iki_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send file to.");
+ fll_program_print_help_option(file, context, iki_write_short_file_s, iki_write_long_file_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a file to send data to.");
fll_program_print_help_option(file, context, iki_write_short_content_s, iki_write_long_content_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "The content to file.");
fll_program_print_help_option(file, context, iki_write_short_double_s, iki_write_long_double_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Use double quotes (default).");
fll_program_print_help_option(file, context, 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 file.");
fll_print_character(f_string_eol_s[0], file.stream);
} // for
- // ensure there is always a newline at the end, unless in quiet mode.
+ // Ensure there is always a newline at the end, unless in quiet mode.
if (F_status_is_error_not(status) && main->error.verbosity != f_console_verbosity_quiet_e && main->parameters[iki_write_parameter_file_e].result == f_console_result_none_e) {
fll_print_character(f_string_eol_s[0], file.stream);
}