f_status_t f_file_stream_write(const f_file_t file, const f_string_static_t buffer, f_array_length_t *written) {
#ifndef _di_level_0_parameter_checking_
if (!file.size_write) return F_status_set_error(F_parameter);
- if (buffer.used > buffer.size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (!file.stream) {
f_status_t f_file_stream_write_block(const f_file_t file, const f_string_static_t buffer, f_array_length_t *written) {
#ifndef _di_level_0_parameter_checking_
if (!file.size_write) return F_status_set_error(F_parameter);
- if (buffer.used > buffer.size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (!file.stream) {
#ifndef _di_f_iki_content_partial_is_
f_status_t f_iki_content_partial_is(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote) {
#ifndef _di_level_0_parameter_checking_
- if (content.used > content.size) return F_status_set_error(F_parameter);
if (range.start > range.stop) return F_status_set_error(F_parameter);
if (range.start >= content.used) return F_status_set_error(F_parameter);
if (!quote.used) return F_status_set_error(F_parameter);
#ifndef _di_f_iki_object_is_
f_status_t f_iki_object_is(const f_string_static_t object) {
- #ifndef _di_level_0_parameter_checking_
- if (object.used > object.size) return F_status_set_error(F_parameter);
- #endif // _di_level_0_parameter_checking_
const f_string_range_t range = macro_f_string_range_t_initialize(object.used);
#ifndef _di_f_iki_object_partial_is_
f_status_t f_iki_object_partial_is(const f_string_static_t object, const f_string_range_t range) {
#ifndef _di_level_0_parameter_checking_
- if (object.used > object.size) return F_status_set_error(F_parameter);
if (range.start > range.stop) return F_status_set_error(F_parameter);
if (range.start >= object.used) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
* Therefore, a range from 0 to 0 would be include position 0.
* Set start to some value larger than stop to designate that there is no range (such as start = 1, stop = 0).
*
- * A special macro_f_string_range_t_initialize() is provided for the special purpose of easily initialize a static string range.
- *
* start: the start position.
* stop: the stop position.
*/
#define f_string_range_t_initialize { 1, 0 }
#define macro_f_string_range_t_initialize(length) { length ? 0 : 1, length ? length - 1 : 0 }
+ #define macro_f_string_range_t_initialize2(start, stop) { start, stop }
#define macro_f_string_range_t_clear(range) \
range.start = 1; \
f_status_t fl_utf_file_write(const f_file_t file, const f_utf_string_static_t buffer, f_array_length_t *written) {
#ifndef _di_level_0_parameter_checking_
if (!file.size_write) return F_status_set_error(F_parameter);
- if (buffer.used > buffer.size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (file.id < 0) {
f_status_t fl_utf_file_write_block(const f_file_t file, const f_utf_string_static_t buffer, f_array_length_t *written) {
#ifndef _di_level_0_parameter_checking_
if (!file.size_write) return F_status_set_error(F_parameter);
- if (buffer.used > buffer.size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (file.id < 0) {
f_status_t fl_utf_file_write_until(const f_file_t file, const f_utf_string_static_t buffer, const f_array_length_t total, f_array_length_t *written) {
#ifndef _di_level_0_parameter_checking_
if (!file.size_write) return F_status_set_error(F_parameter);
- if (buffer.used > buffer.size) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
if (file.id < 0) {
f_status_t fl_utf_file_write_range(const f_file_t file, const f_utf_string_static_t buffer, const f_string_range_t range, f_array_length_t *written) {
#ifndef _di_level_0_parameter_checking_
if (!file.size_write) return F_status_set_error(F_parameter);
- if (buffer.used > buffer.size) return F_status_set_error(F_parameter);
if (range.stop < range.start) return F_status_set_error(F_parameter);
if (range.start >= buffer.used) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#ifndef _di_fll_iki_content_escape_
f_status_t fll_iki_content_escape(const f_string_static_t content, const f_string_static_t quote, f_string_dynamic_t *escaped) {
#ifndef _di_level_2_parameter_checking_
- if (content.used > content.size) return F_status_set_error(F_parameter);
if (!quote.used) return F_status_set_error(F_parameter);
if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter);
if (escaped->used > escaped->size) return F_status_set_error(F_parameter);
#ifndef _di_fll_iki_content_partial_escape_
f_status_t fll_iki_content_partial_escape(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote, f_string_dynamic_t *escaped) {
#ifndef _di_level_2_parameter_checking_
- if (content.used > content.size) return F_status_set_error(F_parameter);
if (range.start > range.stop) return F_status_set_error(F_parameter);
if (range.start >= content.used) return F_status_set_error(F_parameter);
if (!quote.used) return F_status_set_error(F_parameter);
#ifndef _di_fll_iki_content_partial_unescape_
f_status_t fll_iki_content_partial_unescape(const f_string_static_t content, const f_string_range_t range, const f_string_static_t quote, f_string_dynamic_t *unescaped) {
#ifndef _di_level_2_parameter_checking_
- if (content.used > content.size) return F_status_set_error(F_parameter);
if (range.start > range.stop) return F_status_set_error(F_parameter);
if (range.start >= content.used) return F_status_set_error(F_parameter);
if (!quote.used) return F_status_set_error(F_parameter);
#ifndef _di_fll_iki_content_unescape_
f_status_t fll_iki_content_unescape(const f_string_static_t content, const f_string_static_t quote, f_string_dynamic_t *unescaped) {
#ifndef _di_level_2_parameter_checking_
- if (content.used > content.size) return F_status_set_error(F_parameter);
if (!quote.used) return F_status_set_error(F_parameter);
if (quote.string[0] != f_iki_syntax_quote_single_s.string[0] && quote.string[0] != f_iki_syntax_quote_double_s.string[0]) return F_status_set_error(F_parameter);
if (unescaped->used > unescaped->size) return F_status_set_error(F_parameter);
#endif // _di_fll_program_parameter_process_empty_
#ifndef _di_fll_program_parameter_additional_append_
- f_status_t fll_program_parameter_additional_append(const f_string_t *argv, const f_array_lengths_t values, f_string_dynamics_t *destination) {
+ f_status_t fll_program_parameter_additional_append(const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamics_t *destination) {
#ifndef _di_level_2_parameter_checking_
- if (!argv) return F_status_set_error(F_parameter);
+ if (!arguments) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = F_none;
- f_array_length_t length = 0;
const f_array_length_t start = destination->used;
for (f_array_length_t i = 0; i < values.used; ++i) {
- length = strnlen(argv[values.array[i]], F_console_parameter_size_d);
+ if (arguments[values.array[i]].used) {
+ status = f_string_dynamics_increase(F_memory_default_allocation_small_d, destination);
+ if (F_status_is_error(status)) break;
- if (length > 0) {
- f_string_dynamic_t ripped = f_string_dynamic_t_initialize;
+ destination->array[destination->used].used = 0;
- status = f_string_append(argv[values.array[i]], length, &ripped);
- if (F_status_is_error(status)) return status;
+ status = f_string_dynamic_append(arguments[values.array[i]], &destination->array[destination->used]);
+ if (F_status_is_error(status)) break;
if (status == F_data_not) {
status = F_none;
}
else {
- macro_f_memory_structure_increment(status, (*destination), 1, F_memory_default_allocation_small_d, macro_f_string_dynamics_t_resize, F_array_too_large);
- if (F_status_is_error(status)) break;
-
- destination->array[destination->used++] = ripped;
+ ++destination->used;
}
}
} // for
#endif // _di_fll_program_parameter_additional_append_
#ifndef _di_fll_program_parameter_additional_mash_
- f_status_t fll_program_parameter_additional_mash(const f_string_static_t glue, const f_string_t *argv, const f_array_lengths_t values, f_string_dynamic_t *destination) {
+ f_status_t fll_program_parameter_additional_mash(const f_string_static_t glue, const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
- if (!argv) return F_status_set_error(F_parameter);
+ if (!arguments) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = F_none;
- f_array_length_t length = 0;
const f_array_length_t start = destination->used;
for (f_array_length_t i = 0; i < values.used; ++i) {
- length = strnlen(argv[values.array[i]], F_console_parameter_size_d);
-
- if (length > 0) {
- status = f_string_mash(glue.string, glue.used, argv[values.array[i]], length, destination);
- if (F_status_is_error(status)) return F_status_set_error(F_string_too_large);
+ if (arguments[values.array[i]].used) {
+ status = f_string_dynamic_mash(glue, arguments[values.array[i]], destination);
+ if (F_status_is_error(status)) break;
}
} // for
#endif // _di_fll_program_parameter_additional_mash_
#ifndef _di_fll_program_parameter_additional_rip_
- f_status_t fll_program_parameter_additional_rip(const f_string_t *argv, const f_array_lengths_t values, f_string_dynamics_t *destination) {
+ f_status_t fll_program_parameter_additional_rip(const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamics_t *destination) {
#ifndef _di_level_2_parameter_checking_
- if (!argv) return F_status_set_error(F_parameter);
+ if (!arguments) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = F_none;
- f_array_length_t length = 0;
const f_array_length_t start = destination->used;
for (f_array_length_t i = 0; i < values.used; ++i) {
- length = strnlen(argv[values.array[i]], F_console_parameter_size_d);
+ if (arguments[values.array[i]].used) {
+ status = f_string_dynamics_increase(F_memory_default_allocation_small_d, destination);
+ if (F_status_is_error(status)) break;
- if (length) {
- f_string_dynamic_t ripped = f_string_dynamic_t_initialize;
+ destination->array[destination->used].used = 0;
- status = fl_string_rip(argv[values.array[i]], length, &ripped);
- if (F_status_is_error(status)) return status;
+ status = fl_string_rip(arguments[values.array[i]].string, arguments[values.array[i]].used, &destination->array[destination->used]);
+ if (F_status_is_error(status)) break;
if (status == F_data_not) {
status = F_none;
}
else {
- macro_f_string_dynamics_t_increase(status, F_memory_default_allocation_small_d, (*destination));
- if (F_status_is_error(status)) return status;
-
- destination->array[destination->used++] = ripped;
+ ++destination->used;
}
}
} // for
#endif // _di_fll_program_parameter_additional_rip_
#ifndef _di_fll_program_parameter_additional_rip_mash_
- f_status_t fll_program_parameter_additional_rip_mash(const f_string_static_t glue, const f_string_t *argv, const f_array_lengths_t values, f_string_dynamic_t *destination) {
+ f_status_t fll_program_parameter_additional_rip_mash(const f_string_static_t glue, const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamic_t *destination) {
#ifndef _di_level_2_parameter_checking_
- if (!argv) return F_status_set_error(F_parameter);
+ if (!arguments) return F_status_set_error(F_parameter);
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_2_parameter_checking_
f_status_t status = F_none;
- f_array_length_t length = 0;
const f_array_length_t start = destination->used;
f_string_dynamic_t ripped = f_string_dynamic_t_initialize;
for (f_array_length_t i = 0; i < values.used; ++i) {
- length = strnlen(argv[values.array[i]], F_console_parameter_size_d);
-
- if (length > 0) {
- status = fl_string_rip(argv[values.array[i]], length, &ripped);
+ if (arguments[values.array[i]].used) {
+ ripped.used = 0;
- if (F_status_is_error(status)) {
- f_string_dynamic_resize(0, &ripped);
+ status = fl_string_rip(arguments[values.array[i]].string, arguments[values.array[i]].used, &ripped);
+ if (F_status_is_error(status)) break;
- return status;
- }
-
- if (ripped.used > 0) {
+ if (ripped.used) {
status = f_string_dynamic_mash(glue, ripped, destination);
-
- if (F_status_is_error(status)) {
- status = f_string_dynamic_resize(0, &ripped);
-
- return F_status_set_error(F_string_too_large);
- }
+ if (F_status_is_error(status)) break;
}
}
} // for
- if (ripped.size) {
- f_string_dynamic_resize(0, &ripped);
- }
+ f_string_dynamic_resize(0, &ripped);
if (status == F_none && start == destination->used) {
return F_data_not;
*
* Empty console parameters are ignored.
*
- * @param argv
+ * @param arguments
* The program argument array to parse.
* The caller must guarantee that the values.used does not exceed the argv length.
* @param values
* F_memory_not (with error bit) on out of memory.
* F_parameter (with error bit) if a parameter is invalid.
*
- * Errors (with error bit) from: f_string_append().
+ * Errors (with error bit) from: f_string_dynamic_append().
*
- * @see f_string_append()
+ * @see f_string_dynamic_append()
*/
#ifndef _di_fll_program_parameter_additional_append_
- extern f_status_t fll_program_parameter_additional_append(const f_string_t *argv, const f_array_lengths_t values, f_string_dynamics_t *destination);
+ extern f_status_t fll_program_parameter_additional_append(const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamics_t *destination);
#endif // _di_fll_program_parameter_additional_append_
/**
*
* @param glue
* A string to append between the source and destination, such as a space: ' '.
- * @param argv
+ * @param arguments
* The program argument array to parse.
* The caller must guarantee that the values.used does not exceed the argv length.
* @param values
* F_parameter (with error bit) if a parameter is invalid.
* F_string_too_large (with error bit) if the combined string is too large.
*
- * Errors (with error bit) from: f_string_mash().
+ * Errors (with error bit) from: f_string_dynamic_mash().
*
- * @see f_string_mash()
+ * @see f_string_dynamic_mash()
*/
#ifndef _di_fll_program_parameter_additional_mash_
- extern f_status_t fll_program_parameter_additional_mash(const f_string_static_t glue, const f_string_t *argv, const f_array_lengths_t values, f_string_dynamic_t *destination);
+ extern f_status_t fll_program_parameter_additional_mash(const f_string_static_t glue, const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamic_t *destination);
#endif // _di_fll_program_parameter_additional_mash_
/**
*
* The console parameters are trimmed.
*
- * @param argv
+ * @param arguments
* The program argument array to parse.
* The caller must guarantee that the values.used does not exceed the argv length.
* @param values
* @see fl_string_rip()
*/
#ifndef _di_fll_program_parameter_additional_rip_
- extern f_status_t fll_program_parameter_additional_rip(const f_string_t *argv, const f_array_lengths_t values, f_string_dynamics_t *destination);
+ extern f_status_t fll_program_parameter_additional_rip(const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamics_t *destination);
#endif // _di_fll_program_parameter_additional_rip_
/**
*
* @param glue
* A string to append between the source and destination, such as a space: ' '.
- * @param argv
+ * @param arguments
* The program argument array to parse.
* @param values
* The string locations where the console parameters are found.
* @see fl_string_rip()
*/
#ifndef _di_fll_program_parameter_additional_rip_mash_
- extern f_status_t fll_program_parameter_additional_rip_mash(const f_string_static_t glue, const f_string_t *argv, const f_array_lengths_t values, f_string_dynamic_t *destination);
+ extern f_status_t fll_program_parameter_additional_rip_mash(const f_string_static_t glue, const f_string_static_t *arguments, const f_array_lengths_t values, f_string_dynamic_t *destination);
#endif // _di_fll_program_parameter_additional_rip_mash_
/**
if (F_status_is_error(status)) {
// @todo instead call: fll_error_file_print().
- // fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, arguments->argv[location], f_file_operation_verify_s, fll_error_file_type_path_e);
+ // fll_error_file_print(main->error, F_status_set_fine(status), "fll_path_canonical", F_true, argv[index], f_file_operation_verify_s, fll_error_file_type_path_e);
controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fll_path_canonical", F_true, global.thread);
action->status = status;
* The "libraries/" and "programs/" directories contains the sub-directories "script/", "shared/", and "static/".
* The "libraries/" directory will contain compiled libraries or library-like scripts in their respective sub-directories.
* The "objects/" directory will contain any compile object files.
- * The "progams/" directory will contain compiled programs or program-like scripts in their respective sub-directories.
+ * The "programs/" directory will contain compiled programs or program-like scripts in their respective sub-directories.
* The "settings/" directory contains all configuration data, such as files commonly found under /etc in a standard GNU Linux system.
* The "stage/" directory will contain build-time data.
*/
return F_status_set_error(F_parameter);
}
- f_array_length_t location = main->parameters.array[parameters_id[i]].values.array[0];
- f_array_length_t length = strnlen(arguments->argv[location], F_console_parameter_size_d);
+ f_array_length_t index = main->parameters.array[parameters_id[i]].values.array[0];
- if (length > 0) {
+ if (argv[index].used) {
if (parameters_validate_word[i]) {
f_array_length_t j = 0;
f_array_length_t width_max = 0;
- for (j = 0; j < length; ++j) {
+ for (j = 0; j < argv[index].used; ++j) {
- width_max = length - j;
+ width_max = argv[index].used - j;
- status = f_utf_is_word_dash_plus(arguments->argv[location] + j, width_max, F_false);
+ status = f_utf_is_word_dash_plus(argv[index] + j, width_max, F_false);
if (F_status_is_error(status)) {
if (fll_error_print(main->error, F_status_set_fine(status), "f_utf_is_word_dash_plus", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) {
fl_print_format("%r%[%QThe '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
fl_print_format("%[%r%r%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fake_long_process_s, main->error.notable);
fl_print_format("%[' parameters value '%]", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
- fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, arguments->argv[location], main->error.notable);
+ fl_print_format("%[%S%]", main->error.to.stream, main->error.notable, argv[index], main->error.notable);
fl_print_format("%[' contains non-word, non-dash, and non-plus characters.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
funlockfile(main->error.to.stream);
} // for
}
- status = f_string_append(arguments->argv[location], length, parameters_value[i]);
+ status = f_string_append(argv[index], argv[index].used, parameters_value[i]);
if (F_status_is_error(status)) {
if (status == F_status_set_error(F_string_too_large)) {
}
}
- if (length == 0 || status == F_data_not) {
+ if (!argv[index].used || status == F_data_not) {
if (main->error.verbosity != f_console_verbosity_quiet_e) {
flockfile(main->error.to.stream);
return F_status_set_error(F_parameter);
}
- status = fl_console_parameter_to_string_dynamic_directory(arguments->argv[main->parameters.array[parameters_id[i]].values.array[0]], parameters_value[i]);
+ status = fl_console_parameter_to_string_dynamic_directory(argv[main->parameters.array[parameters_id[i]].values.array[0]], parameters_value[i]);
if (F_status_is_error(status)) {
if (fll_error_print(main->error, F_status_set_fine(status), "fl_console_parameter_to_string_dynamic_directory", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) {
}
if (main->parameters.array[fake_parameter_define_e].result == f_console_result_additional_e) {
- status = fll_program_parameter_additional_rip(arguments->argv, main->parameters.array[fake_parameter_define_e].values, &main->define);
+ status = fll_program_parameter_additional_rip(argv, main->parameters.array[fake_parameter_define_e].values, &main->define);
if (F_status_is_error(status)) {
if (fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) {
return F_status_set_error(F_parameter);
}
else if (main->parameters.array[fake_parameter_mode_e].result == f_console_result_additional_e) {
- status = fll_program_parameter_additional_rip(arguments->argv, main->parameters.array[fake_parameter_mode_e].values, &main->mode);
+ status = fll_program_parameter_additional_rip(argv, main->parameters.array[fake_parameter_mode_e].values, &main->mode);
if (F_status_is_error(status)) {
if (fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_additional_rip", F_false) == F_known_not && main->error.verbosity != f_console_verbosity_quiet_e) {
}
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_list_read_parameter_delimit_e].result == f_console_result_additional_e) {
- f_array_length_t location = 0;
+ f_array_length_t index = 0;
f_array_length_t length = 0;
uint16_t signal_check = 0;
signal_check = 0;
}
- location = main->parameters.array[fss_basic_list_read_parameter_delimit_e].values.array[i];
- length = strnlen(arguments->argv[location], F_console_parameter_size_d);
+ index = main->parameters.array[fss_basic_list_read_parameter_delimit_e].values.array[i];
+ length = argv[index].used;
if (!length) {
flockfile(main->error.to.stream);
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) {
+ else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_none_s.string, argv[index], fss_basic_list_read_delimit_mode_name_none_s.used) == F_equal_to) {
data.delimit_mode = fss_basic_list_read_delimit_mode_none_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_basic_list_read_delimit_mode_name_all_s, length, fss_basic_list_read_delimit_mode_name_all_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_all_s.string, argv[index], fss_basic_list_read_delimit_mode_name_all_s.used) == F_equal_to) {
data.delimit_mode = fss_basic_list_read_delimit_mode_all_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_basic_list_read_delimit_mode_name_object_s, length, fss_basic_list_read_delimit_mode_name_object_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_basic_list_read_delimit_mode_name_object_s.string, argv[index], fss_basic_list_read_delimit_mode_name_object_s.used) == F_equal_to) {
switch (data.delimit_mode) {
case 0:
data.delimit_mode = fss_basic_list_read_delimit_mode_object_e;
data.delimit_mode = fss_basic_list_read_delimit_mode_content_object_e;
}
- if (arguments->argv[location][length - 1] == fss_basic_list_read_delimit_mode_name_greater_s.string[0]) {
+ if (argv[index][length - 1] == fss_basic_list_read_delimit_mode_name_greater_s.string[0]) {
if (!(data.delimit_mode == fss_basic_list_read_delimit_mode_none_e || data.delimit_mode == fss_basic_list_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_basic_list_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_basic_list_read_delimit_mode_content_greater_object_e;
// Shorten the length to better convert the remainder to a number.
--length;
}
- else if (arguments->argv[location][length - 1] == fss_basic_list_read_delimit_mode_name_lesser_s.string[0]) {
+ else if (argv[index][length - 1] == fss_basic_list_read_delimit_mode_name_lesser_s.string[0]) {
if (!(data.delimit_mode == fss_basic_list_read_delimit_mode_none_e || data.delimit_mode == fss_basic_list_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_basic_list_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_basic_list_read_delimit_mode_content_lesser_object_e;
f_string_range_t range = macro_f_string_range_t_initialize(length);
// Ignore leading plus sign.
- if (arguments->argv[location][0] == '+') {
+ if (argv[index][0] == f_string_ascii_plus_s[0]) {
++range.start;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[location], range, &data.delimit_depth);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, 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_read_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, argv[index]);
break;
}
// This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter.
// Guarantee that a newline exists at the end of the buffer.
- status = f_string_append_assure(f_string_eol_s, 1, &data.buffer);
+ status = f_string_dynamic_append_assure(f_string_eol_s, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
}
}
else {
file.stream = 0;
file.id = -1;
- status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file);
+ status = f_file_stream_open(argv[main->parameters.remaining.array[i]], 0, &file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
status = f_file_size_by_id(file.id, &size_file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_file_stream_read(file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
else if (data.buffer.used > data.files.array[data.files.used].range.start) {
- data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]];
+ data.files.array[data.files.used].name = argv[main->parameters.remaining.array[i]];
data.files.array[data.files.used++].range.stop = data.buffer.used - 1;
// This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter.
// Guarantee that a newline exists at the end of the buffer.
- status = f_string_append_assure(f_string_eol_s, 1, &data.buffer);
+ status = f_string_dynamic_append_assure(f_string_eol_s, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_string_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_assure", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
}
}
}
else {
position_depth = main->parameters.array[fss_basic_list_read_parameter_depth_e].values.array[i];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[position_depth]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(strlen(argv[position_depth]));
- status = fl_conversion_string_to_number_unsigned(arguments->argv[position_depth], range, &data->depths.array[i].depth);
+ status = fl_conversion_string_to_number_unsigned(argv[position_depth].string, 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_read_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, argv[position_depth]);
return status;
}
data->depths.array[i].index_at = main->parameters.array[fss_basic_list_read_parameter_at_e].values.array[position_at];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[data->depths.array[i].index_at]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[data->depths.array[i].index_at].used);
- status = fl_conversion_string_to_number_unsigned(arguments->argv[data->depths.array[i].index_at], range, &data->depths.array[i].value_at);
+ status = fl_conversion_string_to_number_unsigned(argv[data->depths.array[i].index_at].string, 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_read_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, argv[data->depths.array[i].index_at]);
return status;
}
data->depths.array[i].index_name = main->parameters.array[fss_basic_list_read_parameter_name_e].values.array[position_name];
if (main->parameters.array[fss_basic_list_read_parameter_trim_e].result == f_console_result_found_e) {
- status = fl_string_rip(arguments->argv[data->depths.array[i].index_name], strlen(arguments->argv[data->depths.array[i].index_name]), &data->depths.array[i].value_name);
+ status = fl_string_dynamic_rip(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
}
else {
- status = f_string_append(arguments->argv[data->depths.array[i].index_name], strlen(arguments->argv[data->depths.array[i].index_name]), &data->depths.array[i].value_name);
+ status = f_string_dynamic_append(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
}
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), main->parameters.array[fss_basic_list_read_parameter_trim_e].result == f_console_result_found_e ? "fl_string_rip" : "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), main->parameters.array[fss_basic_list_read_parameter_trim_e].result == f_console_result_found_e ? "fl_string_dynamic_rip" : "f_string_dynamic_append", F_true);
return status;
}
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);
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
- const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d));
+ const f_string_range_t range = macro_f_string_range_t_initialize(main->argv[index].used);
- const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number);
+ const f_status_t status = fl_conversion_string_to_number_unsigned(main->argv[index].string, range, number);
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, name, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, main->argv[index]);
return status;
}
status = F_status_set_error(F_parameter);
}
else {
- const f_array_length_t location = main->parameters.array[fss_basic_list_write_parameter_file_e].values.array[0];
+ const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_file_e].values.array[0];
output.id = -1;
output.stream = 0;
- status = f_file_stream_open(arguments->argv[location], 0, &output);
+ status = f_file_stream_open(argv[index], f_string_static_empty_s, &output);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[location], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
}
}
}
}
else if (main->parameters.array[fss_basic_list_write_parameter_prepend_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_list_write_parameter_prepend_e].values.used - 1];
- const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d);
- if (length) {
- f_string_range_t range = macro_f_string_range_t_initialize(length);
+ if (argv[index].used) {
+ f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
- main->prepend.string = arguments->argv[index];
- main->prepend.used = length;
- main->prepend.size = length;
+ for (; range.start < argv[index].used; ++range.start) {
- for (; range.start < length; range.start++) {
-
- status = f_fss_is_space(main->prepend, range);
+ status = f_fss_is_space(argv[index], range);
if (F_status_is_error(status)) break;
if (status == F_false) {
}
f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
- f_string_dynamic_t object = f_string_dynamic_t_initialize;
- f_string_dynamic_t content = f_string_dynamic_t_initialize;
if (F_status_is_error_not(status)) {
- f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
-
if (main->process_pipe) {
status = fss_basic_list_write_process_pipe(main, output, quote, &buffer);
break;
}
- object.string = arguments->argv[main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- status = fss_basic_list_write_process(main, output, quote, &object, 0, &buffer);
+ status = fss_basic_list_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]], 0, &buffer);
if (F_status_is_error(status)) break;
} // for
}
break;
}
- content.string = arguments->argv[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_basic_list_write_process(main, output, quote, 0, &content, &buffer);
+ status = fss_basic_list_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]], &buffer);
if (F_status_is_error(status)) break;
} // for
}
break;
}
- object.string = arguments->argv[main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- content.string = arguments->argv[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_basic_list_write_process(main, output, quote, &object, &content, &buffer);
+ status = fss_basic_list_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_list_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_basic_list_write_parameter_content_e].values.array[i]], &buffer);
if (F_status_is_error(status)) break;
} // for
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
-
- f_string_dynamic_resize(0, &escaped);
-
- // 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;
-
- content.string = 0;
- content.used = 0;
- content.size = 0;
}
if (main->parameters.array[fss_basic_list_write_parameter_file_e].result == f_console_result_additional_e) {
}
f_string_dynamic_resize(0, &buffer);
- f_string_dynamic_resize(0, &object);
- f_string_dynamic_resize(0, &content);
fss_basic_list_write_main_delete(main);
return status;
}
if (F_status_is_error_not(status) && main->parameters.array[fss_basic_read_parameter_delimit_e].result == f_console_result_additional_e) {
- f_array_length_t location = 0;
+ f_array_length_t index = 0;
f_array_length_t length = 0;
// Set the value to 0 to allow for detecting mode based on what is provided.
break;
}
- location = main->parameters.array[fss_basic_read_parameter_delimit_e].values.array[i];
- length = strnlen(arguments->argv[location], F_console_parameter_size_d);
+ index = main->parameters.array[fss_basic_read_parameter_delimit_e].values.array[i];
+ length = argv[index].used;
if (!length) {
flockfile(main->error.to.stream);
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) {
+ else if (fl_string_dynamic_compare_string(fss_basic_read_delimit_mode_name_none_s.string, argv[index], fss_basic_read_delimit_mode_name_none_s.used) == F_equal_to) {
data.delimit_mode = fss_basic_read_delimit_mode_none_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_basic_read_delimit_mode_name_all_s, length, fss_basic_read_delimit_mode_name_all_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_basic_read_delimit_mode_name_all_s.string, argv[index], fss_basic_read_delimit_mode_name_all_s.used) == F_equal_to) {
data.delimit_mode = fss_basic_read_delimit_mode_all_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_basic_read_delimit_mode_name_object_s, length, fss_basic_read_delimit_mode_name_object_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_basic_read_delimit_mode_name_object_s.string, argv[index], fss_basic_read_delimit_mode_name_object_s.used) == F_equal_to) {
switch (data.delimit_mode) {
case 0:
data.delimit_mode = fss_basic_read_delimit_mode_object_e;
data.delimit_mode = fss_basic_read_delimit_mode_content_object_e;
}
- if (arguments->argv[location][length - 1] == fss_basic_read_delimit_mode_name_greater_s.string[0]) {
+ if (argv[index][length - 1] == fss_basic_read_delimit_mode_name_greater_s.string[0]) {
if (!(data.delimit_mode == fss_basic_read_delimit_mode_none_e || data.delimit_mode == fss_basic_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_basic_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_basic_read_delimit_mode_content_greater_object_e;
// Shorten the length to better convert the remainder to a number.
--length;
}
- else if (arguments->argv[location][length - 1] == fss_basic_read_delimit_mode_name_lesser_s.string[0]) {
+ else if (argv[index][length - 1] == fss_basic_read_delimit_mode_name_lesser_s.string[0]) {
if (!(data.delimit_mode == fss_basic_read_delimit_mode_none_e || data.delimit_mode == fss_basic_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_basic_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_basic_read_delimit_mode_content_lesser_object_e;
f_string_range_t range = macro_f_string_range_t_initialize(length);
// Ignore leading plus sign.
- if (arguments->argv[location][0] == '+') {
+ if (argv[index][0] == '+') {
++range.start;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[location], range, &data.delimit_depth);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, 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_read_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_read_long_delimit_s, argv[index]);
break;
}
if (fss_basic_read_signal_received(main)) {
status = F_status_set_error(F_signal);
+
break;
}
file.stream = 0;
file.id = -1;
- status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file);
+ status = f_file_stream_open(argv[main->parameters.remaining.array[i]], 0, &file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
status = f_file_size_by_id(file.id, &size_file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_file_stream_read(file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
if (data.buffer.used > data.files.array[data.files.used].range.start) {
- data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]];
+ data.files.array[data.files.used].name = argv[main->parameters.remaining.array[i]];
data.files.array[data.files.used++].range.stop = data.buffer.used - 1;
// This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter.
else {
position_depth = main->parameters.array[fss_basic_read_parameter_depth_e].values.array[i];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[position_depth]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(strlen(argv[position_depth]));
- status = fl_conversion_string_to_number_unsigned(arguments->argv[position_depth], range, &data->depths.array[i].depth);
+ status = fl_conversion_string_to_number_unsigned(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_read_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_read_long_depth_s, argv[position_depth]);
return status;
}
data->depths.array[i].index_at = main->parameters.array[fss_basic_read_parameter_at_e].values.array[position_at];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[data->depths.array[i].index_at]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(strlen(argv[data->depths.array[i].index_at]));
- status = fl_conversion_string_to_number_unsigned(arguments->argv[data->depths.array[i].index_at], range, &data->depths.array[i].value_at);
+ status = fl_conversion_string_to_number_unsigned(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_read_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_read_long_at_s, argv[data->depths.array[i].index_at]);
return status;
}
data->depths.array[i].index_name = main->parameters.array[fss_basic_read_parameter_name_e].values.array[position_name];
if (main->parameters.array[fss_basic_read_parameter_trim_e].result == f_console_result_found_e) {
- status = fl_string_rip(arguments->argv[data->depths.array[i].index_name], strlen(arguments->argv[data->depths.array[i].index_name]), &data->depths.array[i].value_name);
+ status = fl_string_dynamic_rip(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
}
else {
- status = f_string_append(arguments->argv[data->depths.array[i].index_name], strlen(arguments->argv[data->depths.array[i].index_name]), &data->depths.array[i].value_name);
+ status = f_string_dynamic_append(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
}
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), main->parameters.array[fss_basic_read_parameter_trim_e].result == f_console_result_found_e ? "fl_string_rip" : "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), main->parameters.array[fss_basic_read_parameter_trim_e].result == f_console_result_found_e ? "fl_string_dynamic_rip" : "f_string_dynamic_append", F_true);
return status;
}
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
- const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d));
+ const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(argv[index], F_console_parameter_size_d));
- const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number);
+ const f_status_t status = fl_conversion_string_to_number_unsigned(argv[index].string, range, number);
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, name, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, argv[index]);
return status;
}
status = F_status_set_error(F_parameter);
}
else {
- const f_array_length_t location = main->parameters.array[fss_basic_write_parameter_file_e].values.array[0];
+ const f_array_length_t index = main->parameters.array[fss_basic_write_parameter_file_e].values.array[0];
output.id = -1;
output.stream = 0;
- status = f_file_stream_open(arguments->argv[location], 0, &output);
+ status = f_file_stream_open(argv[index], f_string_empty_s, &output);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[location], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
}
}
}
}
else if (main->parameters.array[fss_basic_write_parameter_prepend_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_basic_write_parameter_prepend_e].values.array[main->parameters.array[fss_basic_write_parameter_prepend_e].values.used - 1];
- const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d);
// Even though this standard does not utilize this parameter, provide the validation for consistency.
- if (length) {
- f_string_range_t range = macro_f_string_range_t_initialize(length);
- const f_string_static_t prepend = macro_f_string_static_t_initialize2(arguments->argv[index], length);
+ if (argv[index].used) {
+ f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
- for (; range.start < length; range.start++) {
+ for (; range.start < argv[index].used; ++range.start) {
- status = f_fss_is_space(prepend, range);
+ status = f_fss_is_space(argv[index], range);
if (F_status_is_error(status)) break;
if (status == F_false) {
}
f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
- f_string_dynamic_t object = f_string_dynamic_t_initialize;
- f_string_dynamic_t content = f_string_dynamic_t_initialize;
if (F_status_is_error_not(status)) {
- f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
-
if (main->process_pipe) {
status = fss_basic_write_process_pipe(main, output, quote, &buffer);
break;
}
- object.string = arguments->argv[main->parameters.array[fss_basic_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- status = fss_basic_write_process(main, output, quote, &object, 0, &buffer);
+ status = fss_basic_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_write_parameter_object_e].values.array[i]], 0, &buffer);
if (F_status_is_error(status)) break;
} // for
}
break;
}
- content.string = arguments->argv[main->parameters.array[fss_basic_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_basic_write_process(main, output, quote, 0, &content, &buffer);
+ status = fss_basic_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_basic_write_parameter_content_e].values.array[i]], &buffer);
if (F_status_is_error(status)) break;
} // for
}
break;
}
- object.string = arguments->argv[main->parameters.array[fss_basic_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- content.string = arguments->argv[main->parameters.array[fss_basic_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_basic_write_process(main, output, quote, &object, &content, &buffer);
+ status = fss_basic_write_process(main, output, quote, &argv[main->parameters.array[fss_basic_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_basic_write_parameter_content_e].values.array[i]], &buffer);
if (F_status_is_error(status)) break;
} // for
}
fll_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
}
-
- f_string_dynamic_resize(0, &escaped);
-
- // 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;
-
- content.string = 0;
- content.used = 0;
- content.size = 0;
}
if (main->parameters.array[fss_basic_write_parameter_file_e].result == f_console_result_additional_e) {
}
f_string_dynamic_resize(0, &buffer);
- f_string_dynamic_resize(0, &object);
- f_string_dynamic_resize(0, &content);
fss_basic_write_main_delete(main);
return status;
status = F_status_set_error(F_parameter);
}
else if (main->parameters.array[fss_embedded_list_read_parameter_delimit_e].result == f_console_result_additional_e) {
- const f_array_length_t location = main->parameters.array[fss_embedded_list_read_parameter_delimit_e].values.array[0];
- f_array_length_t length = strnlen(arguments->argv[location], F_console_parameter_size_d);
+ const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_delimit_e].values.array[0];
+ f_array_length_t length = argv[index].used;
- if (length == 0) {
+ if (!length) {
flockfile(main->error.to.stream);
fl_print_format("%r%[%QThe value for the parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
status = F_status_set_error(F_parameter);
}
- else if (fl_string_compare(arguments->argv[location], fss_embedded_list_read_delimit_mode_name_none_s, length, fss_embedded_list_read_delimit_mode_name_none_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_embedded_list_read_delimit_mode_name_none_s.string, argv[index], fss_embedded_list_read_delimit_mode_name_none_s.used) == F_equal_to) {
main->delimit_mode = fss_embedded_list_read_delimit_mode_none_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_embedded_list_read_delimit_mode_name_all_s, length, fss_embedded_list_read_delimit_mode_name_all_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_embedded_list_read_delimit_mode_name_all_s.string, argv[index], fss_embedded_list_read_delimit_mode_name_all_s.used) == F_equal_to) {
main->delimit_mode = fss_embedded_list_read_delimit_mode_all_e;
}
else {
main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_e;
- if (arguments->argv[location][length - 1] == fss_embedded_list_read_delimit_mode_name_greater_s.string[0]) {
+ if (argv[index][length - 1] == fss_embedded_list_read_delimit_mode_name_greater_s.string[0]) {
main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_greater_e;
// Shorten the length to better convert the remainder to a number.
--length;
}
- else if (arguments->argv[location][length - 1] == fss_embedded_list_read_delimit_mode_name_lesser_s.string[0]) {
+ else if (argv[index][length - 1] == fss_embedded_list_read_delimit_mode_name_lesser_s.string[0]) {
main->delimit_mode = fss_embedded_list_read_delimit_mode_depth_lesser_e;
// Shorten the length to better convert the remainder to a number.
f_string_range_t range = macro_f_string_range_t_initialize(length);
// Ignore leading plus sign.
- if (arguments->argv[location][0] == '+') {
+ if (argv[index][0] == f_string_ascii_plus_s[0]) {
++range.start;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[location], range, &main->delimit_depth);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &main->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_embedded_list_read_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_embedded_list_read_long_delimit_s, argv[index]);
}
}
}
if (fss_embedded_list_read_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
f_file_t file = f_file_t_initialize;
- status = f_file_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file);
+ status = f_file_open(argv[main->parameters.remaining.array[i]], f_string_empty_s, &file);
main->quantity.total = original_size;
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->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
if (!main->quantity.total) {
status = f_file_size_by_id(file.id, &main->quantity.total);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
f_file_stream_close(F_true, &file);
// Skip past empty files.
if (!main->quantity.total) {
if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
- fll_print_format("0%r", main->output.to.stream, f_string_eol_s);
+ fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
}
f_file_stream_close(F_true, &file);
f_file_stream_close(F_true, &file);
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->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
- status = fss_embedded_list_read_main_process_file(main, arguments, arguments->argv[main->parameters.remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments);
+ status = fss_embedded_list_read_main_process_file(main, arguments, argv[main->parameters.remaining.array[i]], depths, &objects_delimits, &contents_delimits, &comments);
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->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "fss_embedded_list_read_main_process_file", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
}
if (values_type[i] == fss_embedded_list_read_parameter_depth_e || values_type[i] == fss_embedded_list_read_parameter_at_e) {
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[values_order[i]]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(strlen(argv[values_order[i]]));
- status = fl_conversion_string_to_number_unsigned(arguments->argv[values_order[i]], range, &number);
+ status = fl_conversion_string_to_number_unsigned(argv[values_order[i]], range, &number);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_depth_s, arguments->argv[values_order[i]]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_depth_s, argv[values_order[i]]);
return status;
}
depths->array[depths->used].value_name.used = 0;
if (main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_found_e) {
- status = fl_string_rip(arguments->argv[values_order[i]], strnlen(arguments->argv[values_order[i]], F_console_parameter_size_d), &depths->array[depths->used].value_name);
+ status = fl_string_rip(argv[values_order[i]], strnlen(argv[values_order[i]], F_console_parameter_size_d), &depths->array[depths->used].value_name);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "fl_string_rip", F_true);
}
}
else {
- status = f_string_append(arguments->argv[values_order[i]], strnlen(arguments->argv[values_order[i]], F_console_parameter_size_d), &depths->array[depths->used].value_name);
+ status = f_string_append(argv[values_order[i]], strnlen(argv[values_order[i]], F_console_parameter_size_d), &depths->array[depths->used].value_name);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
// Requested depths cannot be greater than contents depth.
if (depths.used > main->nest.used) {
if (main->parameters.array[fss_embedded_list_read_parameter_total_e].result == f_console_result_found_e) {
- fll_print_format("0%r", main->output.to.stream, f_string_eol_s);
+ fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
return F_none;
}
if (main->parameters.array[fss_embedded_list_read_parameter_select_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_select_e].values.array[main->parameters.array[fss_embedded_list_read_parameter_select_e].values.used - 1];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[index]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[index]);
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &select);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &select);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_select_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_select_s, argv[index]);
return status;
}
// This standard does not support multiple content groups.
- if (select > 0) {
+ if (select) {
return F_none;
}
}
if (main->parameters.array[fss_embedded_list_read_parameter_line_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_embedded_list_read_parameter_line_e].values.array[main->parameters.array[fss_embedded_list_read_parameter_line_e].values.used - 1];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[index]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &line);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &line);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_line_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_read_long_line_s, argv[index]);
return status;
}
status = F_status_set_error(F_parameter);
}
else {
- const f_array_length_t location = main->parameters.array[fss_embedded_list_write_parameter_file_e].values.array[0];
+ const f_array_length_t index = main->parameters.array[fss_embedded_list_write_parameter_file_e].values.array[0];
output.id = -1;
output.stream = 0;
- status = f_file_stream_open(arguments->argv[location], 0, &output);
+ status = f_file_stream_open(argv[index], f_string_empty_s, &output);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[location], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
}
}
}
}
else if (main->parameters.array[fss_embedded_list_write_parameter_prepend_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_embedded_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_embedded_list_write_parameter_prepend_e].values.used - 1];
- const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d);
- if (length) {
- f_string_range_t range = macro_f_string_range_t_initialize(length);
+ if (argv[index].used) {
+ f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
- for (; range.start < length; ++range.start) {
+ for (; range.start < argv[index].used; ++range.start) {
status = f_fss_is_space(main->parameter->arguments.array[index], range);
if (F_status_is_error(status)) break;
}
f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
- f_string_dynamic_t object = f_string_dynamic_t_initialize;
- f_string_dynamic_t content = f_string_dynamic_t_initialize;
if (F_status_is_error_not(status)) {
- f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
f_string_ranges_t ignore = f_string_ranges_t_initialize;
if (main->process_pipe) {
break;
}
- object.string = arguments->argv[main->parameters.array[fss_embedded_list_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- status = fss_embedded_list_write_process(main, output, quote, &object, 0, 0, &buffer);
+ status = fss_embedded_list_write_process(main, output, quote, &argv[main->parameters.array[fss_embedded_list_write_parameter_object_e].values.array[i]], 0, 0, &buffer);
if (F_status_is_error(status)) break;
} // for
}
status = fss_embedded_list_write_process_parameter_ignore(main, arguments, main->parameters.array[fss_embedded_list_write_parameter_content_e].locations, i, &ignore);
if (F_status_is_error(status)) break;
- content.string = arguments->argv[main->parameters.array[fss_embedded_list_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_embedded_list_write_process(main, output, quote, 0, &content, &ignore, &buffer);
+ status = fss_embedded_list_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_embedded_list_write_parameter_content_e].values.array[i]], &ignore, &buffer);
if (F_status_is_error(status)) break;
} // for
}
status = fss_embedded_list_write_process_parameter_ignore(main, arguments, main->parameters.array[fss_embedded_list_write_parameter_content_e].locations, i, &ignore);
if (F_status_is_error(status)) break;
- object.string = arguments->argv[main->parameters.array[fss_embedded_list_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- content.string = arguments->argv[main->parameters.array[fss_embedded_list_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_embedded_list_write_process(main, output, quote, &object, &content, &ignore, &buffer);
+ status = fss_embedded_list_write_process(main, output, quote, &argv[main->parameters.array[fss_embedded_list_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_embedded_list_write_parameter_content_e].values.array[i]], &ignore, &buffer);
if (F_status_is_error(status)) break;
} // for
}
}
}
- f_string_dynamic_resize(0, &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.string = 0;
- object.used = 0;
- object.size = 0;
-
- content.string = 0;
- content.used = 0;
- content.size = 0;
}
if (main->parameters.array[fss_embedded_list_write_parameter_file_e].result == f_console_result_additional_e) {
}
f_string_dynamic_resize(0, &buffer);
- f_string_dynamic_resize(0, &object);
- f_string_dynamic_resize(0, &content);
fss_embedded_list_write_main_delete(main);
return status;
index = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].values.array[i * 2];
range.start = 0;
- range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1;
+ range.stop = argv[index].used - 1;
// allow and ignore the positive sign.
- if (range.stop > 0 && arguments->argv[index][0] == '+') {
+ if (range.stop && argv[index][0] == f_string_ascii_plus_s[0]) {
range.start = 1;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &number);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]);
return status;
}
index = main->parameters.array[fss_embedded_list_write_parameter_ignore_e].values.array[(i * 2) + 1];
range.start = 0;
- range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1;
+ range.stop = argv[index].used - 1;
- // allow and ignore the positive sign.
- if (range.stop > 0 && arguments->argv[index][0] == '+') {
+ // Allow and ignore the positive sign.
+ if (range.stop && argv[index][0] == f_string_ascii_plus_s[0]) {
range.start = 1;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &number);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number);
if (F_status_is_error(status)) {
- fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_embedded_list_write_long_ignore_s, argv[index]);
return status;
}
}
if (F_status_is_error_not(status) && main->parameters.array[fss_extended_list_read_parameter_delimit_e].result == f_console_result_additional_e) {
- f_array_length_t location = 0;
+ f_array_length_t index = 0;
f_array_length_t length = 0;
// Set the value to 0 to allow for detecting mode based on what is provided.
break;
}
- location = main->parameters.array[fss_extended_list_read_parameter_delimit_e].values.array[i];
- length = strnlen(arguments->argv[location], F_console_parameter_size_d);
+ index = main->parameters.array[fss_extended_list_read_parameter_delimit_e].values.array[i];
+ length = argv[index].used;
if (!length) {
flockfile(main->error.to.stream);
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) {
+ else if (fl_string_dynamic_compare_string(fss_extended_list_read_delimit_mode_name_none_s.string, argv[index], fss_extended_list_read_delimit_mode_name_none_s.used) == F_equal_to) {
data.delimit_mode = fss_extended_list_read_delimit_mode_none_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_extended_list_read_delimit_mode_name_all_s, length, fss_extended_list_read_delimit_mode_name_all_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_extended_list_read_delimit_mode_name_all_s.string, argv[index], fss_extended_list_read_delimit_mode_name_all_s.used) == F_equal_to) {
data.delimit_mode = fss_extended_list_read_delimit_mode_all_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_extended_list_read_delimit_mode_name_object_s, length, fss_extended_list_read_delimit_mode_name_object_s_length) == F_equal_to) {
+ else if (fl_string_dynamic_compare_string(fss_extended_list_read_delimit_mode_name_object_s.string, argv[index], fss_extended_list_read_delimit_mode_name_object_s.used) == F_equal_to) {
switch (data.delimit_mode) {
case 0:
data.delimit_mode = fss_extended_list_read_delimit_mode_object_e;
data.delimit_mode = fss_extended_list_read_delimit_mode_content_object_e;
}
- if (arguments->argv[location][length - 1] == fss_extended_list_read_delimit_mode_name_greater_s.string[0]) {
+ if (argv[index][length - 1] == fss_extended_list_read_delimit_mode_name_greater_s.string[0]) {
if (!(data.delimit_mode == fss_extended_list_read_delimit_mode_none_e || data.delimit_mode == fss_extended_list_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_extended_list_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_extended_list_read_delimit_mode_content_greater_object_e;
// Shorten the length to better convert the remainder to a number.
--length;
}
- else if (arguments->argv[location][length - 1] == fss_extended_list_read_delimit_mode_name_lesser_s.string[0]) {
+ else if (argv[index][length - 1] == fss_extended_list_read_delimit_mode_name_lesser_s.string[0]) {
if (!(data.delimit_mode == fss_extended_list_read_delimit_mode_none_e || data.delimit_mode == fss_extended_list_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_extended_list_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_extended_list_read_delimit_mode_content_lesser_object_e;
f_string_range_t range = macro_f_string_range_t_initialize(length);
// Ignore leading plus sign.
- if (arguments->argv[location][0] == '+') {
+ if (argv[index][0] == f_string_ascii_plus_s[0]) {
++range.start;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[location], range, &data.delimit_depth);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, 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_extended_list_read_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_extended_list_read_long_delimit_s, argv[index]);
break;
}
file.stream = 0;
file.id = -1;
- status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file);
+ status = f_file_stream_open(argv[main->parameters.remaining.array[i]], 0, &file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
status = f_file_size_by_id(file.id, &size_file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_file_stream_read(file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
else if (data.buffer.used > data.files.array[data.files.used].range.start) {
- data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]];
+ data.files.array[data.files.used].name = argv[main->parameters.remaining.array[i]];
data.files.array[data.files.used++].range.stop = data.buffer.used - 1;
// This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter.
else {
position_depth = main->parameters.array[fss_extended_list_read_parameter_depth_e].values.array[i];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[position_depth]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[position_depth].used);
- status = fl_conversion_string_to_number_unsigned(arguments->argv[position_depth], range, &data->depths.array[i].depth);
+ status = fl_conversion_string_to_number_unsigned(argv[position_depth].string, 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_extended_list_read_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_extended_list_read_long_depth_s, argv[position_depth]);
return status;
}
data->depths.array[i].index_at = main->parameters.array[fss_extended_list_read_parameter_at_e].values.array[position_at];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[data->depths.array[i].index_at]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[data->depths.array[i].index_at].used);
- status = fl_conversion_string_to_number_unsigned(arguments->argv[data->depths.array[i].index_at], range, &data->depths.array[i].value_at);
+ status = fl_conversion_string_to_number_unsigned(argv[data->depths.array[i].index_at].string, 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_extended_list_read_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_extended_list_read_long_at_s, argv[data->depths.array[i].index_at]);
return status;
}
data->depths.array[i].index_name = main->parameters.array[fss_extended_list_read_parameter_name_e].values.array[position_name];
if (main->parameters.array[fss_extended_list_read_parameter_trim_e].result == f_console_result_found_e) {
- status = fl_string_rip(arguments->argv[data->depths.array[i].index_name], strlen(arguments->argv[data->depths.array[i].index_name]), &data->depths.array[i].value_name);
+ status = fl_string_dynamic_rip(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
}
else {
- status = f_string_append(arguments->argv[data->depths.array[i].index_name], strlen(arguments->argv[data->depths.array[i].index_name]), &data->depths.array[i].value_name);
+ status = f_string_dynamic_append(argv[data->depths.array[i].index_name], &data->depths.array[i].value_name);
}
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), main->parameters.array[fss_extended_list_read_parameter_trim_e].result == f_console_result_found_e ? "fl_string_rip" : "f_string_append", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), main->parameters.array[fss_extended_list_read_parameter_trim_e].result == f_console_result_found_e ? "fl_string_dynamic_rip" : "f_string_dynamic_append", F_true);
return status;
}
if (main->parameters.array[parameter].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[parameter].values.array[main->parameters.array[parameter].values.used - 1];
- const f_string_range_t range = macro_f_string_range_t_initialize(strnlen(arguments->argv[index], F_console_parameter_size_d));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
- const f_status_t status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, number);
+ const f_status_t status = fl_conversion_string_to_number_unsigned(argv[index].string, range, number);
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, name, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, name, argv[index]);
return status;
}
status = F_status_set_error(F_parameter);
}
else {
- const f_array_length_t location = main->parameters.array[fss_extended_list_write_parameter_file_e].values.array[0];
+ const f_array_length_t index = main->parameters.array[fss_extended_list_write_parameter_file_e].values.array[0];
output.id = -1;
output.stream = 0;
- status = f_file_stream_open(arguments->argv[location], 0, &output);
+ status = f_file_stream_open(argv[index], f_string_empty_s, &output);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[location], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
}
}
}
}
else if (main->parameters.array[fss_extended_list_write_parameter_prepend_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_extended_list_write_parameter_prepend_e].values.array[main->parameters.array[fss_extended_list_write_parameter_prepend_e].values.used - 1];
- const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d);
+ const f_array_length_t length = strnlen(argv[index], F_console_parameter_size_d);
if (length) {
f_string_range_t range = macro_f_string_range_t_initialize(length);
- main->prepend.string = arguments->argv[index];
+ main->prepend.string = argv[index];
main->prepend.used = length;
main->prepend.size = length;
}
f_string_dynamic_t buffer = f_string_dynamic_t_initialize;
- f_string_dynamic_t object = f_string_dynamic_t_initialize;
- f_string_dynamic_t content = f_string_dynamic_t_initialize;
if (F_status_is_error_not(status)) {
- f_string_dynamic_t escaped = f_string_dynamic_t_initialize;
f_string_ranges_t ignore = f_string_ranges_t_initialize;
if (main->process_pipe) {
break;
}
- object.string = arguments->argv[main->parameters.array[fss_extended_list_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- status = fss_extended_list_write_process(main, output, quote, &object, 0, 0, &buffer);
+ status = fss_extended_list_write_process(main, output, quote, &argv[main->parameters.array[fss_extended_list_write_parameter_object_e].values.array[i]], 0, 0, &buffer);
if (F_status_is_error(status)) break;
} // for
}
status = fss_extended_list_write_process_parameter_ignore(main, arguments, main->parameters.array[fss_extended_list_write_parameter_content_e].locations, i, &ignore);
if (F_status_is_error(status)) break;
- content.string = arguments->argv[main->parameters.array[fss_extended_list_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_extended_list_write_process(main, output, quote, 0, &content, &ignore, &buffer);
+ status = fss_extended_list_write_process(main, output, quote, 0, &argv[main->parameters.array[fss_extended_list_write_parameter_content_e].values.array[i]], &ignore, &buffer);
if (F_status_is_error(status)) break;
} // for
}
status = fss_extended_list_write_process_parameter_ignore(main, arguments, main->parameters.array[fss_extended_list_write_parameter_content_e].locations, i, &ignore);
if (F_status_is_error(status)) break;
- object.string = arguments->argv[main->parameters.array[fss_extended_list_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- content.string = arguments->argv[main->parameters.array[fss_extended_list_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = fss_extended_list_write_process(main, output, quote, &object, &content, &ignore, &buffer);
+ status = fss_extended_list_write_process(main, output, quote, &argv[main->parameters.array[fss_extended_list_write_parameter_object_e].values.array[i]], &argv[main->parameters.array[fss_extended_list_write_parameter_content_e].values.array[i]], &ignore, &buffer);
if (F_status_is_error(status)) break;
} // for
}
}
}
- f_string_dynamic_resize(0, &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.string = 0;
- object.used = 0;
- object.size = 0;
-
- content.string = 0;
- content.used = 0;
- content.size = 0;
}
if (main->parameters.array[fss_extended_list_write_parameter_file_e].result == f_console_result_additional_e) {
}
f_string_dynamic_resize(0, &buffer);
- f_string_dynamic_resize(0, &object);
- f_string_dynamic_resize(0, &content);
fss_extended_list_write_main_delete(main);
return status;
index = main->parameters.array[fss_extended_list_write_parameter_ignore_e].values.array[i * 2];
range.start = 0;
- range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1;
+ range.stop = strnlen(argv[index], F_console_parameter_size_d) - 1;
// allow and ignore the positive sign.
- if (range.stop > 0 && arguments->argv[index][0] == '+') {
+ if (range.stop > 0 && argv[index][0] == '+') {
range.start = 1;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &number);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number);
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_list_write_long_ignore_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]);
return status;
}
index = main->parameters.array[fss_extended_list_write_parameter_ignore_e].values.array[(i * 2) + 1];
range.start = 0;
- range.stop = strnlen(arguments->argv[index], F_console_parameter_size_d) - 1;
+ range.stop = strnlen(argv[index], F_console_parameter_size_d) - 1;
// allow and ignore the positive sign.
- if (range.stop > 0 && arguments->argv[index][0] == '+') {
+ if (range.stop > 0 && argv[index][0] == '+') {
range.start = 1;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &number);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number);
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_list_write_long_ignore_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, fss_extended_list_write_long_ignore_s, argv[index]);
return status;
}
}
location = main->parameters.array[fss_extended_read_parameter_delimit_e].values.array[i];
- length = strnlen(arguments->argv[location], F_console_parameter_size_d);
+ length = strnlen(argv[location], F_console_parameter_size_d);
if (!length) {
flockfile(main->error.to.stream);
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) {
+ else if (fl_string_compare(argv[location], fss_extended_read_delimit_mode_name_none, length, fss_extended_read_delimit_mode_name_none_length) == F_equal_to) {
data.delimit_mode = fss_extended_read_delimit_mode_none_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_extended_read_delimit_mode_name_all, length, fss_extended_read_delimit_mode_name_all_length) == F_equal_to) {
+ else if (fl_string_compare(argv[location], fss_extended_read_delimit_mode_name_all, length, fss_extended_read_delimit_mode_name_all_length) == F_equal_to) {
data.delimit_mode = fss_extended_read_delimit_mode_all_e;
}
- else if (fl_string_compare(arguments->argv[location], fss_extended_read_delimit_mode_name_object, length, fss_extended_read_delimit_mode_name_object_length) == F_equal_to) {
+ else if (fl_string_compare(argv[location], fss_extended_read_delimit_mode_name_object, length, fss_extended_read_delimit_mode_name_object_length) == F_equal_to) {
switch (data.delimit_mode) {
case 0:
data.delimit_mode = fss_extended_read_delimit_mode_object_e;
data.delimit_mode = fss_extended_read_delimit_mode_content_object_e;
}
- if (arguments->argv[location][length - 1] == fss_extended_read_delimit_mode_name_greater[0]) {
+ if (argv[location][length - 1] == fss_extended_read_delimit_mode_name_greater[0]) {
if (!(data.delimit_mode == fss_extended_read_delimit_mode_none_e || data.delimit_mode == fss_extended_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_extended_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_extended_read_delimit_mode_content_greater_object_e;
// Shorten the length to better convert the remainder to a number.
--length;
}
- else if (arguments->argv[location][length - 1] == fss_extended_read_delimit_mode_name_lesser[0]) {
+ else if (argv[location][length - 1] == fss_extended_read_delimit_mode_name_lesser[0]) {
if (!(data.delimit_mode == fss_extended_read_delimit_mode_none_e || data.delimit_mode == fss_extended_read_delimit_mode_all_e)) {
if (data.delimit_mode == fss_extended_read_delimit_mode_content_object_e) {
data.delimit_mode = fss_extended_read_delimit_mode_content_lesser_object_e;
f_string_range_t range = macro_f_string_range_t_initialize(length);
// Ignore leading plus sign.
- if (arguments->argv[location][0] == '+') {
+ if (argv[location][0] == '+') {
++range.start;
}
- status = fl_conversion_string_to_number_unsigned(arguments->argv[location], range, &data.delimit_depth);
+ status = fl_conversion_string_to_number_unsigned(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_extended_read_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_extended_read_long_delimit_s, argv[location]);
break;
}
file.stream = 0;
file.id = -1;
- status = f_file_stream_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file);
+ status = f_file_stream_open(argv[main->parameters.remaining.array[i]], 0, &file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_open_s, fll_error_file_type_file_e);
break;
}
status = f_file_size_by_id(file.id, &size_file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_string_dynamic_resize(data.buffer.size + size_file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_string_dynamic_resize", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
status = f_file_stream_read(file, &data.buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_read", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_read_s, fll_error_file_type_file_e);
break;
}
if (data.buffer.used > data.files.array[data.files.used].range.start) {
- data.files.array[data.files.used].name = arguments->argv[main->parameters.remaining.array[i]];
+ data.files.array[data.files.used].name = argv[main->parameters.remaining.array[i]];
data.files.array[data.files.used++].range.stop = data.buffer.used - 1;
// This standard is newline sensitive, when appending files to the buffer if the file lacks a final newline then this could break the format for files appended thereafter.
status = F_status_set_error(F_parameter);
}
else {
- const f_array_length_t location = main->parameters.array[fss_extended_write_parameter_file_e].values.array[0];
+ const f_array_length_t index = main->parameters.array[fss_extended_write_parameter_file_e].values.array[0];
output.id = -1;
output.stream = 0;
- status = f_file_stream_open(arguments->argv[location], 0, &output);
+ status = f_file_stream_open(argv[index], f_string_empty_s, &output);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[location], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
}
}
}
}
else if (main->parameters.array[fss_extended_write_parameter_prepend_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[fss_extended_write_parameter_prepend_e].values.array[main->parameters.array[fss_extended_write_parameter_prepend_e].values.used - 1];
- const f_array_length_t length = strnlen(arguments->argv[index], F_console_parameter_size_d);
// Even though this standard does not utilize this parameter, provide the validation for consistency.
- if (length) {
- f_string_range_t range = macro_f_string_range_t_initialize(length);
- const f_string_static_t prepend = macro_f_string_static_t_initialize2(arguments->argv[index], length);
+ if (argv[index].used) {
+ f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
for (; range.start < length; ++range.start) {
- status = f_fss_is_space(prepend, range);
+ status = f_fss_is_space(argv[index], range);
if (F_status_is_error(status)) break;
if (status == F_false) {
signal_check = 0;
}
- object.string = arguments->argv[main->parameters.array[fss_extended_write_parameter_object_e].values.array[i]];
+ object.string = argv[main->parameters.array[fss_extended_write_parameter_object_e].values.array[i]];
object.used = strnlen(object.string, F_console_parameter_size_d);
object.size = object.used;
for (; i < main->parameters.array[fss_extended_write_parameter_content_e].values.used; ++i) {
- contents.array[contents.used].string = arguments->argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[i]];
+ contents.array[contents.used].string = argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[i]];
contents.array[contents.used].used = strnlen(contents.array[contents.used].string, F_console_parameter_size_d);
contents.array[contents.used].size = contents.array[contents.used].used;
++contents.used;
object_next = main->parameters.array[fss_extended_write_parameter_object_e].locations.array[i + 1];
}
- object.string = arguments->argv[main->parameters.array[fss_extended_write_parameter_object_e].values.array[i]];
+ object.string = argv[main->parameters.array[fss_extended_write_parameter_object_e].values.array[i]];
object.used = strnlen(object.string, F_console_parameter_size_d);
object.size = object.used;
contents.array[contents.used].used = 0;
}
- status = f_string_append(arguments->argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[j]], strnlen(arguments->argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[j]], F_console_parameter_size_d), &contents.array[contents.used]);
+ status = f_string_append(argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[j]], strnlen(argv[main->parameters.array[fss_extended_write_parameter_content_e].values.array[j]], F_console_parameter_size_d), &contents.array[contents.used]);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "f_string_append", F_true);
f_print(id.name, id.used, main->output.to.stream);
if (main->parameters.array[fss_identify_parameter_object_e].result != f_console_result_found_e || main->parameters.array[fss_identify_parameter_content_e].result == f_console_result_found_e) {
- f_print_terminated(f_fss_type_header_part5_s, main->output.to.stream);
+ f_print_dynamic_raw(f_fss_type_header_part5_s, main->output.to.stream);
}
}
extern "C" {
#endif
+#ifndef _di_fss_status_code_program_version_
+ const f_string_static_t fss_status_code_program_version_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_version_s, 0, FSS_STATUS_CODE_program_version_s_length);
+#endif // _di_fss_status_code_program_version_
+
+#ifndef _di_fss_status_code_program_name_
+ const f_string_static_t fss_status_code_program_name_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_name_s, 0, FSS_STATUS_CODE_program_name_s_length);
+ const f_string_static_t fss_status_code_program_name_long_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_name_long_s, 0, FSS_STATUS_CODE_program_name_long_s_length);
+#endif // _di_fss_status_code_program_name_
+
#ifndef _di_fss_status_code_program_help_parameters_
const f_string_static_t fss_status_code_program_help_parameters_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_help_parameters_s, 0, FSS_STATUS_CODE_program_help_parameters_s_length);
#endif // _di_fss_status_code_program_help_parameters_
* The program version.
*/
#ifndef _di_fss_status_code_program_version_
- #define FSS_STATUS_code_program_version_major_s F_string_ascii_0_s
- #define FSS_STATUS_code_program_version_minor_s F_string_ascii_5_s
- #define FSS_STATUS_code_program_version_micro_s F_string_ascii_8_s
+ #define FSS_STATUS_CODE_program_version_major_s F_string_ascii_0_s
+ #define FSS_STATUS_CODE_program_version_minor_s F_string_ascii_5_s
+ #define FSS_STATUS_CODE_program_version_micro_s F_string_ascii_8_s
- #define FSS_STATUS_code_program_version_major_s_length F_string_ascii_0_s_length
- #define FSS_STATUS_code_program_version_minor_s_length F_string_ascii_5_s_length
- #define FSS_STATUS_code_program_version_micro_s_length F_string_ascii_8_s_length
+ #define FSS_STATUS_CODE_program_version_major_s_length F_string_ascii_0_s_length
+ #define FSS_STATUS_CODE_program_version_minor_s_length F_string_ascii_5_s_length
+ #define FSS_STATUS_CODE_program_version_micro_s_length F_string_ascii_8_s_length
- #if !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length))
- #define FSS_STATUS_program_version_nano_prefix_s
- #define FSS_STATUS_program_version_nano_prefix_s_length 0
- #endif // !(defined(FSS_STATUS_program_version_nano_prefix_s) && defined(FSS_STATUS_program_version_nano_prefix_s_length))
+ #if !(defined(FSS_STATUS_CODE_program_version_nano_prefix_s) && defined(FSS_STATUS_CODE_program_version_nano_prefix_s_length))
+ #define FSS_STATUS_CODE_program_version_nano_prefix_s
+ #define FSS_STATUS_CODE_program_version_nano_prefix_s_length 0
+ #endif // !(defined(FSS_STATUS_CODE_program_version_nano_prefix_s) && defined(FSS_STATUS_CODE_program_version_nano_prefix_s_length))
- #if !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length))
- #define FSS_STATUS_program_version_nano_s
- #define FSS_STATUS_program_version_nano_s_length 0
- #endif // !(defined(FSS_STATUS_program_version_nano_s) && defined(FSS_STATUS_program_version_nano_s_length))
+ #if !(defined(FSS_STATUS_CODE_program_version_nano_s) && defined(FSS_STATUS_CODE_program_version_nano_s_length))
+ #define FSS_STATUS_CODE_program_version_nano_s
+ #define FSS_STATUS_CODE_program_version_nano_s_length 0
+ #endif // !(defined(FSS_STATUS_CODE_program_version_nano_s) && defined(FSS_STATUS_CODE_program_version_nano_s_length))
- #define FSS_STATUS_code_program_version_length_s FSS_STATUS_code_program_version_major_s F_string_ascii_period_s FSS_STATUS_code_program_version_minor_s F_string_ascii_period_s FSS_STATUS_code_program_version_micro_s FSS_STATUS_code_program_version_nano_prefix_s FSS_STATUS_code_program_version_nano_s
+ #define FSS_STATUS_CODE_program_version_s FSS_STATUS_CODE_program_version_major_s F_string_ascii_period_s FSS_STATUS_CODE_program_version_minor_s F_string_ascii_period_s FSS_STATUS_CODE_program_version_micro_s FSS_STATUS_CODE_program_version_nano_prefix_s FSS_STATUS_CODE_program_version_nano_s
+
+ #define FSS_STATUS_CODE_program_version_s_length FSS_STATUS_CODE_program_version_major_s_length + F_string_ascii_period_s_length + FSS_STATUS_CODE_program_version_minor_s_length + F_string_ascii_period_s_length + FSS_STATUS_CODE_program_version_micro_s_length + FSS_STATUS_CODE_program_version_nano_prefix_s_length + FSS_STATUS_CODE_program_version_nano_s_length
extern const f_string_static_t fss_status_code_program_version_s;
#endif // _di_fss_status_code_program_version_
* The program name.
*/
#ifndef _di_fss_status_code_program_name_
- #define FSS_STATUS_code_program_name_s "FSS_STATUS_code"
- #define FSS_STATUS_code_program_name_long_s "FSS Status Code"
+ #define FSS_STATUS_CODE_program_name_s "fss_status_code"
+ #define FSS_STATUS_CODE_program_name_long_s "FSS Status Code"
- #define FSS_STATUS_CODE_program_name_s_length
- #define FSS_STATUS_CODE_program_name_long_s_length
+ #define FSS_STATUS_CODE_program_name_s_length 15
+ #define FSS_STATUS_CODE_program_name_long_s_length 15
const f_string_static_t fss_status_code_program_name_s;
const f_string_static_t fss_status_code_program_name_long_s;
extern "C" {
#endif
-#ifndef _di_fss_status_code_program_version_
- const f_string_static_t fss_status_code_program_version_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_version_s, 0, FSS_STATUS_CODE_program_version_s_length);
-#endif // _di_fss_status_code_program_version_
-
-#ifndef _di_fss_status_code_program_name_
- const f_string_static_t fss_status_code_program_name_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_name_s, 0, FSS_STATUS_CODE_program_name_s_length);
- const f_string_static_t fss_status_code_program_name_long_s = macro_f_string_static_t_initialize(FSS_STATUS_CODE_program_name_long_s, 0, FSS_STATUS_CODE_program_name_long_s_length);
-#endif // _di_fss_status_code_program_name_
-
#ifndef _di_fss_status_code_print_help_
f_status_t fss_status_code_print_help(const f_file_t file, const f_color_context_t context) {
if (F_status_is_error(status)) {
fss_status_code_main_delete(main);
+
return F_status_set_error(status);
}
}
if (F_status_is_error(status)) {
fss_status_code_main_delete(main);
+
return status;
}
fss_status_code_print_help(main->output.to, main->context);
fss_status_code_main_delete(main);
+
return F_none;
}
fll_program_print_version(main->output.to, fss_status_code_program_version_s);
fss_status_code_main_delete(main);
+
return F_none;
}
funlockfile(main->error.to.stream);
fss_status_code_main_delete(main);
+
return F_status_set_error(status);
}
- else if (main->parameters.array[fss_status_code_parameter_is_fine_e].result == f_console_result_found_e) {
+
+ if (main->parameters.array[fss_status_code_parameter_is_fine_e].result == f_console_result_found_e) {
flockfile(main->error.to.stream);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
funlockfile(main->error.to.stream);
fss_status_code_main_delete(main);
+
return F_status_set_error(status);
}
}
funlockfile(main->error.to.stream);
fss_status_code_main_delete(main);
+
return F_status_set_error(status);
}
fll_print_format("%[You failed to specify an error code.%]%r", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s);
fss_status_code_main_delete(main);
+
return F_status_set_error(F_parameter);
}
if (!((++signal_check) % fss_status_code_signal_check_d)) {
if (fss_status_code_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
signal_check = 0;
}
- status2 = fss_status_code_process_check(main, arguments->argv[main->parameters.remaining.array[i]]);
+ status2 = fss_status_code_process_check(main, argv[main->parameters.remaining.array[i]]);
if (F_status_is_error(status2) && status == F_none) {
status = status2;
if (!((++signal_check) % fss_status_code_signal_check_d)) {
if (fss_status_code_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
signal_check = 0;
}
- status2 = fss_status_code_process_number(main, arguments->argv[main->parameters.remaining.array[i]]);
+ status2 = fss_status_code_process_number(main, argv[main->parameters.remaining.array[i]]);
if (F_status_is_error(status2) && status == F_none) {
status = status2;
if (!((++signal_check) % fss_status_code_signal_check_d)) {
if (fss_status_code_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
signal_check = 0;
}
- status2 = fss_status_code_process_normal(main, arguments->argv[main->parameters.remaining.array[i]]);
+ status2 = fss_status_code_process_normal(main, argv[main->parameters.remaining.array[i]]);
if (F_status_is_error(status2) && status == F_none) {
status = status2;
#endif
#ifndef _di_fss_status_code_process_check_
- f_status_t fss_status_code_process_check(fll_program_data_t * const main, const f_string_t value) {
+ f_status_t fss_status_code_process_check(fll_program_data_t * const main, const f_string_static_t value) {
f_number_unsigned_t number = 0;
if (main->parameters.array[fss_status_code_parameter_is_error_e].result == f_console_result_found_e) {
if (F_status_is_error(number)) {
- f_print_terminated(f_status_true_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_true_s, main->output.to.stream);
}
else {
- f_print_terminated(f_status_false_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_false_s, main->output.to.stream);
}
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
else if (main->parameters.array[fss_status_code_parameter_is_warning_e].result == f_console_result_found_e) {
if (F_status_is_warning(number)) {
- f_print_terminated(f_status_true_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_true_s, main->output.to.stream);
}
else {
- f_print_terminated(f_status_false_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_false_s, main->output.to.stream);
}
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
else if (main->parameters.array[fss_status_code_parameter_is_fine_e].result == f_console_result_found_e) {
if (F_status_is_fine(number)) {
- f_print_terminated(f_status_true_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_true_s, main->output.to.stream);
}
else {
- f_print_terminated(f_status_false_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_false_s, main->output.to.stream);
}
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
#endif // _di_fss_status_code_process_check_
#ifndef _di_fss_status_code_process_number_
- f_status_t fss_status_code_process_number(fll_program_data_t * const main, const f_string_t value) {
+ f_status_t fss_status_code_process_number(fll_program_data_t * const main, const f_string_static_t value) {
f_status_t status = F_none;
{
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value));
+ const f_string_range_t range = macro_f_string_range_t_initialize(value.used);
f_number_unsigned_t number = 0;
- status = fl_conversion_string_to_number_unsigned(value, range, &number);
+ status = fl_conversion_string_to_number_unsigned(value.string, range, &number);
if (status == F_none) {
fl_print_format("%[invalid name%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
#endif // _di_fss_status_code_process_number_
#ifndef _di_fss_status_code_process_normal_
- f_status_t fss_status_code_process_normal(fll_program_data_t * const main, const f_string_t value) {
+ f_status_t fss_status_code_process_normal(fll_program_data_t * const main, const f_string_static_t value) {
f_number_unsigned_t number = 0;
f_status_t status = fss_status_code_convert_number(main, value, &number);
if (F_status_is_error(status)) return status;
- const f_status_t code = (f_status_t) number;
- f_string_t string = 0;
+ f_string_static_t name = f_string_static_t_initialize;
- status = fll_fss_status_string_to(code, &string);
+ status = fll_fss_status_string_to((f_status_t) number, &name);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
return status;
}
- fl_print_format("%S%r", main->output.to.stream, string, f_string_eol_s);
+ fl_print_format("%Q%r", main->output.to.stream, name, f_string_eol_s);
return F_none;
}
#endif // _di_fss_status_code_process_normal_
#ifndef _di_fss_status_code_convert_number_
- f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) {
+ f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) {
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value));
+ const f_string_range_t range = macro_f_string_range_t_initialize(value.used);
- f_status_t status = fl_conversion_string_to_number_unsigned(value, range, number);
+ f_status_t status = fl_conversion_string_to_number_unsigned(value.string, range, number);
if (*number > F_status_size_max_with_signal) {
fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
* @see fss_status_code_convert_number()
*/
#ifndef _di_fss_status_code_process_check_
- extern f_status_t fss_status_code_process_check(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d;
+ extern f_status_t fss_status_code_process_check(fll_program_data_t * const main, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_fss_status_code_process_check_
/**
* @see fll_fss_status_string_from()
*/
#ifndef _di_fss_status_code_process_number_
- extern f_status_t fss_status_code_process_number(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d;
+ extern f_status_t fss_status_code_process_number(fll_program_data_t * const main, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_fss_status_code_process_number_
/**
* @see fss_status_code_convert_number()
*/
#ifndef _di_fss_status_code_process_normal_
- extern f_status_t fss_status_code_process_normal(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d;
+ extern f_status_t fss_status_code_process_normal(fll_program_data_t * const main, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_fss_status_code_process_normal_
/**
* @see fl_console_parameter_to_number_unsigned()
*/
#ifndef _di_fss_status_code_convert_number_
- extern f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d;
+ extern f_status_t fss_status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d;
#endif // _di_fss_status_code_convert_number_
#ifdef __cplusplus
const f_string_static_t iki_read_long_whole_s = macro_f_string_static_t_initialize(IKI_READ_long_whole_s, 0, IKI_READ_long_whole_s_length);
#endif // _di_iki_read_parameters_
+#ifndef _di_iki_read_substitution_t_
+ #define IKI_READ_substitution_vocabulary_s "vocabulary"
+ #define IKI_READ_substitution_replace_s "replace"
+ #define IKI_READ_substitution_with_s "with"
+
+ #define IKI_READ_substitution_vocabulary_s_length 10
+ #define IKI_READ_substitution_replace_s_length 7
+ #define IKI_READ_substitution_with_s_length 4
+
+ const f_string_static_t iki_read_substitution_vocabulary_s = macro_f_string_static_t_initialize(IKI_READ_substitution_vocabulary_s, 0, IKI_READ_substitution_vocabulary_s_length);
+ const f_string_static_t iki_read_substitution_replace_s = macro_f_string_static_t_initialize(IKI_READ_substitution_replace_s, 0, IKI_READ_substitution_replace_s_length);
+ const f_string_static_t iki_read_substitution_with_s = macro_f_string_static_t_initialize(IKI_READ_substitution_with_s, 0, IKI_READ_substitution_with_s_length);
+#endif // _di_iki_read_substitution_t_
+
#ifndef _di_iki_read_main_delete_
f_status_t iki_read_main_delete(iki_read_main_t * const main) {
#define IKI_READ_program_version_s IKI_READ_program_version_major_s F_string_ascii_period_s IKI_READ_program_version_minor_s F_string_ascii_period_s IKI_READ_program_version_micro_s IKI_READ_program_version_nano_prefix_s IKI_READ_program_version_nano_s
- #define IKI_READ_program_version_s_length iki_read_program_version_major_s_length + F_string_ascii_period_s iki_read_program_version_minor_s_length + F_string_ascii_period_s_length + iki_read_program_version_micro_s_length + iki_read_program_version_nano_prefix_s_length + iki_read_program_version_nano_s_length
+ #define IKI_READ_program_version_s_length IKI_READ_program_version_major_s_length + F_string_ascii_period_s_length + IKI_READ_program_version_minor_s_length + F_string_ascii_period_s_length + IKI_READ_program_version_micro_s_length + IKI_READ_program_version_nano_prefix_s_length + IKI_READ_program_version_nano_s_length
extern const f_string_static_t iki_read_program_version_s;
#endif // _di_iki_read_program_version_
#define IKI_READ_program_name_s "iki_read"
#define IKI_READ_program_name_long_s "IKI Read"
- #define IKI_READ_program_name_s_length 9
- #define IKI_READ_program_name_long_s_length 9
+ #define IKI_READ_program_name_s_length 8
+ #define IKI_READ_program_name_long_s_length 8
extern const f_string_static_t iki_read_program_name_s;
extern const f_string_static_t iki_read_program_name_long_s;
#endif // _di_iki_read_parameters_
#ifndef _di_iki_read_substitution_t_
- #define iki_read_substitution_vocabulary_s "vocabulary"
- #define iki_read_substitution_replace_s "replace"
- #define iki_read_substitution_with_s "with"
+ #define IKI_READ_substitution_vocabulary_s "vocabulary"
+ #define IKI_READ_substitution_replace_s "replace"
+ #define IKI_READ_substitution_with_s "with"
+
+ #define IKI_READ_substitution_vocabulary_s_length 10
+ #define IKI_READ_substitution_replace_s_length 7
+ #define IKI_READ_substitution_with_s_length 4
+
+ extern const f_string_static_t iki_read_substitution_vocabulary_s;
+ extern const f_string_static_t iki_read_substitution_replace_s;
+ extern const f_string_static_t iki_read_substitution_with_s;
typedef struct {
f_string_static_t replace;
* The main program data.
*
* parameters: The state of pre-defined parameters passed to the program.
- * remaining: The remaining, non-pre-defined parameters, passed to the program.
* process_pipe: Designate whether or not to process the input pipe.
* output: The output file for general printing.
* error: The output file for error printing.
#define iki_read_main_t_initialize \
{ \
f_console_parameters_t_initialize, \
- f_array_lengths_t_initialize, \
F_false, \
fl_print_t_initialize, \
macro_fl_print_t_initialize_error(), \
fl_print_format(" %[Notes:%]%r", file.stream, context.set.important, context.set.important, f_string_eol_s);
fl_print_format(" This program will find and print variables, vocabularies, or content following the IKI standard, without focusing on any particular vocabulary specification.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
- fl_print_format(" This %[%r%s%] option, requires 3 additional parameters:", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.set.notable);
- fl_print_format(" %[<%]%s%[>%]", file.stream, context.set.notable, context.set.notable, iki_read_substitution_vocabulary_s, context.set.notable, context.set.notable);
- fl_print_format(" %[<%]%s%[>%]", file.stream, context.set.notable, context.set.notable, iki_read_substitution_replace_s, context.set.notable, context.set.notable);
- fl_print_format(" %[<%]%s%[>%].%r", file.stream, context.set.notable, context.set.notable, iki_read_substitution_with_s, context.set.notable, context.set.notable, f_string_eol_s);
+ fl_print_format(" This %[%r%r%] option, requires 3 additional parameters:", file.stream, context.set.notable, f_console_symbol_long_enable_s, iki_read_long_substitute_s, context.set.notable);
+ fl_print_format(" %[<%]%r%[>%]", file.stream, context.set.notable, context.set.notable, iki_read_substitution_vocabulary_s, context.set.notable, context.set.notable);
+ fl_print_format(" %[<%]%r%[>%]", file.stream, context.set.notable, context.set.notable, iki_read_substitution_replace_s, context.set.notable, context.set.notable);
+ fl_print_format(" %[<%]%r%[>%].%r", file.stream, context.set.notable, context.set.notable, iki_read_substitution_with_s, context.set.notable, context.set.notable, f_string_eol_s);
- fl_print_format(" %[%s%]: The name of the vocabulary whose content is to be substituted.%r", file.stream, context.set.notable, iki_read_substitution_vocabulary_s, context.set.notable, f_string_eol_s);
- fl_print_format(" %[%s%]: The content matching this exact string will be substituted.%r", file.stream, context.set.notable, iki_read_substitution_replace_s, context.set.notable, f_string_eol_s);
- fl_print_format(" %[%s%]: The new string to use as the substitute.%r%r", file.stream, context.set.notable, iki_read_substitution_with_s, context.set.notable, f_string_eol_s, f_string_eol_s);
+ fl_print_format(" %[%r%]: The name of the vocabulary whose content is to be substituted.%r", file.stream, context.set.notable, iki_read_substitution_vocabulary_s, context.set.notable, f_string_eol_s);
+ fl_print_format(" %[%r%]: The content matching this exact string will be substituted.%r", file.stream, context.set.notable, iki_read_substitution_replace_s, context.set.notable, f_string_eol_s);
+ fl_print_format(" %[%r%]: The new string to use as the substitute.%r%r", file.stream, context.set.notable, iki_read_substitution_with_s, context.set.notable, f_string_eol_s, f_string_eol_s);
fl_print_format(" The vocabulary and replacement are case-sensitive and must exactly match.%r%r", file.stream, f_string_eol_s, f_string_eol_s);
}
else if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[iki_read_parameter_at_e].values.array[main->parameters.array[iki_read_parameter_at_e].values.used - 1];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[index]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
f_number_unsigned_t number = 0;
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &number);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number);
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, F_console_symbol_long_enable_s iki_read_long_at_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_at_s, argv[index]);
status = F_status_set_error(F_parameter);
}
}
else if (main->parameters.array[iki_read_parameter_line_e].result == f_console_result_additional_e) {
const f_array_length_t index = main->parameters.array[iki_read_parameter_line_e].values.array[main->parameters.array[iki_read_parameter_line_e].values.used - 1];
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(arguments->argv[index]));
+ const f_string_range_t range = macro_f_string_range_t_initialize(argv[index].used);
f_number_unsigned_t number = 0;
- status = fl_conversion_string_to_number_unsigned(arguments->argv[index], range, &number);
+ status = fl_conversion_string_to_number_unsigned(argv[index].string, range, &number);
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, F_console_symbol_long_enable_s iki_read_long_line_s, arguments->argv[index]);
+ fll_error_parameter_integer_print(main->error, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", F_true, iki_read_long_line_s, argv[index]);
status = F_status_set_error(F_parameter);
}
main->mode = iki_read_mode_total_e;
}
else {
- // this is the default behavior, so there is no reason to check for the -c/--content parameter.
+
+ // This is the default behavior, so there is no reason to check for the -c/--content parameter.
main->mode = iki_read_mode_content_e;
}
status = f_file_read(file, &main->buffer);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, "-", f_file_operation_process_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read", F_true, f_string_ascii_minus_s, f_file_operation_process_s, fll_error_file_type_file_e);
}
else {
- status = iki_read_process_buffer(main, arguments, "-");
+ status = iki_read_process_buffer(main);
}
// Clear buffers before continuing.
}
if (F_status_is_fine(status) && main->parameters.remaining.used > 0) {
- f_array_length_t i = 0;
+ uint16_t signal_check = 0;
f_array_length_t total = 0;
f_file_t file = f_file_t_initialize;
- for (uint16_t signal_check = 0; i < main->parameters.remaining.used; ++i) {
+ for (f_array_length_t i = 0; i < main->parameters.remaining.used; ++i) {
if (!((++signal_check) % iki_read_signal_check_d)) {
if (iki_read_signal_received(main)) {
status = F_status_set_error(F_interrupt);
+
break;
}
macro_f_file_t_reset(file);
total = 0;
- status = f_file_open(arguments->argv[main->parameters.remaining.array[i]], 0, &file);
+ status = f_file_open(argv[main->parameters.remaining.array[i]], 0, &file);
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->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_open", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
+
break;
}
status = f_file_size_by_id(file.id, &total);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, arguments->argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_size_by_id", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
f_file_stream_close(F_true, &file);
+
break;
}
// Skip past empty files.
if (!total) {
f_file_stream_close(F_true, &file);
+
continue;
}
f_file_stream_close(F_true, &file);
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->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_until", F_true, argv[main->parameters.remaining.array[i]], f_file_operation_process_s, fll_error_file_type_file_e);
+
break;
}
- status = iki_read_process_buffer(main, arguments, arguments->argv[main->parameters.remaining.array[i]]);
+ status = iki_read_process_buffer(main);
if (F_status_is_error(status)) break;
// Clear buffers before repeating the loop.
void iki_read_substitutions_print(iki_read_main_t * const main, const iki_data_t iki_data, const f_string_ranges_t ranges, const iki_read_substitutions_t substitutions, const f_array_length_t index, const bool content_only) {
f_status_t status = F_none;
-
f_array_length_t i = 0;
- f_string_range_t range = f_string_range_t_initialize;
-
- range.start = 0;
for (; i < substitutions.used; ++i) {
- range.stop = substitutions.array[i].replace.used - 1;
-
- status = fl_string_dynamic_partial_compare(substitutions.array[i].replace, main->buffer, range, iki_data.content.array[index]);
+ status = fl_string_dynamic_partial_compare_string(substitutions.array[i].replace.string, main->buffer, substitutions.array[i].replace.used, iki_data.content.array[index]);
if (status == F_equal_to) break;
} // for
f_print_dynamic(substitutions.array[i].with, main->output.to.stream);
}
else {
- range.start = iki_data.variable.array[index].start;
- range.stop = iki_data.content.array[index].start - 1;
+ f_string_range_t range = macro_f_string_range_t_initialize2(iki_data.variable.array[index].start, iki_data.content.array[index].start - 1);
f_print_dynamic_partial(main->buffer, range, main->output.to.stream);
#endif
#ifndef _di_iki_read_process_at_
- f_status_t iki_read_process_at(iki_read_main_t * const main, const f_string_t file_name, f_string_range_t *range) {
+ f_status_t iki_read_process_at(iki_read_main_t * const main, f_string_range_t *range) {
if (main->parameters.array[iki_read_parameter_line_e].result != f_console_result_additional_e) {
return F_false;
#endif // _di_iki_read_process_at_
#ifndef _di_iki_read_process_buffer_
- f_status_t iki_read_process_buffer(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name) {
+ f_status_t iki_read_process_buffer(iki_read_main_t * const main) {
f_status_t status = F_none;
iki_data_t iki_data = iki_data_t_initialize;
if (main->parameters.array[iki_read_parameter_whole_e].result == f_console_result_found_e) {
f_string_range_t buffer_range = macro_f_string_range_t_initialize(main->buffer.used);
- status = iki_read_process_at(main, file_name, &buffer_range);
+ status = iki_read_process_at(main, &buffer_range);
if (status == F_true) {
if (buffer_range.start > main->buffer.used) {
}
if (main->mode == iki_read_mode_content_e) {
- status = iki_read_process_buffer_ranges_whole(main, arguments, file_name, buffer_range, &iki_data, &iki_data.content);
+ status = iki_read_process_buffer_ranges_whole(main, buffer_range, &iki_data, &iki_data.content);
}
else if (main->mode == iki_read_mode_literal_e) {
- status = iki_read_process_buffer_ranges_whole(main, arguments, file_name, buffer_range, &iki_data, &iki_data.variable);
+ status = iki_read_process_buffer_ranges_whole(main, buffer_range, &iki_data, &iki_data.variable);
}
else if (main->mode == iki_read_mode_object_e) {
- status = iki_read_process_buffer_ranges_whole(main, arguments, file_name, buffer_range, &iki_data, &iki_data.vocabulary);
+ status = iki_read_process_buffer_ranges_whole(main, buffer_range, &iki_data, &iki_data.vocabulary);
}
}
else if (main->mode == iki_read_mode_total_e) {
- status = iki_read_process_buffer_total(main, arguments, file_name, &iki_data);
+ status = iki_read_process_buffer_total(main, &iki_data);
}
else {
f_string_range_t buffer_range = macro_f_string_range_t_initialize(main->buffer.used);
- status = iki_read_process_at(main, file_name, &buffer_range);
+ status = iki_read_process_at(main, &buffer_range);
if (status == F_true && buffer_range.start > main->buffer.used || status == F_data_not) {
macro_iki_data_t_delete_simple(iki_data);
}
if (main->mode == iki_read_mode_content_e) {
- status = iki_read_process_buffer_ranges(main, arguments, file_name, &buffer_range, &iki_data, &iki_data.content);
+ status = iki_read_process_buffer_ranges(main, &buffer_range, &iki_data, &iki_data.content);
}
else if (main->mode == iki_read_mode_literal_e) {
- status = iki_read_process_buffer_ranges(main, arguments, file_name, &buffer_range, &iki_data, &iki_data.variable);
+ status = iki_read_process_buffer_ranges(main, &buffer_range, &iki_data, &iki_data.variable);
}
else if (main->mode == iki_read_mode_object_e) {
- status = iki_read_process_buffer_ranges(main, arguments, file_name, &buffer_range, &iki_data, &iki_data.vocabulary);
+ status = iki_read_process_buffer_ranges(main, &buffer_range, &iki_data, &iki_data.vocabulary);
}
}
#endif // _di_iki_read_process_buffer_
#ifndef _di_iki_read_process_buffer_ranges_
- f_status_t iki_read_process_buffer_ranges(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, f_string_range_t *buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) {
+ f_status_t iki_read_process_buffer_ranges(iki_read_main_t * const main, f_string_range_t *buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) {
f_status_t status = F_none;
memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
if (main->mode == iki_read_mode_literal_e || main->mode == iki_read_mode_content_e) {
- status = iki_read_substitutions_identify(main, arguments, file_name, &iki_data->vocabulary, substitutionss);
+ status = iki_read_substitutions_identify(main, &iki_data->vocabulary, substitutionss);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
index = main->parameters.array[iki_read_parameter_name_e].values.array[i];
name.used = 0;
- status = f_string_append_nulless(arguments->argv[index], strlen(arguments->argv[index]), &name);
+ status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &name);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
for (f_array_length_t i = 0; i < iki_data->variable.used; ++i) {
macro_iki_read_substitutions_t_delete_simple(substitutionss[i]);
f_string_dynamic_resize(0, &name);
- if (unmatched) status = F_data_not;
- else status = F_none;
+ if (unmatched) {
+ status = F_data_not;
+ }
+ else {
+ status = F_none;
+ }
}
else if (ranges->used) {
if (main->parameters.array[iki_read_parameter_at_e].result == f_console_result_additional_e) {
#endif // _di_iki_read_process_buffer_ranges_
#ifndef _di_iki_read_process_buffer_ranges_whole_
- f_status_t iki_read_process_buffer_ranges_whole(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, const f_string_range_t buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) {
+ f_status_t iki_read_process_buffer_ranges_whole(iki_read_main_t * const main, const f_string_range_t buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) {
f_status_t status = F_none;
f_string_range_t range = buffer_range;
memset(substitutionss, 0, sizeof(iki_read_substitutions_t) * iki_data->variable.used);
if (main->mode == iki_read_mode_literal_e || main->mode == iki_read_mode_content_e) {
- status = iki_read_substitutions_identify(main, arguments, file_name, &iki_data->vocabulary, substitutionss);
+ status = iki_read_substitutions_identify(main, &iki_data->vocabulary, substitutionss);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "iki_read_substitutions_identify", F_true);
if (main->parameters.array[iki_read_parameter_name_e].result == f_console_result_additional_e) {
f_array_length_t i = 0;
f_array_length_t j = 0;
- f_array_length_t length_argument = 0;
for (f_array_length_t index = 0; i < main->parameters.array[iki_read_parameter_name_e].values.used; ++i) {
index = main->parameters.array[iki_read_parameter_name_e].values.array[i];
- length_argument = strnlen(arguments->argv[index], F_console_parameter_size_d);
for (j = 0, name_missed = F_true; j < names.used; ++j) {
- status = fl_string_compare(arguments->argv[index], names.array[j].string, length_argument, names.array[j].used);
-
- if (status == F_equal_to) {
+ if (fl_string_dynamic_compare(main->parameters.arguments.array[index], names.array[j]) == F_equal_to) {
name_missed = F_false;
break;
break;
}
- status = f_string_append_nulless(arguments->argv[index], length_argument, &names.array[names.used]);
+ status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &names.array[names.used]);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
break;
}
#endif // _di_iki_read_process_buffer_ranges_whole_
#ifndef _di_iki_read_process_buffer_total_
- f_status_t iki_read_process_buffer_total(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, iki_data_t *iki_data) {
+ f_status_t iki_read_process_buffer_total(iki_read_main_t * const main, iki_data_t *iki_data) {
f_status_t status = F_none;
f_string_range_t range = macro_f_string_range_t_initialize(main->buffer.used);
- status = iki_read_process_at(main, file_name, &range);
+ status = iki_read_process_at(main, &range);
if (status == F_true) {
if (range.start > main->buffer.used) {
- fll_print_format("0%r", main->output.to.stream, f_string_eol_s);
+ fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
return F_none;
}
}
else if (status == F_data_not) {
- fll_print_format("0%r", main->output.to.stream, f_string_eol_s);
+ fll_print_format("%r%r", main->output.to.stream, f_string_ascii_0_s, f_string_eol_s);
return F_none;
}
index = main->parameters.array[iki_read_parameter_name_e].values.array[i];
name.used = 0;
- status = f_string_append_nulless(arguments->argv[index], strlen(arguments->argv[index]), &name);
+ status = f_string_dynamic_append_nulless(main->parameters.arguments.array[index], &name);
if (F_status_is_error(status)) {
- fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", F_true);
+ fll_error_print(main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
f_string_dynamic_resize(0, &name);
+
return status;
}
#endif // _di_iki_read_process_buffer_total_
#ifndef _di_iki_read_substitutions_identify_
- f_status_t iki_read_substitutions_identify(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) {
+ f_status_t iki_read_substitutions_identify(iki_read_main_t * const main, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) {
if (main->parameters.array[iki_read_parameter_substitute_e].result != f_console_result_additional_e) {
return F_none;
f_array_length_t index = 0;
f_array_length_t index_2 = 0;
- f_array_length_t length = 0;
-
f_console_parameter_t *parameter = &main->parameters.array[iki_read_parameter_substitute_e];
for (; i < parameter->values.used; i += 3) {
index = parameter->values.array[i];
- length = strnlen(arguments->argv[index], F_console_parameter_size_d);
for (j = 0; j < vocabulary->used; ++j) {
- status = fl_string_compare(arguments->argv[index], main->buffer.string + vocabulary->array[j].start, length, (vocabulary->array[j].stop - vocabulary->array[j].start) + 1);
-
- if (status == F_equal_to) {
+ if (fl_string_dynamic_partial_compare_string(main->parameters.arguments.array[index].string, main->buffer, main->parameters.arguments.array[index].used, vocabulary->array[j]) == F_equal_to) {
macro_f_memory_structure_increment(status, substitutionss[j], 1, F_iki_default_allocation_step_d, macro_iki_read_substitutions_t_resize, F_array_too_large);
if (F_status_is_error(status)) return status;
index = parameter->values.array[i + 1];
index_2 = substitutionss[j].used;
- substitutionss[j].array[index_2].replace.string = arguments->argv[index];
- substitutionss[j].array[index_2].replace.used = strnlen(arguments->argv[index], F_console_parameter_size_d);
- substitutionss[j].array[index_2].replace.size = substitutionss[j].array[index_2].replace.used;
+ substitutionss[j].array[index_2].replace = main->parameters.arguments.array[index];
index = parameter->values.array[i + 2];
- substitutionss[j].array[index_2].with.string = arguments->argv[index];
- substitutionss[j].array[index_2].with.used = strnlen(arguments->argv[index], F_console_parameter_size_d);
- substitutionss[j].array[index_2].with.size = substitutionss[j].array[index_2].with.used;
+ substitutionss[j].array[index_2].with = main->parameters.arguments.array[index];
++substitutionss[j].used;
}
*
* @param main
* The main program data.
- * @param file_name
- * The name of the file being processed.
* @param range
* The range value to represent the --at values.
*
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_at_
- extern f_status_t iki_read_process_at(iki_read_main_t * const main, const f_string_t file_name, f_string_range_t *range) F_attribute_visibility_internal_d;
+ extern f_status_t iki_read_process_at(iki_read_main_t * const main, f_string_range_t *range) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_at_
/**
*
* @param main
* The main program data.
- * @param arguments
- * The console arguments passed to the program.
- * @param file_name
- * The name of the file being processed.
*
* @return
* F_none on success.
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_
- extern f_status_t iki_read_process_buffer(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name) F_attribute_visibility_internal_d;
+ extern f_status_t iki_read_process_buffer(iki_read_main_t * const main) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_
/**
*
* @param main
* The main program data.
- * @param arguments
- * The console arguments passed to the program.
- * @param file_name
- * The name of the file being processed.
* @param buffer_range
* The range within the buffer to process.
* @param iki_data
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_ranges_
- extern f_status_t iki_read_process_buffer_ranges(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, f_string_range_t *buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) F_attribute_visibility_internal_d;
+ extern f_status_t iki_read_process_buffer_ranges(iki_read_main_t * const main, f_string_range_t *buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_ranges_
/**
*
* @param main
* The main program data.
- * @param arguments
- * The console arguments passed to the program.
- * @param file_name
- * The name of the file being processed.
* @param buffer_range
* The range within the buffer to process.
* @param iki_data
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_ranges_whole_
- extern f_status_t iki_read_process_buffer_ranges_whole(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, const f_string_range_t buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) F_attribute_visibility_internal_d;
+ extern f_status_t iki_read_process_buffer_ranges_whole(iki_read_main_t * const main, const f_string_range_t buffer_range, iki_data_t *iki_data, f_string_ranges_t *ranges) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_ranges_whole_
/**
*
* @param main
* The main program data.
- * @param arguments
- * The console arguments passed to the program.
- * @param file_name
- * The name of the file being processed.
* @param iki_data
* The IKI data.
*
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_process_buffer_total_
- extern f_status_t iki_read_process_buffer_total(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, iki_data_t *iki_data) F_attribute_visibility_internal_d;
+ extern f_status_t iki_read_process_buffer_total(iki_read_main_t * const main, iki_data_t *iki_data) F_attribute_visibility_internal_d;
#endif // _di_iki_read_process_buffer_total_
/**
*
* @param main
* The main program data.
- * @param arguments
- * The console arguments passed to the program.
- * @param file_name
- * The name of the file being processed.
* @param vocabulary
* The ranges representing a vocabulary.
* @param substitutionss
* Status codes (with error bit) are returned on any problem.
*/
#ifndef _di_iki_read_substitutions_identify_
- extern f_status_t iki_read_substitutions_identify(iki_read_main_t * const main, const f_console_arguments_t *arguments, const f_string_t file_name, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) F_attribute_visibility_internal_d;
+ extern f_status_t iki_read_substitutions_identify(iki_read_main_t * const main, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) F_attribute_visibility_internal_d;
#endif // _di_iki_read_substitutions_identify_
#ifdef __cplusplus
* The program name.
*/
#ifndef _di_iki_write_program_name_
- #define iki_write_program_name_s "iki_write"
- #define iki_write_program_name_long_s "IKI Write"
+ #define IKI_WRITE_program_name_s "iki_write"
+ #define IKI_WRITE_program_name_long_s "IKI Write"
#define IKI_WRITE_program_name_s_length 9
#define IKI_WRITE_program_name_long_s_length 9
* The main program data.
*
* parameters: The state of pre-defined parameters passed to the program.
- * remaining: The remaining, non-pre-defined parameters, passed to the program.
* process_pipe: Designate whether or not to process the input pipe.
* output: The output file for general printing.
* error: The output file for error printing.
#define iki_write_main_t_initialize \
{ \
f_console_parameters_t_initialize, \
- f_array_lengths_t_initialize, \
F_false, \
fl_print_t_initialize, \
macro_fl_print_t_initialize_error(), \
status = F_status_set_error(F_parameter);
}
else {
- const f_array_length_t location = main->parameters.array[iki_write_parameter_file_e].values.array[0];
+ const f_array_length_t index = main->parameters.array[iki_write_parameter_file_e].values.array[0];
file.id = -1;
file.stream = 0;
- status = f_file_stream_open(arguments->argv[location], 0, &file);
+ status = f_file_stream_open(argv[index], f_string_empty_s, &file);
if (F_status_is_error(status)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, arguments->argv[location], f_file_operation_open_s, fll_error_file_type_file_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_stream_open", F_true, argv[index], f_file_operation_open_s, fll_error_file_type_file_e);
}
}
}
}
}
- data->quote = f_iki_syntax_quote_double_s.string[0];
+ main->quote = f_iki_syntax_quote_double_s;
if (F_status_is_error_not(status)) {
if (main->parameters.array[iki_write_parameter_double_e].result == f_console_result_found_e) {
if (main->parameters.array[iki_write_parameter_single_e].result == f_console_result_found_e) {
if (main->parameters.array[iki_write_parameter_double_e].location < main->parameters.array[iki_write_parameter_single_e].location) {
- data->quote = f_iki_syntax_quote_single_s.string[0];
+ main->quote = f_iki_syntax_quote_single_s;
}
}
}
else if (main->parameters.array[iki_write_parameter_single_e].result == f_console_result_found_e) {
- data->quote = f_iki_syntax_quote_single_s.string[0];
+ main->quote = f_iki_syntax_quote_single_s;
}
}
status_pipe = f_file_read(pipe, &buffer);
if (F_status_is_error(status_pipe)) {
- fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_to", F_true, f_string_ascii_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
+ fll_error_file_print(main->error, F_status_set_fine(status), "f_file_read_to", F_true, f_string_ascii_minus_s, f_file_operation_read_s, fll_error_file_type_pipe_e);
status = F_status_set_error(F_pipe);
}
if (F_status_is_error_not(status)) {
- f_string_static_t object = f_string_static_t_initialize;
- f_string_static_t content = f_string_static_t_initialize;
uint16_t signal_check = 0;
for (f_array_length_t i = 0; i < main->parameters.array[iki_write_parameter_object_e].values.used; ++i) {
signal_check = 0;
}
- object.string = arguments->argv[main->parameters.array[iki_write_parameter_object_e].values.array[i]];
- object.used = strnlen(object.string, F_console_parameter_size_d);
- object.size = object.used;
-
- content.string = arguments->argv[main->parameters.array[iki_write_parameter_content_e].values.array[i]];
- content.used = strnlen(content.string, F_console_parameter_size_d);
- content.size = content.used;
-
- status = iki_write_process(main, file, object, content, &escaped);
+ status = iki_write_process(main, file, argv[main->parameters.array[iki_write_parameter_object_e].values.array[i]], argv[main->parameters.array[iki_write_parameter_content_e].values.array[i]], &escaped);
if (F_status_is_error(status)) break;
fll_print_dynamic_raw(f_string_eol_s, file.stream);
if (F_status_is_error(status)) {
fll_error_print(main->error, F_status_set_fine(status), "fll_iki_content_escape", F_true);
- f_string_dynamic_resize(0, &escaped);
-
return F_status_set_error(F_failure);
}
#define STATUS_CODE_program_version_nano_s_length 0
#endif // !(defined(STATUS_CODE_program_version_nano_s) && defined(STATUS_CODE_program_version_nano_s_length))
- #define STATUS_CODE_progam_version_s STATUS_CODE_program_version_major_s F_string_ascii_period_s STATUS_CODE_program_version_minor_s F_string_ascii_period_s STATUS_CODE_program_version_micro_s STATUS_CODE_progam_version_nano_prefix_s STATUS_CODE_progam_version_nano_s
+ #define STATUS_CODE_program_version_s STATUS_CODE_program_version_major_s F_string_ascii_period_s STATUS_CODE_program_version_minor_s F_string_ascii_period_s STATUS_CODE_program_version_micro_s STATUS_CODE_program_version_nano_prefix_s STATUS_CODE_program_version_nano_s
- #define STATUS_CODE_progam_version_s_length STATUS_CODE_program_version_major_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_minor_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_micro_s_length + STATUS_CODE_progam_version_nano_prefix_s_length + STATUS_CODE_progam_version_nano_s_length
+ #define STATUS_CODE_program_version_s_length STATUS_CODE_program_version_major_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_minor_s_length + F_string_ascii_period_s_length + STATUS_CODE_program_version_micro_s_length + STATUS_CODE_program_version_nano_prefix_s_length + STATUS_CODE_program_version_nano_s_length
extern const f_string_static_t status_code_program_version_s;
#endif // _di_status_code_program_version_
* The program name.
*/
#ifndef _di_status_code_program_name_
- #define STATUS_CODE_progam_name_s "status_code"
- #define STATUS_CODE_progam_name_long_s "FSS Status Code"
+ #define STATUS_CODE_program_name_s "status_code"
+ #define STATUS_CODE_program_name_long_s "Status Code"
#define STATUS_CODE_program_name_s_length 11
- #define STATUS_CODE_program_name_long_s_length 15
+ #define STATUS_CODE_program_name_long_s_length 11
extern const f_string_static_t status_code_program_name_s;
extern const f_string_static_t status_code_program_name_long_s;
#endif
#ifndef _di_status_code_process_check_
- f_status_t status_code_process_check(fll_program_data_t * const main, const f_string_t value) {
+ f_status_t status_code_process_check(fll_program_data_t * const main, const f_string_static_t value) {
f_number_unsigned_t number = 0;
f_status_t status = status_code_convert_number(main, value, &number);
- if (F_status_is_error(status)) {
- return status;
- }
+ if (F_status_is_error(status)) return status;
if (main->parameters.array[status_code_parameter_is_error_e].result == f_console_result_found_e) {
if (F_status_is_error(number)) {
- f_print_terminated(f_status_true_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_true_s, main->output.to.stream);
}
else {
- f_print_terminated(f_status_false_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_false_s, main->output.to.stream);
}
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
else if (main->parameters.array[status_code_parameter_is_warning_e].result == f_console_result_found_e) {
if (F_status_is_warning(number)) {
- f_print_terminated(f_status_true_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_true_s, main->output.to.stream);
}
else {
- f_print_terminated(f_status_false_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_false_s, main->output.to.stream);
}
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
}
else if (main->parameters.array[status_code_parameter_is_fine_e].result == f_console_result_found_e) {
if (F_status_is_fine(number)) {
- f_print_terminated(f_status_true_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_true_s, main->output.to.stream);
}
else {
- f_print_terminated(f_status_false_s, main->output.to.stream);
+ f_print_dynamic_raw(f_status_false_s, main->output.to.stream);
}
f_print_dynamic_raw(f_string_eol_s, main->output.to.stream);
#endif // _di_status_code_process_check_
#ifndef _di_status_code_process_number_
- f_status_t status_code_process_number(fll_program_data_t * const main, const f_string_t value) {
+ f_status_t status_code_process_number(fll_program_data_t * const main, const f_string_static_t value) {
f_status_t status = F_none;
{
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value));
+ const f_string_range_t range = macro_f_string_range_t_initialize(value.used);
f_number_unsigned_t number = 0;
- status = fl_conversion_string_to_number_unsigned(value, range, &number);
+ status = fl_conversion_string_to_number_unsigned(value.string, range, &number);
if (status == F_none) {
fl_print_format("%[invalid name%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
#endif // _di_status_code_process_number_
#ifndef _di_status_code_process_normal_
- f_status_t status_code_process_normal(fll_program_data_t * const main, const f_string_t value) {
+ f_status_t status_code_process_normal(fll_program_data_t * const main, const f_string_static_t value) {
f_number_unsigned_t number = 0;
f_status_t status = status_code_convert_number(main, value, &number);
- if (F_status_is_error(status)) {
- return status;
- }
+ if (F_status_is_error(status)) return status;
- const f_status_t code = (f_status_t) number;
- f_string_static_t name = 0;
+ f_string_static_t name = f_string_static_t_initialize;
- status = f_status_string_to(code, &name);
+ status = f_status_string_to((f_status_t) number, &name);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
return status;
}
- fl_print_format("%S%r", main->output.to.stream, name, f_string_eol_s);
+ fl_print_format("%Q%r", main->output.to.stream, name, f_string_eol_s);
return F_none;
}
#endif // _di_status_code_process_normal_
#ifndef _di_status_code_convert_number_
- f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) {
+ f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) {
- const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value));
+ const f_string_range_t range = macro_f_string_range_t_initialize(value.used);
- f_status_t status = fl_conversion_string_to_number_unsigned(value, range, number);
+ f_status_t status = fl_conversion_string_to_number_unsigned(value.string, range, number);
if (*number > F_status_size_max_with_signal) {
fl_print_format("%[out of range%]%r", main->output.to.stream, main->context.set.error, main->context.set.error, f_string_eol_s);
* @see fss_status_code_convert_number()
*/
#ifndef _di_status_code_process_check_
- extern f_status_t status_code_process_check(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d;
+ extern f_status_t status_code_process_check(fll_program_data_t * const main, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_status_code_process_check_
/**
* @see fll_fss_status_string_from()
*/
#ifndef _di_status_code_process_number_
- extern f_status_t status_code_process_number(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d;
+ extern f_status_t status_code_process_number(fll_program_data_t * const main, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_status_code_process_number_
/**
* @see fss_status_code_convert_number()
*/
#ifndef _di_status_code_process_normal_
- extern f_status_t status_code_process_normal(fll_program_data_t * const main, const f_string_t value) F_attribute_visibility_internal_d;
+ extern f_status_t status_code_process_normal(fll_program_data_t * const main, const f_string_static_t value) F_attribute_visibility_internal_d;
#endif // _di_status_code_process_normal_
/**
* @see fl_console_parameter_to_number_unsigned()
*/
#ifndef _di_status_code_convert_number_
- extern f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d;
+ extern f_status_t status_code_convert_number(fll_program_data_t * const main, const f_string_static_t value, f_number_unsigned_t *number) F_attribute_visibility_internal_d;
#endif // _di_status_code_convert_number_
#ifdef __cplusplus
flockfile(file.stream);
- fll_program_print_help_header(file, context, status_code_progam_name_long_s, status_code_progam_version_s);
+ fll_program_print_help_header(file, context, status_code_program_name_long_s, status_code_program_version_s);
fll_program_print_help_option(file, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(file, context, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Output using colors that show up better on dark backgrounds.");
fll_program_print_help_option(file, context, status_code_short_is_error_s, status_code_long_is_error_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true if the error code is an error, F_false otherwise.");
fll_program_print_help_option(file, context, status_code_short_number_s, status_code_long_number_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Convert status code name to number.");
- fll_program_print_help_usage(file, context, status_code_progam_name_s, status_code_program_help_parameters_s);
+ fll_program_print_help_usage(file, context, status_code_program_name_s, status_code_program_help_parameters_s);
funlockfile(file.stream);
if (F_status_is_error(status)) {
status_code_main_delete(main);
+
return status;
}
}
if (main->parameters.array[status_code_parameter_version_e].result == f_console_result_found_e) {
- fll_program_print_version(main->output.to, status_code_progam_version_s);
+ fll_program_print_version(main->output.to, status_code_program_version_s);
status_code_main_delete(main);
return F_status_set_error(status);
}
- else if (main->parameters.array[status_code_parameter_is_fine_e].result == f_console_result_found_e) {
+
+ if (main->parameters.array[status_code_parameter_is_fine_e].result == f_console_result_found_e) {
flockfile(main->error.to.stream);
fl_print_format("%r%[%QThe parameter '%]", main->error.to.stream, f_string_eol_s, main->error.context, main->error.prefix, main->error.context);
if (!((++signal_check) % status_code_signal_check_d)) {
if (status_code_signal_received(main)) {
status = F_status_set_error(F_signal);
+
break;
}
signal_check = 0;
}
- status2 = status_code_process_check(main, arguments->argv[main->parameters.remaining.array[i]]);
+ status2 = status_code_process_check(main, argv[main->parameters.remaining.array[i]]);
if (F_status_is_error(status2) && status == F_none) {
status = status2;
if (!((++signal_check) % status_code_signal_check_d)) {
if (status_code_signal_received(main)) {
status = F_status_set_error(F_signal);
+
break;
}
signal_check = 0;
}
- status2 = status_code_process_number(main, arguments->argv[main->parameters.remaining.array[i]]);
+ status2 = status_code_process_number(main, argv[main->parameters.remaining.array[i]]);
if (F_status_is_error(status2) && status == F_none) {
status = status2;
if (!((++signal_check) % status_code_signal_check_d)) {
if (status_code_signal_received(main)) {
status = F_status_set_error(F_signal);
+
break;
}
signal_check = 0;
}
- status2 = status_code_process_normal(main, arguments->argv[main->parameters.remaining.array[i]]);
+ status2 = status_code_process_normal(main, argv[main->parameters.remaining.array[i]]);
if (F_status_is_error(status2) && status == F_none) {
status = status2;