From 4a6c8e30920d722eaa9f745a7a4851f5bdff0cfe Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 19 Sep 2020 23:25:51 -0500 Subject: [PATCH] Cleanup: syntax and structure. --- level_0/f_memory/c/memory.c | 4 +-- level_0/f_memory/c/memory.h | 15 ++++++++ level_0/f_serialize/c/private-serialize.c | 7 ++-- level_0/f_serialize/c/serialize.c | 10 +++--- level_0/f_signal/c/signal.c | 12 +++++-- level_0/f_status/c/status_array.h | 1 + level_0/f_utf/c/utf.c | 11 ++++++ level_1/fl_conversion/c/conversion.c | 10 ++++++ level_1/fl_directory/c/directory.c | 17 +++++++++ level_1/fl_directory/c/directory.h | 4 +++ level_1/fl_directory/c/private-directory.c | 5 +++ level_1/fl_directory/c/private-directory.h | 2 ++ level_1/fl_environment/c/environment.c | 6 ++++ level_1/fl_fss/c/fss_basic.c | 7 ++-- level_1/fl_fss/c/fss_basic_list.c | 11 ++++++ level_1/fl_fss/c/fss_extended.c | 1 + level_1/fl_fss/c/fss_extended_list.c | 38 ++++++++++++++++++-- level_1/fl_fss/c/private-fss.c | 16 ++++++++- level_1/fl_iki/c/iki.h | 2 ++ level_1/fl_print/c/print.c | 1 + level_1/fl_string/c/private-string.c | 18 ++++++++-- level_1/fl_string/c/private-string.h | 2 ++ level_1/fl_utf/c/private-utf.c | 18 ++++++++-- level_1/fl_utf/c/utf.c | 36 ++++++++++++++++--- level_1/fl_utf_file/c/private-utf_file.c | 1 + level_2/fll_execute/c/execute.c | 40 +++++++++++---------- level_2/fll_execute/c/execute.h | 35 ++++++++++++++++++ level_2/fll_execute/c/private-execute.c | 7 ++++ level_2/fll_file/c/file.h | 8 +++++ level_2/fll_file/c/private-file.c | 14 ++++++-- level_2/fll_fss/c/fss.c | 31 ++++++++++++++++ level_2/fll_fss/c/fss_basic.c | 1 + level_2/fll_fss/c/fss_basic.h | 7 ++++ level_2/fll_fss/c/fss_basic_list.c | 1 + level_2/fll_fss/c/fss_basic_list.h | 7 ++++ level_2/fll_fss/c/fss_extended.c | 1 + level_2/fll_fss/c/fss_extended.h | 7 ++++ level_2/fll_fss/c/fss_extended_list.c | 5 +++ level_2/fll_fss/c/fss_extended_list.h | 7 ++++ level_2/fll_fss/c/fss_status.c | 3 ++ level_2/fll_fss/c/fss_status.h | 2 +- level_2/fll_path/c/path.h | 5 +++ level_2/fll_program/c/program.c | 5 +++ level_2/fll_status/c/status.h | 2 ++ level_3/byte_dump/c/byte_dump.c | 7 ++++ level_3/byte_dump/c/private-byte_dump.c | 6 +++- level_3/fake/c/fake.c | 8 +++++ level_3/fake/c/private-build.c | 32 +++++++++++++++++ level_3/fake/c/private-fake.c | 7 ++++ level_3/fake/c/private-make.c | 42 ++++++++++++++++++++++ level_3/fake/c/private-skeleton.c | 4 +++ level_3/firewall/c/firewall.c | 5 +++ level_3/firewall/c/private-firewall.c | 4 +++ .../fss_basic_list_read/c/fss_basic_list_read.c | 1 + .../c/private-fss_basic_list_read.c | 18 ++++++---- .../fss_basic_list_write/c/fss_basic_list_write.c | 1 + level_3/fss_basic_read/c/fss_basic_read.c | 3 ++ level_3/fss_basic_read/c/private-fss_basic_read.c | 26 +++++++++----- level_3/fss_basic_write/c/fss_basic_write.c | 2 ++ .../c/fss_extended_list_read.c | 4 +++ .../c/private-fss_extended_list_read.c | 23 ++++++++---- level_3/fss_extended_read/c/fss_extended_read.c | 5 +++ .../c/private-fss_extended_read.c | 21 +++++++---- level_3/fss_extended_write/c/fss_extended_write.c | 3 ++ level_3/fss_status_code/c/fss_status_code.c | 3 ++ .../fss_status_code/c/private-fss_status_code.c | 12 +++---- level_3/iki_read/c/iki_read.c | 6 ++++ level_3/iki_read/c/private-iki_read.c | 17 ++++++++- level_3/iki_write/c/iki_write.c | 2 ++ level_3/init/c/init.c | 1 + level_3/init/c/private-init.c | 3 +- level_3/status_code/c/status_code.c | 2 ++ 72 files changed, 622 insertions(+), 89 deletions(-) diff --git a/level_0/f_memory/c/memory.c b/level_0/f_memory/c/memory.c index b0e4ea8..078acde 100644 --- a/level_0/f_memory/c/memory.c +++ b/level_0/f_memory/c/memory.c @@ -144,7 +144,7 @@ extern "C" { if (new_length < old_length) { // uint8_t * is of a data type size of 1, casting it to uint8_t should result in a single-length increment. // this is done to avoid problems with (void *) having arithmetic issues. - memset(((uint8_t *)*pointer) + new_length, 0, type * (old_length - new_length)); + memset(((uint8_t *) *pointer) + new_length, 0, type * (old_length - new_length)); } } @@ -166,7 +166,7 @@ extern "C" { if (new_length > old_length) { // uint8_t * is of a data type size of 1, casting it to bool should result in a single-length increment. // this is done to avoid problems with (void *) having arithmetic issues. - memset(((uint8_t *)new_pointer) + (type * old_length), 0, type * (new_length - old_length)); + memset(((uint8_t *) new_pointer) + (type * old_length), 0, type * (new_length - old_length)); } *pointer = new_pointer; diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index b3dc323..a71101c 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -89,6 +89,8 @@ extern "C" { * F_none on success. * F_memory_allocation (with error bit) on allocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * @see calloc() */ #ifndef _di_f_memory_new_ extern f_return_status f_memory_new(void **pointer, const f_memory_size_t type, const f_memory_length length); @@ -111,6 +113,8 @@ extern "C" { * @return * F_none on success. * F_parameter (with error bit) if a parameter is invalid. + * + * @see free() */ #if ! ( defined (_di_f_memory_delete_) || defined (_f_memory_FORCE_secure_memory_) ) extern f_return_status f_memory_delete(void **pointer, const f_memory_size_t type, const f_memory_length length); @@ -131,6 +135,9 @@ extern "C" { * @return * F_none on success. * F_parameter (with error bit) if a parameter is invalid. + * + * @see free() + * @see memset() */ #if ! ( defined (_di_f_memory_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) extern f_return_status f_memory_destroy(void **pointer, const f_memory_size_t type, const f_memory_length length); @@ -154,6 +161,10 @@ extern "C" { * F_none on success. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * @see calloc() + * @see memset() + * @see realloc() */ #if ! ( defined (_di_f_memory_resize_) || defined (_f_memory_FORCE_secure_memory_) ) extern f_return_status f_memory_resize(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length); @@ -177,6 +188,10 @@ extern "C" { * F_none on success. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * @see calloc() + * @see memset() + * @see realloc() */ #if ! ( defined (_di_f_memory_adjust_) || defined (_f_memory_FORCE_fast_memory_) ) extern f_return_status f_memory_adjust(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length); diff --git a/level_0/f_serialize/c/private-serialize.c b/level_0/f_serialize/c/private-serialize.c index 5d69b08..3ca6833 100644 --- a/level_0/f_serialize/c/private-serialize.c +++ b/level_0/f_serialize/c/private-serialize.c @@ -15,12 +15,13 @@ extern "C" { unsigned short width = 0; - while (i < serialize.used) { + for (; i < serialize.used; i += width) { width = f_macro_utf_byte_width(serialize.string[i]); if (serialize.string[i] == f_serialize_simple_splitter) { if (current == index) { if (start == i) { + // provide an invalid start to stop range to communicate that there is no data. location->start = 1; location->stop = 0; @@ -46,9 +47,7 @@ extern "C" { } if (i + width > serialize.used) return F_status_set_error(F_incomplete_utf_eos); - - i += width; - } // while + } // for return F_data_not_eos; } diff --git a/level_0/f_serialize/c/serialize.c b/level_0/f_serialize/c/serialize.c index 468c0ce..e735f5f 100644 --- a/level_0/f_serialize/c/serialize.c +++ b/level_0/f_serialize/c/serialize.c @@ -112,7 +112,7 @@ extern "C" { uint8_t width = 0; - while (i < serialize.used) { + for (; i < serialize.used; i += width) { width = f_macro_utf_byte_width(serialize.string[i]); if (serialize.string[i] == f_serialize_simple_splitter || i + 1 >= serialize.used) { @@ -136,16 +136,16 @@ extern "C" { locations->used++; - if (i + width > serialize.used) return F_status_set_error(F_incomplete_utf_eos); + if (i + width > serialize.used) { + return F_status_set_error(F_incomplete_utf_eos); + } start = i + width; } else if (i + width > serialize.used) { return F_status_set_error(F_incomplete_utf_eos); } - - i += width; - } // while + } // for return F_none; } diff --git a/level_0/f_signal/c/signal.c b/level_0/f_signal/c/signal.c index c47f06e..bebdeaf 100644 --- a/level_0/f_signal/c/signal.c +++ b/level_0/f_signal/c/signal.c @@ -106,7 +106,9 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (sigaddset(set, signal) < 0) { - if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EINVAL) { + return F_status_set_error(F_parameter); + } return F_status_set_error(F_failure); } @@ -122,7 +124,9 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (sigdelset(set, signal) < 0) { - if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EINVAL) { + return F_status_set_error(F_parameter); + } return F_status_set_error(F_failure); } @@ -138,7 +142,9 @@ extern "C" { #endif // _di_level_0_parameter_checking_ if (sigemptyset(set) < 0) { - if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EINVAL) { + return F_status_set_error(F_parameter); + } return F_status_set_error(F_failure); } diff --git a/level_0/f_status/c/status_array.h b/level_0/f_status/c/status_array.h index ce810ce..5f055e5 100644 --- a/level_0/f_status/c/status_array.h +++ b/level_0/f_status/c/status_array.h @@ -29,6 +29,7 @@ extern "C" { #ifndef _di_f_statuss_t_ typedef struct { f_status_t *array; + f_array_length_t size; f_array_length_t used; } f_statuss_t; diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index 653f9c0..9e83ad6 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -214,6 +214,7 @@ extern "C" { const uint8_t width = f_macro_utf_character_t_width_is(character); if (width == 0) { + // There are no control picture characters in ASCII. return F_false; } @@ -337,6 +338,7 @@ extern "C" { const uint8_t width = f_macro_utf_character_t_width_is(character); if (width == 0) { + // There are no ASCII phonetic characters. return F_false; } @@ -354,6 +356,7 @@ extern "C" { const uint8_t width = f_macro_utf_character_t_width_is(character); if (width == 0) { + // There are no ASCII private characters. return F_false; } @@ -371,6 +374,7 @@ extern "C" { const uint8_t width = f_macro_utf_character_t_width_is(character); if (width == 0) { + // ASCII: '!' to '#'. if (character > 0x20000000 && character < 0x24000000) { return F_true; @@ -417,6 +421,7 @@ extern "C" { const uint8_t width = f_macro_utf_character_t_width_is(character); if (width == 0) { + // ASCII: '$' or '+'. if (character == 0x24000000 || character == 0x2b000000) { return F_true; @@ -509,6 +514,7 @@ extern "C" { const uint8_t width = f_macro_utf_character_t_width_is(character); if (width == 0) { + // There are no ASCII whitespace other. return F_false; } @@ -1162,6 +1168,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { + // ASCII: '!' to '#'. if (character[0] > 0x20 && character[0] < 0x24) { return F_true; @@ -1222,6 +1229,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { + // ASCII: '$' or '+'. if (character[0] == 0x24 || character[0] == 0x2b) { return F_true; @@ -1353,6 +1361,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { + // There are no ASCII whitespace modifiers. return F_false; } @@ -1384,6 +1393,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { + // There are no ASCII whitespace other. return F_false; } @@ -1517,6 +1527,7 @@ extern "C" { const uint8_t width = f_macro_utf_byte_width_is(*character); if (width == 0) { + // These control characters are considered zero-width spaces. if (*character >= 0x00 && *character <= 0x08) { return F_true; diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c index bb7f05c..c0f635d 100644 --- a/level_1/fl_conversion/c/conversion.c +++ b/level_1/fl_conversion/c/conversion.c @@ -21,6 +21,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_binary(string[i], &digit) == F_none) { if (scale) { scale++; @@ -80,6 +81,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_binary(string[i], &digit) == F_none) { if (scale) { scale++; @@ -123,6 +125,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { if (scale) { @@ -187,6 +190,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_decimal(string[i], &digit) == F_none) { if (scale) { @@ -233,6 +237,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { if (scale) { @@ -297,6 +302,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) { if (scale) { @@ -343,6 +349,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { if (scale) { @@ -407,6 +414,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) { if (scale) { @@ -453,6 +461,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_octal(string[i], &digit) == F_none) { if (scale) { @@ -517,6 +526,7 @@ extern "C" { f_number_unsigned_t converted = 0; for (f_string_length_t i = range.start; i <= range.stop; i++) { + if (f_conversion_character_to_octal(string[i], &digit) == F_none) { if (scale) { diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index 18572b9..da50aaa 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -53,16 +53,20 @@ extern "C" { f_string_length_t i = source_length; for (; i > 0; i--, static_source.used--) { + if (source[i - 1] == 0) continue; if (source[i - 1] == f_path_separator[0]) continue; + break; } // for i = destination_length; for (; i > 0; i--, static_destination.used--) { + if (destination[i - 1] == 0) continue; if (destination[i - 1] == f_path_separator[0]) continue; + break; } // for } @@ -103,16 +107,20 @@ extern "C" { f_string_length_t i = source_length; for (; i > 0; i--, static_source.used--) { + if (source[i - 1] == 0) continue; if (source[i - 1] == f_path_separator[0]) continue; + break; } // for i = destination_length; for (; i > 0; i--, static_destination.used--) { + if (destination[i - 1] == 0) continue; if (destination[i - 1] == f_path_separator[0]) continue; + break; } // for } @@ -169,16 +177,20 @@ extern "C" { f_string_length_t i = source_length; for (; i > 0; i--, static_source.used--) { + if (source[i - 1] == 0) continue; if (source[i - 1] == f_path_separator[0]) continue; + break; } // for i = destination_length; for (; i > 0; i--, static_destination.used--) { + if (destination[i - 1] == 0) continue; if (destination[i - 1] == f_path_separator[0]) continue; + break; } // for } @@ -219,16 +231,20 @@ extern "C" { f_string_length_t i = source_length; for (; i > 0; i--, static_source.used--) { + if (source[i - 1] == 0) continue; if (source[i - 1] == f_path_separator[0]) continue; + break; } // for i = destination_length; for (; i > 0; i--, static_destination.used--) { + if (destination[i - 1] == 0) continue; if (destination[i - 1] == f_path_separator[0]) continue; + break; } // for } @@ -275,6 +291,7 @@ extern "C" { f_status_t status = F_none; for (; i > 0; i--) { + if (path->string[i] == 0) continue; status = f_utf_is_control(path->string + i, path->used - i); diff --git a/level_1/fl_directory/c/directory.h b/level_1/fl_directory/c/directory.h index 3b229c0..ee7cbf4 100644 --- a/level_1/fl_directory/c/directory.h +++ b/level_1/fl_directory/c/directory.h @@ -284,6 +284,8 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. * + * Errors (with error bit) from: f_file_stat_at(). + * * @see alphasort() * @see opendir() * @see scandir() @@ -309,6 +311,8 @@ extern "C" { * F_data_not if path.used is 0. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. + * + * Errors (with error bit) from: f_utf_is_control(). */ #ifndef _di_fl_directory_path_pop_ extern f_return_status fl_directory_path_pop(f_string_static_t *path); diff --git a/level_1/fl_directory/c/private-directory.c b/level_1/fl_directory/c/private-directory.c index 0a75acf..05916ab 100644 --- a/level_1/fl_directory/c/private-directory.c +++ b/level_1/fl_directory/c/private-directory.c @@ -11,6 +11,7 @@ extern "C" { f_directory_listing_t listing = f_directory_listing_t_initialize; status = private_fl_directory_list(source.string, 0, 0, F_false, &listing); + if (F_status_is_error(status)) { f_macro_directory_listing_t_delete_simple(listing); return status; @@ -36,6 +37,7 @@ extern "C" { f_array_length_t j = 0; for (; i < 7; i++) { + for (j = 0; F_status_is_fine(status) && j < list[i]->used; j++) { status = private_fl_directory_clone_file(list[i]->array[j], source, destination, role, recurse); } // for @@ -220,6 +222,7 @@ extern "C" { f_directory_listing_t listing = f_directory_listing_t_initialize; status = private_fl_directory_list(source.string, 0, 0, F_false, &listing); + if (F_status_is_error(status)) { f_macro_directory_listing_t_delete_simple(listing); return status; @@ -363,6 +366,7 @@ extern "C" { memset(&source_stat, 0, sizeof(struct stat)); status = f_file_stat(source.string, F_false, &source_stat); + if (F_status_is_error(status)) { if (status == F_status_set_error(F_string_too_large)) { size = f_string_length_t_size - 1; @@ -475,6 +479,7 @@ extern "C" { size_t i = 0; for (; i < length; i++) { + size = strnlen(entity[i]->d_name, f_directory_name_max); // There is no reason to include "." and ".." in the directory listing. diff --git a/level_1/fl_directory/c/private-directory.h b/level_1/fl_directory/c/private-directory.h index 31432f7..995777d 100644 --- a/level_1/fl_directory/c/private-directory.h +++ b/level_1/fl_directory/c/private-directory.h @@ -164,6 +164,8 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if appended string length is too large to store in the buffer. * + * Errors (with error bit) from: f_file_stat_at(). + * * @see fl_directory_list() */ #if !defined(_di_fl_directory_list_) diff --git a/level_1/fl_environment/c/environment.c b/level_1/fl_environment/c/environment.c index 9144b35..59fa7d1 100644 --- a/level_1/fl_environment/c/environment.c +++ b/level_1/fl_environment/c/environment.c @@ -15,6 +15,7 @@ extern "C" { const f_string_length_t length = strnlen(path, PATH_MAX); if (length == 0) { + // When PATH is "", this is actually a valid search path for PWD. // Append an equivalent representation of PWD (string used length is 0). f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); @@ -31,6 +32,7 @@ extern "C" { f_string_length_t total = 0; for (i = 0; i <= length; i++) { + if (i == length || path[i] == f_path_separator_variable[0]) { f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); if (F_status_is_error(status)) return status; @@ -89,6 +91,7 @@ extern "C" { f_status_t status = F_none; if (path.used == 0) { + // When PATH is "", this is actually a valid search path for PWD. // Therefore append an equivalent representation of PWD (string used length is 0). f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); @@ -108,6 +111,7 @@ extern "C" { f_string_dynamic_t part = f_string_dynamic_t_initialize; for (i = 0; i <= path.used; i++) { + if (i == path.used || path.string[i] == f_path_separator_variable[0]) { f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); if (F_status_is_error(status)) return status; @@ -166,6 +170,7 @@ extern "C" { const f_string_length_t length = strnlen(path, PATH_MAX); if (length == 0) { + // When PATH is "", this is actually a valid search path for PWD. // Therefore append an equivalent representation of PWD (string used length is 0). f_macro_memory_structure_macro_increment(status, (*paths), 1, f_memory_default_allocation_step, f_macro_string_dynamics_resize, F_buffer_too_large); @@ -217,6 +222,7 @@ extern "C" { last = j; } else if (j == 0) { + // when j = 0, the total is actually the entire length to max. total = last - j; diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index c9a4d15..f9477ac 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -20,6 +20,7 @@ extern "C" { f_string_lengths_t delimits = f_string_lengths_t_initialize; status = private_fl_fss_basic_object_read(buffer, range, found, quoted, &delimits); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); return status; @@ -71,13 +72,12 @@ extern "C" { found->array[found->used].start = range->start; // search for valid content. - for (;;) { + for (;; range->start++) { + fl_macro_fss_skip_past_delimit_placeholders((*buffer), (*range)); fl_macro_fss_content_delimited_return_on_overflow((*buffer), (*range), (*found), delimits, F_none_eos, F_none_stop); if (buffer->string[range->start] == f_fss_basic_close) break; - - range->start++; } // for // Save the stop length/ @@ -129,6 +129,7 @@ extern "C" { } while (range->start <= range->stop && range->start < content.used) { + if (content.string[range->start] == f_string_eol[0]) { destination->string[buffer_position.stop] = f_string_eol[0]; destination->used = buffer_position.stop + 1; diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index 63ce16a..8fbcee6 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -51,6 +51,7 @@ extern "C" { // identify where the object ends. while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { + if (buffer->string[range->start] == f_fss_delimit_slash) { f_string_length_t first_slash = range->start; f_string_length_t slash_count = 1; @@ -59,6 +60,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { + if (buffer->string[range->start] == f_fss_delimit_slash) { slash_count++; } @@ -105,6 +107,7 @@ extern "C" { if (slash_count % 2 == 0) { while (slash_count > 0) { + if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits.array[delimits.used] = range->start; @@ -213,6 +216,7 @@ extern "C" { // identify where the content ends. while (range->start < buffer->used && range->start <= range->stop) { + if (buffer->string[range->start] == f_string_eol[0]) { found_newline = F_true; last_newline = range->start; @@ -233,6 +237,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop && (buffer->string[range->start] == f_fss_delimit_placeholder || buffer->string[range->start] == f_fss_delimit_slash)) { + if (buffer->string[range->start] == f_fss_delimit_slash) { slash_count++; } @@ -302,6 +307,7 @@ extern "C" { } while (slash_count > 0) { + if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits.array[delimits.used] = range->start; @@ -420,6 +426,7 @@ extern "C" { buffer_position.stop = destination->used; while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_comment) { // comments are not allowed and this format has no way of "wrapping" a comment. return F_status_set_error(FL_fss_found_comment); @@ -441,6 +448,7 @@ extern "C" { } // while while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_delimit_slash) { f_string_length_t slash_count = 1; @@ -451,6 +459,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; @@ -548,6 +557,7 @@ extern "C" { buffer_position.stop = destination->used; while (range->start <= range->stop && range->start < content.used) { + if (content.string[range->start] == f_fss_delimit_slash && !is_comment) { f_string_length_t slash_count = 1; @@ -559,6 +569,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < content.used) { + if (content.string[range->start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index afcc442..cf69efe 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -20,6 +20,7 @@ extern "C" { f_string_lengths_t delimits = f_string_lengths_t_initialize; status = private_fl_fss_basic_object_read(buffer, range, found, quoted, &delimits); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); return status; diff --git a/level_1/fl_fss/c/fss_extended_list.c b/level_1/fl_fss/c/fss_extended_list.c index 396f13e..fa36d42 100644 --- a/level_1/fl_fss/c/fss_extended_list.c +++ b/level_1/fl_fss/c/fss_extended_list.c @@ -59,6 +59,7 @@ extern "C" { // identify where the object ends. while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { + if (buffer->string[range->start] == f_fss_delimit_slash) { f_string_length_t first_slash = range->start; f_string_length_t slash_count = 1; @@ -84,6 +85,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start < buffer->used && range->start <= range->stop) { + if (buffer->string[range->start] == f_string_eol[0] || (status = f_fss_is_graph(*buffer, *range)) == F_true) { break; } @@ -112,6 +114,7 @@ extern "C" { if (slash_count % 2 == 0) { while (slash_count > 0) { + if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits.array[delimits.used] = range->start; @@ -180,6 +183,7 @@ extern "C" { // seek to the end of the line when no valid object is found. while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -229,6 +233,7 @@ extern "C" { f_string_length_t last_newline = range->start; f_macro_string_lengths_t_new(status, positions_start, f_fss_default_allocation_step); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); @@ -236,6 +241,7 @@ extern "C" { } f_macro_fss_objects_t_new(status, objects, f_fss_default_allocation_step); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(positions_start); f_macro_string_lengths_t_delete_simple(delimits); @@ -249,6 +255,7 @@ extern "C" { positions_start.used = 1; while (range->start < buffer->used && range->start <= range->stop) { + if (buffer->string[range->start] == f_string_eol[0]) { last_newline = range->start; position_previous = range->start; @@ -272,6 +279,7 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -289,6 +297,7 @@ extern "C" { } status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -328,6 +337,7 @@ extern "C" { range->start++; while (range->start < buffer->used && range->start <= range->stop) { + if (buffer->string[range->start] == f_string_eol[0]) { last_newline = range->start; line_start = range->start + 1; @@ -348,6 +358,7 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -394,6 +405,7 @@ extern "C" { // apply slash delimits, only slashes and placeholders should be present. while (slash_count > 0) { + if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits.array[delimits.used] = range->start; @@ -464,6 +476,7 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -492,6 +505,7 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -548,6 +562,7 @@ extern "C" { // No valid object open found, seek until EOL. else { while (range->start < buffer->used && range->start <= range->stop) { + if (buffer->string[range->start] == f_string_eol[0]) { last_newline = range->start; line_start = range->start + 1; @@ -556,6 +571,7 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -575,8 +591,10 @@ extern "C" { } else if (buffer->string[range->start] == f_fss_extended_list_close) { while (range->start < buffer->used && range->start <= range->stop) { + position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -671,6 +689,7 @@ extern "C" { if (depth == 0) { status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -694,6 +713,7 @@ extern "C" { // No valid object close found, seek until EOL. else { while (range->start < buffer->used && range->start <= range->stop) { + if (buffer->string[range->start] == f_string_eol[0]) { last_newline = range->start; line_start = range->start + 1; @@ -702,6 +722,7 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -722,6 +743,7 @@ extern "C" { else if (buffer->string[range->start] != f_string_eol[0]) { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -739,6 +761,7 @@ extern "C" { position_previous = range->start; status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { f_macro_string_lengths_t_delete_simple(delimits); f_macro_string_lengths_t_delete_simple(positions_start); @@ -753,12 +776,16 @@ extern "C" { f_macro_fss_objects_t_delete_simple(objects); if (range->start > range->stop) { - if (depth == 0) return F_status_set_error(F_unterminated_stop); + if (depth == 0) { + return F_status_set_error(F_unterminated_stop); + } return F_status_set_error(F_unterminated_nest_stop); } - if (depth == 0) return F_status_set_error(F_unterminated_eos); + if (depth == 0) { + return F_status_set_error(F_unterminated_eos); + } return F_status_set_error(F_unterminated_nest_eos); } @@ -797,6 +824,7 @@ extern "C" { buffer_position.stop = destination->used; while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_comment) { // comments are not allowed and this format has no way of "wrapping" a comment. return F_status_set_error(FL_fss_found_comment); @@ -818,6 +846,7 @@ extern "C" { } // while while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_delimit_slash) { f_string_length_t slash_count = 1; @@ -828,6 +857,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; @@ -924,6 +954,7 @@ extern "C" { buffer_position.stop = destination->used; while (range->start <= range->stop && range->start < content.used) { + if (content.string[range->start] == f_fss_delimit_slash && !is_comment) { f_string_length_t slash_count = 1; @@ -935,6 +966,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < content.used) { + if (content.string[range->start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(content, range, 1); if (F_status_is_error(status)) return status; @@ -961,6 +993,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start < content.used && range->start <= range->stop) { + if (content.string[range->start] == f_string_eol[0] || (status = f_fss_is_graph(content, *range)) == F_true) { break; } @@ -1006,6 +1039,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start < content.used && range->start <= range->stop) { + if (content.string[range->start] == f_string_eol[0] || (status = f_fss_is_graph(content, *range)) == F_true) { break; } diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 30b6533..d7bbede 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -62,6 +62,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < buffer->used) { + status = f_fss_is_zero_width(*buffer, *range); if (F_status_is_error(status)) return status; @@ -96,6 +97,7 @@ extern "C" { } status = f_utf_buffer_increment(*buffer, range, 1); + if (F_status_is_error(status)) { return status; } @@ -150,6 +152,7 @@ extern "C" { status = F_none; while (range->start <= range->stop && range->start < buffer->used) { + status = f_fss_is_space(*buffer, *range); if (F_status_is_error(status)) return status; @@ -258,6 +261,7 @@ extern "C" { } while (slash_count > 0) { + if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; @@ -283,6 +287,7 @@ extern "C" { if ((status = f_fss_is_graph(*buffer, *range)) == F_true) { while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -328,6 +333,7 @@ extern "C" { } while (slash_count > 0) { + if (buffer->string[range->start] == f_fss_delimit_slash) { if (slash_count % 2 == 1) { delimits->array[delimits->used] = range->start; @@ -394,6 +400,7 @@ extern "C" { if (F_status_is_error(status)) return status; while (range->start <= range->stop && range->start < buffer->used) { + if (buffer->string[range->start] == f_string_eol[0]) { range->start++; return FL_fss_found_object_content_not; @@ -410,9 +417,9 @@ extern "C" { else if (buffer->string[range->start] != f_fss_delimit_placeholder) { while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; - } // while if (range->start >= buffer->used) { @@ -467,6 +474,7 @@ extern "C" { // seek to the end of the line when no valid object is found-> while (range->start < buffer->used && range->start <= range->stop && buffer->string[range->start] != f_string_eol[0]) { + status = f_utf_buffer_increment(*buffer, range, 1); if (F_status_is_error(status)) return status; } // while @@ -528,6 +536,7 @@ extern "C" { if (object.string[range->start] == f_fss_delimit_slash) { while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; @@ -581,6 +590,7 @@ extern "C" { } while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; @@ -608,6 +618,7 @@ extern "C" { bool must_delimit = F_false; while (next.start <= next.stop && next.start < object.used) { + if (object.string[next.start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(object, &next, 1); if (F_status_is_error(status)) return status; @@ -625,6 +636,7 @@ extern "C" { } // while if (next.start <= next.stop && next.start < object.used) { + // identify if quoted exists and could be considered a valid closing quoted. if (object.string[next.start] == destination->string[destination_position.start]) { fl_macro_fss_skip_past_delimit_placeholders(object, next); @@ -651,6 +663,7 @@ extern "C" { if (must_delimit) { for (f_string_length_t i = 0; i < slashes; i++) { + destination->string[destination_position.stop] = f_fss_delimit_slash; destination_position.stop++; } // for @@ -726,6 +739,7 @@ extern "C" { if (object.string[range->start] == f_fss_delimit_slash) { while (range->start <= range->stop && range->start < object.used) { + if (object.string[range->start] == f_fss_delimit_placeholder) { status = f_utf_buffer_increment(object, range, 1); if (F_status_is_error(status)) return status; diff --git a/level_1/fl_iki/c/iki.h b/level_1/fl_iki/c/iki.h index 4e89c88..7f3b59d 100644 --- a/level_1/fl_iki/c/iki.h +++ b/level_1/fl_iki/c/iki.h @@ -58,6 +58,8 @@ extern "C" { * F_memory_reallocation (with error bit) on memory reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if a string length is too large to store in the buffer. + * + * Errors (with error bit) from: f_iki_read(). */ #ifndef _di_fl_iki_read_ extern f_return_status fl_iki_read(f_string_static_t *buffer, f_string_range_t *range, f_iki_variable_t *variable, f_iki_vocabulary_t *vocabulary, f_iki_content_t *content); diff --git a/level_1/fl_print/c/print.c b/level_1/fl_print/c/print.c index b7d4d7c..e466f62 100644 --- a/level_1/fl_print/c/print.c +++ b/level_1/fl_print/c/print.c @@ -16,6 +16,7 @@ extern "C" { uint8_t width_max = 0; for (; i < length; i += f_macro_utf_byte_width(string[i])) { + width_max = (length - i) + 1; status = f_utf_is_whitespace(string + i, width_max); diff --git a/level_1/fl_string/c/private-string.c b/level_1/fl_string/c/private-string.c index 27a4b9a..12f1e0f 100644 --- a/level_1/fl_string/c/private-string.c +++ b/level_1/fl_string/c/private-string.c @@ -7,7 +7,6 @@ extern "C" { #if !defined(_di_fl_string_append_) || !defined(_di_fl_string_dynamic_append_) || !defined(_di_fl_string_append_mash_) || !defined(_di_fl_string_dynamic_mash_) f_return_status private_fl_string_append(const f_string_t source, const f_string_length_t length, f_string_dynamic_t *destination) { - f_status_t status = F_none; if (destination->used + length > destination->size) { @@ -84,6 +83,7 @@ extern "C" { f_string_length_t i2 = offset2; for (; i1 < stop1 && i2 < stop2; i1++, i2++) { + // skip past NULL in string1. while (i1 < stop1 && string1[i1] == 0) i1++; if (i1 == stop1) break; @@ -119,6 +119,7 @@ extern "C" { // skip past leading whitespace in string1. for (; i1 < stop1; i1 += width) { + // skip past NULL in string1. while (i1 < stop1 && string1[i1] == 0) i1++; if (i1 == stop1) break; @@ -139,6 +140,7 @@ extern "C" { // skip past leading whitespace in string2. for (; i2 < stop2; i2 += width) { + // skip past NULL in string2. while (i2 < stop2 && string2[i2] == 0) i2++; if (i2 == stop2) break; @@ -167,12 +169,14 @@ extern "C" { // determine where the last non-whitespace is in string1. for (f_string_length_t j = i1; j < stop1; j += width) { + // skip past NULL in string1. while (j < stop1 && string1[j] == 0) j++; if (j == stop1) break; width_max = (stop1 - j) + 1; status = f_utf_is_whitespace(string1 + j, width_max); + if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_maybe) return F_status_set_error(F_utf); @@ -189,6 +193,7 @@ extern "C" { // determine where the last non-whitespace is in string2. for (f_string_length_t j = i2; j < stop2; j += width) { + // skip past NULL in string2. while (j < stop2 && string2[j] == 0) j++; if (j == stop2) break; @@ -214,6 +219,7 @@ extern "C" { } for (; i1 < last1 && i2 < last2; i1++, i2++) { + // skip past NULL in string1. while (i1 < last1 && string1[i1] == 0) i1++; if (i1 == last1) break; @@ -300,6 +306,7 @@ extern "C" { f_string_length_t size = 0; for (f_string_length_t i = 0; i <= length; i++) { + if (i == length) { if (i > first) { size = i - first; @@ -360,11 +367,13 @@ extern "C" { // skip past leading whitespace. for (; *start <= *stop; *start += width) { + // skip past NULL. while (*start < *stop && source[*start] == 0) (*start)++; if (*start > *stop) break; status = f_utf_is_whitespace(source + *start, (*stop - *start) + 1); + if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_maybe) { return F_status_set_error(F_utf); @@ -389,6 +398,7 @@ extern "C" { // each UTF-8 character of width 1 is an incomplete part. // go left until either width is 0 (ascii, or > 1) to determine the character. for (;;) { + width = f_macro_utf_byte_width_is(source[*stop]); if (width == 1) { @@ -396,12 +406,15 @@ extern "C" { if (*stop == *start) break; } - else break; + else { + break; + } } // for if (*stop == *start) break; status = f_utf_is_whitespace(source + *stop, (stop_original - *stop) + 1); + if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_maybe) { return F_status_set_error(F_utf); @@ -415,6 +428,7 @@ extern "C" { if (*stop == *start) { status = f_utf_is_whitespace(source + *stop, (stop_original - *stop) + 1); + if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_maybe) { return F_status_set_error(F_utf); diff --git a/level_1/fl_string/c/private-string.h b/level_1/fl_string/c/private-string.h index d7a90d1..d67d731 100644 --- a/level_1/fl_string/c/private-string.h +++ b/level_1/fl_string/c/private-string.h @@ -129,6 +129,8 @@ extern "C" { * F_equal_to_not when both strings do not equal. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_utf_is_whitespace(). + * * @see fl_string_compare_trim() * @see fl_string_dynamic_compare_trim() * @see fl_string_dynamic_partial_compare_trim() diff --git a/level_1/fl_utf/c/private-utf.c b/level_1/fl_utf/c/private-utf.c index 8e7f70f..6105c0f 100644 --- a/level_1/fl_utf/c/private-utf.c +++ b/level_1/fl_utf/c/private-utf.c @@ -41,7 +41,9 @@ extern "C" { if (i > first) { f_utf_string_length_t size = i - first; - if (destination->used + size > f_utf_string_t_size_max) return F_status_set_error(F_string_too_large); + if (destination->used + size > f_utf_string_t_size_max) { + return F_status_set_error(F_string_too_large); + } f_utf_string_length_t total = destination->used + size; @@ -62,7 +64,9 @@ extern "C" { if (i > first) { f_utf_string_length_t size = i - first; - if (destination->used + size > f_utf_string_t_size_max) return F_status_set_error(F_string_too_large); + if (destination->used + size > f_utf_string_t_size_max) { + return F_status_set_error(F_string_too_large); + } f_utf_string_length_t total = destination->used + size; @@ -95,6 +99,7 @@ extern "C" { f_utf_string_length_t i2 = offset2; for (; i1 < stop1 && i2 < stop2; i1++, i2++) { + // skip past NULL in string1. while (i1 < stop1 && string1[i1] == 0) i1++; if (i1 == stop1) break; @@ -134,6 +139,7 @@ extern "C" { if (i1 == stop1) break; status = f_utf_character_is_whitespace(string1[i1]); + if (F_status_is_error(status)) { // ignore possibly invalid UTF-8 codes. if (F_status_set_fine(status) != F_maybe) { @@ -146,11 +152,13 @@ extern "C" { // skip past leading whitespace in string2. for (; i2 < stop2; i2++) { + // skip past NULL in string2. while (i2 < stop2 && string2[i2] == 0) i2++; if (i2 == stop2) break; status = f_utf_character_is_whitespace(string2[i2]); + if (F_status_is_error(status)) { // ignore possibly invalid UTF-8 codes. if (F_status_set_fine(status) != F_maybe) { @@ -171,11 +179,13 @@ extern "C" { // determine where the last non-whitespace is in string1. for (f_utf_string_length_t j = i1; j < stop1; j++) { + // skip past NULL in string1. while (j < stop1 && string1[j] == 0) j++; if (j == stop1) break; status = f_utf_character_is_whitespace(string1[j]); + if (F_status_is_error(status)) { // ignore possibly invalid UTF-8 codes. if (F_status_set_fine(status) != F_maybe) { @@ -197,6 +207,7 @@ extern "C" { if (j == stop2) break; status = f_utf_character_is_whitespace(string2[j]); + if (F_status_is_error(status)) { // ignore possibly invalid UTF-8 codes. if (F_status_set_fine(status) != F_maybe) { @@ -358,6 +369,7 @@ extern "C" { if (*start > *stop) break; status = f_utf_character_is_whitespace(source[*start]); + if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_maybe) { return F_status_set_error(F_utf); @@ -378,6 +390,7 @@ extern "C" { if (*stop == *start) break; status = f_utf_character_is_whitespace(source[*stop]); + if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_maybe) { return F_status_set_error(F_utf); @@ -391,6 +404,7 @@ extern "C" { if (*stop == *start) { status = f_utf_character_is_whitespace(source[*stop]); + if (F_status_is_error(status)) { if (F_status_set_fine(status) == F_maybe) { return F_status_set_error(F_utf); diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 4b1f5c6..b7e6e60 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -147,6 +147,7 @@ extern "C" { f_utf_string_length_t j = 1; while (i <= source.used && j <= destination->used) { + if (source.string[source.used - i] == f_utf_character_t_eos) { i++; continue; @@ -185,6 +186,7 @@ extern "C" { f_utf_string_length_t j = 1; while (i <= source.used && j <= destination->used) { + if (source.string[source.used - i] == f_utf_character_t_eos) { i++; continue; @@ -333,6 +335,7 @@ extern "C" { f_utf_string_length_t j = 1; while (i <= length && j <= destination->used) { + if (source.string[range.stop - i] == f_utf_character_t_eos) { i++; continue; @@ -373,6 +376,7 @@ extern "C" { f_utf_string_length_t j = 1; while (i <= length && j <= destination->used) { + if (source.string[range.stop - i] == f_utf_character_t_eos) { i++; continue; @@ -539,6 +543,7 @@ extern "C" { f_utf_string_length_t j = 0; while (i < length && j < destination->used) { + if (source.string[i + range.start] == f_utf_character_t_eos) { i++; continue; @@ -581,6 +586,7 @@ extern "C" { f_utf_string_length_t j = 0; while (i < length && j < destination->used) { + if (source.string[i + range.start] == f_utf_character_t_eos) { i++; continue; @@ -645,6 +651,7 @@ extern "C" { f_utf_string_length_t j = 0; while (i < source.used && j < destination->used) { + if (source.string[i] == f_utf_character_t_eos) { i++; continue; @@ -683,6 +690,7 @@ extern "C" { f_utf_string_length_t j = 0; while (i < source.used && j < destination->used) { + if (source.string[i] == f_utf_character_t_eos) { i++; continue; @@ -763,7 +771,10 @@ extern "C" { } while (buffer.string[range->start] != seek_to_this) { - if (buffer.string[range->start] == f_utf_character_t_eol) return F_none_eol; + + if (buffer.string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } range->start++; @@ -795,7 +806,10 @@ extern "C" { } while (buffer.string[range->start] != seek_to_character) { - if (buffer.string[range->start] == f_utf_character_t_eol) return F_none_eol; + + if (buffer.string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } range->start++; @@ -829,6 +843,7 @@ extern "C" { } while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_graph(buffer.string[range->start])) == F_false) { + if (F_status_is_error(status)) return status; if (buffer.string[range->start] == f_utf_character_t_eol) return F_none_eol; @@ -866,6 +881,7 @@ extern "C" { } while (buffer.string[range->start] == placeholder || (status = f_utf_character_is_whitespace(buffer.string[range->start])) == F_false) { + if (F_status_is_error(status)) return status; if (buffer.string[range->start] == f_utf_character_t_eol) return F_none_eol; @@ -987,6 +1003,7 @@ extern "C" { if (destination->used > 0) { for (; destination->used > 0; destination->used--) { + if (destination->string[destination->used - 1] == 0) continue; break; } // for @@ -1108,6 +1125,7 @@ extern "C" { f_utf_string_length_t j = 0; while (i < length && j < destination->used) { + if (source[i] == f_utf_character_t_eos) { i++; continue; @@ -1146,6 +1164,7 @@ extern "C" { f_utf_string_length_t j = 0; while (i < length && j < destination->used) { + if (source[i] == f_utf_character_t_eos) { i++; continue; @@ -1233,7 +1252,10 @@ extern "C" { } while (string[range->start] != seek_to_this) { - if (string[range->start] == f_utf_character_t_eol) return F_none_eol; + + if (string[range->start] == f_utf_character_t_eol) { + return F_none_eol; + } range->start++; @@ -1259,6 +1281,7 @@ extern "C" { f_utf_character_t seek_to_character = seek_to_this << 24; for (; range->start <= range->stop; range->start++) { + if (f_macro_utf_character_t_width_is(string[range->start]) == 1) { return F_status_set_error(F_utf); } @@ -1286,6 +1309,7 @@ extern "C" { } while (string[range->start] == placeholder || (status = f_utf_character_is_graph(string[range->start])) == F_false) { + if (F_status_is_error(status)) return status; if (string[range->start] == f_utf_character_t_eol) return F_none_eol; @@ -1317,6 +1341,7 @@ extern "C" { if (f_macro_utf_character_t_width_is(string[range->start]) == 1) return F_status_set_error(F_utf); while (string[range->start] == placeholder || (status = f_utf_character_is_graph(string[range->start])) == F_true) { + if (F_status_is_error(status)) return status; if (string[range->start] == f_utf_character_t_eol) return F_none_eol; @@ -1376,7 +1401,10 @@ extern "C" { } while (range->start <= range->stop) { - if (string[range->start] == seek_to_character) return F_none; + + if (string[range->start] == seek_to_character) { + return F_none; + } range->start++; diff --git a/level_1/fl_utf_file/c/private-utf_file.c b/level_1/fl_utf_file/c/private-utf_file.c index e086836..2e6072d 100644 --- a/level_1/fl_utf_file/c/private-utf_file.c +++ b/level_1/fl_utf_file/c/private-utf_file.c @@ -96,6 +96,7 @@ extern "C" { memset(buffer_write, 0, write_size); for (i = 0, used = 0; used < write_size && *written + i < write_max; i++, used += width) { + if (width_written < width) { if (width_written < 2) { buffer_write[used] = f_macro_utf_character_t_to_char_2(string[*written + i]); diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 5642e50..ca13376 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -17,7 +17,6 @@ extern "C" { f_status_t status = F_none; status = private_fll_execute_arguments_add(source, length, arguments); - if (F_status_is_error(status)) return status; return F_none; @@ -37,7 +36,6 @@ extern "C" { f_status_t status = F_none; status = private_fll_execute_arguments_add_parameter(prefix, prefix_length, name, name_length, value, value_length, arguments); - if (F_status_is_error(status)) return status; return F_none; @@ -60,7 +58,6 @@ extern "C" { if (value_length[i] == 0) continue; status = private_fll_execute_arguments_add_parameter(prefix[i], prefix_length[i], name[i], name_length[i], value[i], value_length[i], arguments); - if (F_status_is_error(status)) return status; } // for @@ -83,7 +80,6 @@ extern "C" { if (length[i] == 0) continue; status = private_fll_execute_arguments_add(source[i], length[i], arguments); - if (F_status_is_error(status)) return status; } // for @@ -104,7 +100,6 @@ extern "C" { f_status_t status = F_none; status = private_fll_execute_arguments_add(source.string, source.used, arguments); - if (F_status_is_error(status)) return status; return F_none; @@ -127,7 +122,6 @@ extern "C" { f_status_t status = F_none; status = private_fll_execute_arguments_add_parameter(prefix.string, prefix.used, name.string, name.used, value.string, value.used, arguments); - if (F_status_is_error(status)) return status; return F_none; @@ -153,7 +147,6 @@ extern "C" { if (value[i].used > value[i].size) continue; status = private_fll_execute_arguments_add_parameter(prefix[i].string, prefix[i].used, name[i].string, name[i].used, value[i].string, value[i].used, arguments); - if (F_status_is_error(status)) return status; } // for @@ -177,7 +170,6 @@ extern "C" { if (source[i].used > source[i].size) continue; status = private_fll_execute_arguments_add(source[i].string, source[i].used, arguments); - if (F_status_is_error(status)) return status; } // for @@ -209,7 +201,6 @@ extern "C" { if (name_size > 1) { f_macro_string_t_new(status, program_name, name_size + 1); - if (F_status_is_error(status)) return status; memcpy(program_name, program_path, name_size); @@ -224,7 +215,6 @@ extern "C" { if (name_size > 1) { f_macro_string_t_new(status, program_name, name_size + 1); - if (F_status_is_error(status)) return status; memcpy(program_name, last_slash + 1, name_size); @@ -250,6 +240,7 @@ extern "C" { fixed_arguments[arguments.used + 1] = 0; status = f_file_exists(program_path); + if (F_status_is_error(status)) { if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size); @@ -266,7 +257,9 @@ extern "C" { process_id = fork(); if (process_id < 0) { - if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size); + if (name_size > 0) { + f_macro_string_t_delete_simple(program_name, name_size); + } return F_status_set_error(F_fork); } @@ -286,9 +279,13 @@ extern "C" { // have the parent wait for the child process to finish waitpid(process_id, result, WUNTRACED | WCONTINUED); - if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size); + if (name_size > 0) { + f_macro_string_t_delete_simple(program_name, name_size); + } - if (result != 0 && *result != 0) return F_status_set_error(F_failure); + if (result != 0 && *result != 0) { + return F_status_set_error(F_failure); + } return F_none; } @@ -405,7 +402,9 @@ extern "C" { // have the parent wait for the child process to finish. waitpid(process_id, result, WUNTRACED | WCONTINUED); - if (name_size > 0) f_macro_string_t_delete_simple(program_name, name_size); + if (name_size > 0) { + f_macro_string_t_delete_simple(program_name, name_size); + } if (result != 0) { if (WIFEXITED(*result)) { @@ -464,7 +463,9 @@ extern "C" { // have the parent wait for the child process to finish waitpid(process_id, result, WUNTRACED | WCONTINUED); - if (result != 0 && *result != 0) return F_status_set_error(F_failure); + if (result != 0 && *result != 0) { + return F_status_set_error(F_failure); + } return F_none; } @@ -501,6 +502,7 @@ extern "C" { status = f_environment_get("PATH", &path); if (F_status_is_error(status)) { + // Do not consider PATH is not available (or valid?) to be an error. if (F_status_set_fine(status) == F_invalid || F_status_set_fine(status) == F_failure) { status = F_none; @@ -517,6 +519,7 @@ extern "C" { } f_macro_string_dynamic_t_delete(status, path); + if (F_status_is_error(status)) { f_macro_string_dynamics_t_delete_simple(paths); return status; @@ -526,6 +529,7 @@ extern "C" { f_string_dynamic_t *found = 0; for (i = 0; i < paths.used; i++) { + status = fl_string_append(program_name, program_name_length, &paths.array[i]); if (F_status_is_error_not(status)) { @@ -572,9 +576,7 @@ extern "C" { memcpy(&program_path, found->string, found->used); f_macro_string_dynamics_t_delete(status, paths); - if (F_status_is_error(status)) { - return status; - } + if (F_status_is_error(status)) return status; pid_t process_id = 0; @@ -595,7 +597,7 @@ extern "C" { for (i = 0; i < names.used; i++) { f_environment_set_dynamic(names.array[i], values.array[i], F_true); - } + } // for const int code = execvp(program_path, fixed_arguments); diff --git a/level_2/fll_execute/c/execute.h b/level_2/fll_execute/c/execute.h index 3197e5f..800aa1a 100644 --- a/level_2/fll_execute/c/execute.h +++ b/level_2/fll_execute/c/execute.h @@ -57,6 +57,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_add_ extern f_return_status fll_execute_arguments_add(const f_string_t source, const f_string_length_t length, f_string_dynamics_t *arguments); @@ -95,6 +98,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_add_parameter_ extern f_return_status fll_execute_arguments_add_parameter(const f_string_t prefix, const f_string_length_t prefix_length, const f_string_t name, const f_string_length_t name_length, const f_string_t value, const f_string_length_t value_length, f_string_dynamics_t *arguments); @@ -136,6 +142,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_add_parameter_set_ extern f_return_status fll_execute_arguments_add_parameter_set(const f_string_t prefix[], const f_string_length_t prefix_length[], const f_string_t name[], const f_string_length_t name_length[], const f_string_t value[], const f_string_length_t value_length[], const f_array_length_t size, f_string_dynamics_t *arguments); @@ -163,6 +172,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_add_set_ extern f_return_status fll_execute_arguments_add_set(const f_string_t source[], const f_string_length_t length[], const f_array_length_t size, f_string_dynamics_t *arguments); @@ -186,6 +198,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_dynamic_add_ extern f_return_status fll_execute_arguments_dynamic_add(const f_string_static_t source, f_string_dynamics_t *arguments); @@ -219,6 +234,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_dynamic_add_parameter_ extern f_return_status fll_execute_arguments_dynamic_add_parameter(const f_string_static_t prefix, const f_string_static_t name, const f_string_static_t value, f_string_dynamics_t *arguments); @@ -254,6 +272,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_dynamic_add_parameter_set_ extern f_return_status fll_execute_arguments_dynamic_add_parameter_set(const f_string_static_t prefix[], const f_string_static_t name[], const f_string_static_t value[], const f_array_length_t size, f_string_dynamics_t *arguments); @@ -279,6 +300,9 @@ extern "C" { * F_memory_allocation (with error bit) on allocation error. * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). */ #ifndef _di_fll_execute_arguments_dynamic_add_set_ extern f_return_status fll_execute_arguments_dynamic_add_set(const f_string_static_t source[], const f_array_length_t size, f_string_dynamics_t *arguments); @@ -314,6 +338,8 @@ extern "C" { * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_file_exists(). + * * @see execv() */ #ifndef _di_fll_execute_path_ @@ -360,6 +386,8 @@ extern "C" { * F_number_overflow (with error bit) on overflow error. * F_parameter (with error bit) if a parameter is invalid. * + * Errors (with error bit) from: f_file_exists(). + * * @see execv() */ #ifndef _di_fll_execute_path_environment_ @@ -391,6 +419,8 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string (generated from PATH) is too large. * + * Errors (with error bit) from: f_file_exists(). + * * @see execvp() */ #ifndef _di_fll_execute_program_ @@ -441,6 +471,11 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_string_too_large (with error bit) if the combined string (generated from PATH) is too large. * + * Errors (with error bit) from: f_file_exists(). + * Errors (with error bit) from: fl_environment_path_explode_dynamic(). + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_dynamic_terminate(). + * * @see execvpe() */ #ifndef _di_fll_execute_program_environment_ diff --git a/level_2/fll_execute/c/private-execute.c b/level_2/fll_execute/c/private-execute.c index 8901e5f..e2e2b72 100644 --- a/level_2/fll_execute/c/private-execute.c +++ b/level_2/fll_execute/c/private-execute.c @@ -24,12 +24,14 @@ extern "C" { f_string_dynamic_t argument = f_string_dynamic_t_initialize; status = fl_string_append(source, length, &argument); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(argument); return status; } status = fl_string_dynamic_terminate(&argument); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(argument); return status; @@ -64,6 +66,7 @@ extern "C" { if (prefix_length > 0) { status = fl_string_append(prefix, prefix_length, &argument); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(argument); return status; @@ -71,12 +74,14 @@ extern "C" { } status = fl_string_append(name, name_length, &argument); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(argument); return status; } status = fl_string_dynamic_terminate(&argument); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(argument); return status; @@ -90,12 +95,14 @@ extern "C" { f_macro_string_dynamic_t_clear(argument); status = fl_string_append(value, value_length, &argument); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(argument); return status; } status = fl_string_dynamic_terminate(&argument); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(argument); return status; diff --git a/level_2/fll_file/c/file.h b/level_2/fll_file/c/file.h index 9b1a741..793d7f4 100644 --- a/level_2/fll_file/c/file.h +++ b/level_2/fll_file/c/file.h @@ -81,6 +81,10 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. + * + * Errors (with error bit) from: f_file_mode_set(). + * Errors (with error bit) from: f_directory_exists(). + * Errors (with error bit) from: fl_directory_list(). */ #ifndef _di_fll_file_mode_set_all_ extern f_return_status fll_file_mode_set_all(const f_string_t path, const mode_t mode, const f_number_unsigned_t depth_max); @@ -182,6 +186,10 @@ extern "C" { * F_parameter (with error bit) if a parameter is invalid. * F_read_only (with error bit) if file is read-only. * F_failure (with error bit) for any other error. + * + * Errors (with error bit) from: f_directory_is(). + * Errors (with error bit) from: f_file_role_change(). + * Errors (with error bit) from: fl_directory_list(). */ #ifndef _di_fll_file_role_change_all_ extern f_return_status fll_file_role_change_all(const f_string_t path, const uid_t uid, const gid_t gid, const bool dereference, const f_number_unsigned_t depth_max); diff --git a/level_2/fll_file/c/private-file.c b/level_2/fll_file/c/private-file.c index 7a3bf78..2e2a171 100644 --- a/level_2/fll_file/c/private-file.c +++ b/level_2/fll_file/c/private-file.c @@ -44,7 +44,9 @@ extern "C" { f_array_length_t j = 0; for (; i < 7; i++) { + for (j = 0; F_status_is_fine(status) && j < list[i]->used; j++) { + const f_string_length_t length = path_length + list[i]->array[j].used + 1; char path_sub[length + 1]; @@ -65,6 +67,7 @@ extern "C" { f_macro_string_dynamics_t_delete_simple(listing.unknown); for (f_array_length_t i = 0; F_status_is_fine(status) && i < listing.directory.used; i++) { + const f_string_length_t length = path_length + listing.directory.array[i].used + 1; char path_sub[length + 1]; @@ -91,7 +94,9 @@ extern "C" { f_macro_string_dynamics_t_delete_simple(listing.directory); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return f_file_mode_set(path, mode); } @@ -136,7 +141,9 @@ extern "C" { f_array_length_t j = 0; for (; i < 7; i++) { + for (j = 0; F_status_is_fine(status) && j < list[i]->used; j++) { + const f_string_length_t length = path_length + list[i]->array[j].used + 1; char path_sub[length + 1]; @@ -155,6 +162,7 @@ extern "C" { } for (f_array_length_t i = 0; F_status_is_fine(status) && i < listing.directory.used; i++) { + const f_string_length_t length = path_length + listing.directory.array[i].used + 1; char path_sub[length + 1]; @@ -181,7 +189,9 @@ extern "C" { f_macro_string_dynamics_t_delete_simple(listing.directory); - if (F_status_is_error(status)) return status; + if (F_status_is_error(status)) { + return status; + } return f_file_role_change(path, uid, gid, dereference); } diff --git a/level_2/fll_fss/c/fss.c b/level_2/fll_fss/c/fss.c index 3d753b6..ca8c0d9 100644 --- a/level_2/fll_fss/c/fss.c +++ b/level_2/fll_fss/c/fss.c @@ -69,6 +69,7 @@ extern "C" { memset(&matched, 0, sizeof(bool) * size); for (; i < objects.used; i++) { + length_object = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { @@ -118,9 +119,11 @@ extern "C" { f_array_length_t k = 0; for (; i < objects.used; i++) { + length_object = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { + status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); if (F_status_is_error(status)) return status; @@ -144,6 +147,7 @@ extern "C" { } for (k = 0; k < contents.array[i].used; k++) { + status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[k], &values[j]->array[values[j]->used]); if (F_status_is_error(status)) return status; @@ -191,12 +195,14 @@ extern "C" { length_name = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { + status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_name, lengths[j]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[0], &name); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -206,6 +212,7 @@ extern "C" { length_name = (contents.array[i].array[0].stop - contents.array[i].array[0].start) + 1; for (k = 0; k < values[j]->used; k++) { + status = fl_string_compare_trim(buffer.string + contents.array[i].array[0].start, values[j]->array[k].name.string, length_name, values[j]->array[k].name.used); if (F_status_is_error(status)) { @@ -234,6 +241,7 @@ extern "C" { } f_macro_string_maps_t_resize(status, (*values[j]), values[j]->used + 1); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -246,6 +254,7 @@ extern "C" { } else { f_macro_string_maps_t_resize(status, (*values[j]), values[j]->used + f_fss_default_allocation_step); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -262,6 +271,7 @@ extern "C" { if (contents.array[i].used > 1) { status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[1], &map->value); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -315,6 +325,7 @@ extern "C" { length_object = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { + status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); if (F_status_is_error(status)) return status; @@ -366,6 +377,7 @@ extern "C" { } for (k = 1; k < contents.array[i].used; k++) { + status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[k], &map_multi->value.array[map_multi->value.used]); if (F_status_is_error(status)) return status; @@ -406,6 +418,7 @@ extern "C" { length_object = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { + status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); if (F_status_is_error(status)) return status; @@ -450,6 +463,7 @@ extern "C" { if (contents.array[i].used > 1) { for (k = 1; k < contents.array[i].used; k++) { + status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], &map->value); if (F_status_is_error(status)) return status; } // for @@ -497,6 +511,7 @@ extern "C" { if (status == F_equal_to_not) continue; status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[0], &name); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -506,6 +521,7 @@ extern "C" { length_name = (contents.array[i].array[0].stop - contents.array[i].array[0].start) + 1; for (k = 0; k < values[j]->used; k++) { + status = fl_string_compare_trim(buffer.string + contents.array[i].array[0].start, values[j]->array[k].name.string, length_name, values[j]->array[k].name.used); if (F_status_is_error(status)) { @@ -579,6 +595,7 @@ extern "C" { } for (k = 1; k < contents.array[i].used; k++) { + status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], &map_multi->value.array[map_multi->value.used]); if (F_status_is_error(status)) return status; } // for @@ -622,12 +639,14 @@ extern "C" { length_name = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { + status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_name, lengths[j]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; status = fl_string_dynamic_partial_append_nulless(buffer, contents.array[i].array[0], &name); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -637,6 +656,7 @@ extern "C" { length_name = (contents.array[i].array[0].stop - contents.array[i].array[0].start) + 1; for (k = 0; k < values[j]->used; k++) { + status = fl_string_compare_trim(buffer.string + contents.array[i].array[0].start, values[j]->array[k].name.string, length_name, values[j]->array[k].name.used); if (F_status_is_error(status)) { @@ -666,6 +686,7 @@ extern "C" { } f_macro_string_maps_t_resize(status, (*values[j]), values[j]->used + 1); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -678,6 +699,7 @@ extern "C" { } else { f_macro_string_maps_t_resize(status, (*values[j]), values[j]->used + f_fss_default_allocation_step); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -708,6 +730,7 @@ extern "C" { if (contents.array[i].used > 1) { status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[1], &map->value); + if (F_status_is_error(status)) { f_macro_string_dynamic_t_delete_simple(name); return status; @@ -745,6 +768,7 @@ extern "C" { memset(&matched, 0, sizeof(bool) * size); for (; i < objects.used; i++) { + length_object = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { @@ -758,6 +782,7 @@ extern "C" { matched[j] = F_true; for (k = 0; k < contents.array[i].used; k++) { + status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], values[j]); if (F_status_is_error(status)) return status; } // for @@ -792,9 +817,11 @@ extern "C" { f_array_length_t k = 0; for (; i < objects.used; i++) { + length_object = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { + status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); if (F_status_is_error(status)) return status; @@ -826,6 +853,7 @@ extern "C" { } for (k = 0; k < contents.array[i].used; k++) { + status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], &values[j]->array[values[j]->used]); if (F_status_is_error(status)) return status; } // for @@ -863,15 +891,18 @@ extern "C" { f_array_length_t k = 0; for (; i < objects.used; i++) { + length_object = (objects.array[i].stop - objects.array[i].start) + 1; for (j = 0; j < size; j++) { + status = fl_string_compare_trim(buffer.string + objects.array[i].start, names[j], length_object, lengths[j]); if (F_status_is_error(status)) return status; if (status == F_equal_to_not) continue; for (k = 0; k < contents.array[i].used; k++) { + status = fl_string_dynamic_partial_mash_nulless(glue, glue_length, buffer, contents.array[i].array[k], values[j]); if (F_status_is_error(status)) return status; } // for diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index 0992c61..995bc90 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -175,6 +175,7 @@ extern "C" { if (contents.used > 0) { range.start = 0; range.stop = contents.array[0].used - 1; + status = fl_fss_basic_content_write(contents.array[0], &range, destination); if (F_status_is_error(status)) { diff --git a/level_2/fll_fss/c/fss_basic.h b/level_2/fll_fss/c/fss_basic.h index 349b507..9406e85 100644 --- a/level_2/fll_fss/c/fss_basic.h +++ b/level_2/fll_fss/c/fss_basic.h @@ -56,6 +56,9 @@ extern "C" { * F_number_overflow (with error bit) if the maximimum buffer size is reached. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors (with error bit) from: fl_fss_basic_content_read(). + * Errors (with error bit) from: fl_fss_basic_object_read(). */ #ifndef _di_fll_fss_basic_read_ extern f_return_status fll_fss_basic_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quoteds_t *quoted_objects); @@ -81,6 +84,10 @@ extern "C" { * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors (with error bit) from: fl_fss_basic_content_write(). + * Errors (with error bit) from: fl_fss_basic_object_write(). + * Errors (with error bit) from: fl_string_dynamic_size_increase(). */ #ifndef _di_fll_fss_basic_write_ extern f_return_status fll_fss_basic_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *buffer); diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index 59ab6b7..e01d5ff 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -157,6 +157,7 @@ extern "C" { if (contents.used > 0) { range.start = 0; range.stop = contents.array[0].used - 1; + status = fl_fss_basic_list_content_write(contents.array[0], &range, buffer); if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) { diff --git a/level_2/fll_fss/c/fss_basic_list.h b/level_2/fll_fss/c/fss_basic_list.h index 23bf659..7e600b8 100644 --- a/level_2/fll_fss/c/fss_basic_list.h +++ b/level_2/fll_fss/c/fss_basic_list.h @@ -52,6 +52,9 @@ extern "C" { * F_number_overflow (with error bit) if the maximimum buffer size is reached. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors (with error bit) from: fl_fss_basic_list_content_read(). + * Errors (with error bit) from: fl_fss_basic_list_object_read(). */ #ifndef _di_fll_fss_basic_list_read_ extern f_return_status fll_fss_basic_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents); @@ -77,6 +80,10 @@ extern "C" { * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors (with error bit) from: fl_fss_basic_list_content_write(). + * Errors (with error bit) from: fl_fss_basic_list_object_write(). + * Errors (with error bit) from: fl_string_dynamic_size_increase(). */ #ifndef _di_fll_fss_basic_list_write_ extern f_return_status fll_fss_basic_list_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *buffer); diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 6c96bff..513a8c1 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -209,6 +209,7 @@ extern "C" { if (status == F_none || status == F_none_stop || status == F_none_eos || status == F_none_eol) { while (current < contents.used) { + range.start = 0; range.stop = contents.array[current].used - 1; status = fl_fss_extended_content_write(contents.array[current], 0, &range, buffer); diff --git a/level_2/fll_fss/c/fss_extended.h b/level_2/fll_fss/c/fss_extended.h index df507ff..dfb6208 100644 --- a/level_2/fll_fss/c/fss_extended.h +++ b/level_2/fll_fss/c/fss_extended.h @@ -57,6 +57,9 @@ extern "C" { * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_number_overflow (with error bit) if the maximimum buffer size is reached. + * + * Errors (with error bit) from: fl_fss_extended_content_read(). + * Errors (with error bit) from: fl_fss_extended_object_read(). */ #ifndef _di_fll_fss_extended_read_ extern f_return_status fll_fss_extended_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_objects_t *objects, f_fss_contents_t *contents, f_fss_quoteds_t *quoted_objects, f_fss_quotedss_t *quoted_contents); @@ -82,6 +85,10 @@ extern "C" { * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors (with error bit) from: fl_fss_extended_content_write(). + * Errors (with error bit) from: fl_fss_extended_object_write(). + * Errors (with error bit) from: fl_string_dynamic_size_increase(). */ #ifndef _di_fll_fss_extended_write_ extern f_return_status fll_fss_extended_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *buffer); diff --git a/level_2/fll_fss/c/fss_extended_list.c b/level_2/fll_fss/c/fss_extended_list.c index 97499bd..8e699e8 100644 --- a/level_2/fll_fss/c/fss_extended_list.c +++ b/level_2/fll_fss/c/fss_extended_list.c @@ -37,6 +37,7 @@ extern "C" { if (range->start >= range->stop || range->start >= buffer->used) { if (status == FL_fss_found_object || status == FL_fss_found_object_content_not) { + // extended list requires content closure, so this could be an error. return FL_fss_found_object_content_not; } @@ -59,6 +60,7 @@ extern "C" { if (status == FL_fss_found_object) { found_data = F_true; + status = fl_fss_extended_list_content_read(buffer, range, nest); break; @@ -73,6 +75,7 @@ extern "C" { return status; } else if (status == F_data_not_eos || status == F_data_not_stop) { + // If at least some valid object was found, then return F_none equivalents. if (nest->depth[0].used > initial_used) { if (status == F_data_not_eos) return F_none_eos; @@ -82,6 +85,7 @@ extern "C" { return status; } else if (status == F_unterminated_eos || status == F_unterminated_stop || status == F_unterminated_nest_eos || status == F_unterminated_nest_stop) { + // If at least some valid object was found, then return F_none equivalents. if (nest->depth[0].used > initial_used) { if (status == F_data_not_eos) return F_none_eos; @@ -132,6 +136,7 @@ extern "C" { if (contents.used > 0) { range.start = 0; range.stop = contents.array[0].used - 1; + status = fl_fss_extended_list_content_write(contents.array[0], &range, buffer); if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) { diff --git a/level_2/fll_fss/c/fss_extended_list.h b/level_2/fll_fss/c/fss_extended_list.h index 7ce6167..0a14aa7 100644 --- a/level_2/fll_fss/c/fss_extended_list.h +++ b/level_2/fll_fss/c/fss_extended_list.h @@ -56,6 +56,9 @@ extern "C" { * F_unterminated_stop (with error bit) if stop location is reached before a closing bracket is found (object was found). * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. * FL_fss_found_object_content_not on success and object was found but no content was found (start location is at end of object). + * + * Errors (with error bit) from: fl_fss_extended_list_content_read(). + * Errors (with error bit) from: fl_fss_extended_list_object_read(). */ #ifndef _di_fll_fss_extended_list_read_ extern f_return_status fll_fss_extended_list_read(f_string_dynamic_t *buffer, f_string_range_t *range, f_fss_nest_t *nest); @@ -81,6 +84,10 @@ extern "C" { * F_memory_reallocation (with error bit) on reallocation error. * F_parameter (with error bit) if a parameter is invalid. * F_utf (with error bit) is returned on failure to read/process a UTF-8 character. + * + * Errors (with error bit) from: fl_fss_extended_list_content_write(). + * Errors (with error bit) from: fl_fss_extended_list_object_write(). + * Errors (with error bit) from: fl_string_dynamic_size_increase(). */ #ifndef _di_fll_fss_extended_list_write_ //extern f_return_status fll_fss_extended_list_write(const f_string_static_t object, const f_string_statics_t contents, f_string_dynamic_t *buffer); diff --git a/level_2/fll_fss/c/fss_status.c b/level_2/fll_fss/c/fss_status.c index e1ae5e4..3b08c5b 100644 --- a/level_2/fll_fss/c/fss_status.c +++ b/level_2/fll_fss/c/fss_status.c @@ -183,6 +183,7 @@ extern "C" { #ifndef _di_fll_fss_status_is_error_ f_return_status fll_fss_status_is_error(const f_status_t code) { + if (fll_fss_status_is_fine(code) == F_true) { return F_false; } @@ -196,6 +197,7 @@ extern "C" { #ifndef _di_fll_fss_status_is_warning_ f_return_status fll_fss_status_is_warning(const f_status_t code) { + switch (code) { #ifndef _di_fll_fss_status_basic_ case F_data_not: @@ -224,6 +226,7 @@ extern "C" { #ifndef _di_fll_fss_status_is_fine_ f_return_status fll_fss_status_is_fine(const f_status_t code) { + switch (code) { #ifndef _di_fll_fss_status_booleans_ case F_false: diff --git a/level_2/fll_fss/c/fss_status.h b/level_2/fll_fss/c/fss_status.h index fd3b46f..072e6f4 100644 --- a/level_2/fll_fss/c/fss_status.h +++ b/level_2/fll_fss/c/fss_status.h @@ -100,7 +100,7 @@ extern "C" { * F_data (with error bit) if not found. * F_parameter (with error bit) if a parameter is invalid. * - * @see fll_status_from_string + * Errors (with error bit) from: f_conversion_character_is_decimal(). */ #ifndef _di_fll_fss_status_from_string_ extern f_return_status fll_fss_status_from_string(const f_string_t string, f_status_t *code); diff --git a/level_2/fll_path/c/path.h b/level_2/fll_path/c/path.h index 8075515..c264675 100644 --- a/level_2/fll_path/c/path.h +++ b/level_2/fll_path/c/path.h @@ -45,6 +45,11 @@ extern "C" { * * @return * F_none on success. + * + * Errors (with error bit) from: f_path_current(). + * Errors (with error bit) from: fl_string_append(). + * Errors (with error bit) from: fl_string_append_assure(). + * Errors (with error bit) from: fl_string_dynamic_terminate_after(). */ #ifndef _di_fll_path_canonical_ extern f_return_status fll_path_canonical(const f_string_t path, f_string_dynamic_t *canonical); diff --git a/level_2/fll_program/c/program.c b/level_2/fll_program/c/program.c index 6b910dd..f0b6d24 100644 --- a/level_2/fll_program/c/program.c +++ b/level_2/fll_program/c/program.c @@ -60,6 +60,7 @@ extern "C" { #ifndef _di_fll_program_print_help_option_other_ f_return_status fll_program_print_help_option_other(const f_color_context_t context, const f_string_t option_other, const f_string_t description) { + printf("%c ", f_string_eol[0]); fl_color_print(f_type_output, context.set.standout, option_other); @@ -259,6 +260,7 @@ extern "C" { const f_string_length_t start = destination->used; for (f_string_length_t i = 0; i < additional.used; i++) { + length = strnlen(argv[additional.array[i]], f_console_length_size); if (length > 0) { @@ -302,6 +304,7 @@ extern "C" { const f_string_length_t start = destination->used; for (f_string_length_t i = 0; i < additional.used; i++) { + length = strnlen(argv[additional.array[i]], f_console_length_size); if (length > 0) { @@ -330,6 +333,7 @@ extern "C" { const f_string_length_t start = destination->used; for (f_string_length_t i = 0; i < additional.used; i++) { + length = strnlen(argv[additional.array[i]], f_console_length_size); if (length > 0) { @@ -376,6 +380,7 @@ extern "C" { f_string_dynamic_t ripped = f_string_dynamic_t_initialize; for (f_string_length_t i = 0; i < additional.used; i++) { + length = strnlen(argv[additional.array[i]], f_console_length_size); if (length > 0) { diff --git a/level_2/fll_status/c/status.h b/level_2/fll_status/c/status.h index b58104e..cc1fdf6 100644 --- a/level_2/fll_status/c/status.h +++ b/level_2/fll_status/c/status.h @@ -43,6 +43,8 @@ extern "C" { * F_data_not if string is empty. * F_data (with error bit) if not found. * F_parameter (with error bit) if a parameter is invalid. + * + * Errors (with error bit) from: f_conversion_character_is_decimal(). */ #ifndef _di_fll_status_from_string_ extern f_return_status fll_status_from_string(const f_string_t string, f_status_t *code); diff --git a/level_3/byte_dump/c/byte_dump.c b/level_3/byte_dump/c/byte_dump.c index 44a0987..0797cb3 100644 --- a/level_3/byte_dump/c/byte_dump.c +++ b/level_3/byte_dump/c/byte_dump.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_byte_dump_print_help_ f_return_status byte_dump_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, byte_dump_name_long, byte_dump_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -176,6 +177,7 @@ extern "C" { f_number_unsigned_t number = 0; status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); + if (F_status_is_error(status) || number < 1 || number >= 0xfb) { fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '"); fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_width); @@ -207,6 +209,7 @@ extern "C" { f_number_unsigned_t number = 0; status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); + if (F_status_is_error(status) || number > f_number_t_size_unsigned) { fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '"); fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_first); @@ -238,6 +241,7 @@ extern "C" { f_number_unsigned_t number = 0; status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); + if (F_status_is_error(status) || number < 0 || number > f_number_t_size_unsigned) { fl_color_print(f_type_error, data->context.set.error, "ERROR: The parameter '"); fl_color_print(f_type_error, data->context.set.notable, "%s%s", f_console_symbol_long_enable, byte_dump_long_last); @@ -310,7 +314,9 @@ extern "C" { f_status_t missing_files = F_none; for (f_array_length_t counter = 0; counter < data->remaining.used; counter++) { + status = f_file_exists(arguments.argv[data->remaining.array[counter]]); + if (status == F_false || F_status_is_error(status)) { if (missing_files == F_none) { missing_files = status; @@ -332,6 +338,7 @@ extern "C" { f_file_t file = f_file_t_initialize; status = f_file_open(arguments.argv[data->remaining.array[counter]], 0, &file); + if (F_status_is_error(status)) { byte_dump_print_file_error(data->context, "f_file_open", arguments.argv[data->remaining.array[counter]], F_status_set_fine(status)); byte_dump_delete_data(data); diff --git a/level_3/byte_dump/c/private-byte_dump.c b/level_3/byte_dump/c/private-byte_dump.c index cba1cc4..0de3a73 100644 --- a/level_3/byte_dump/c/private-byte_dump.c +++ b/level_3/byte_dump/c/private-byte_dump.c @@ -45,6 +45,7 @@ extern "C" { memset(&invalid, 0, sizeof(uint8_t) * data.width); while ((size = read(file.id, &byte, 1)) > 0) { + // Storing the next character is designated by width_utf == -1. if (width_utf == -1) { width_utf = f_macro_utf_byte_width_is(byte); @@ -96,6 +97,7 @@ extern "C" { // UTF-8 character fragments must have a width of 1 (and ASCII characters can only be the first character in a sequence). if (width_current == 1) { + // Grab the next UTF-8 character fragment if the entire sequence is not collected yet. if (width_count < width_utf) continue; } @@ -436,7 +438,6 @@ extern "C" { fl_color_print(f_type_output, data.context.set.notable, " %s ", byte_dump_character_wall); - if (*offset > 0) { if (data.parameters[byte_dump_parameter_classic].result == f_console_result_found) { while (*offset > 0 && j < data.width) { @@ -471,6 +472,7 @@ extern "C" { if (previous->bytes > 0) { if (data.parameters[byte_dump_parameter_placeholder].result == f_console_result_found) { for (; j < previous->bytes && j < data.width; j++) { + if (previous->invalid) { fl_color_print(f_type_output, data.context.set.error, "%s", byte_dump_character_placeholder); } @@ -499,6 +501,7 @@ extern "C" { } for (uint8_t i = 0; i < characters.used && j < data.width; i++, j++) { + output = f_macro_utf_character_t_to_char_1(characters.string[i]); width_utf = f_macro_utf_byte_width_is(output); @@ -825,6 +828,7 @@ extern "C" { #ifndef _di_byte_dump_print_file_error_ void byte_dump_print_file_error(const f_color_context_t context, const f_string_t function, const f_string_t file_name, const f_status_t status) { + if (status == F_false) { fl_color_print(f_type_error, context.set.error, "ERROR: Failed to find file '"); fl_color_print(f_type_error, context.set.notable, "%s", file_name); diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 37804a4..7e2d60f 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -12,6 +12,7 @@ extern "C" { #ifndef _di_fake_print_help_ f_return_status fake_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fake_name_long, fake_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -167,12 +168,15 @@ extern "C" { f_string_length_t k = 0; for (; i < data->parameters[fake_parameter_operation_build].locations.used; i++, locations_length++) { + operations[locations_length] = fake_operation_build; locations[locations_length] = data->parameters[fake_parameter_operation_build].locations.array[i]; } // for for (i = 0; i < data->parameters[fake_parameter_operation_clean].locations.used; i++) { + for (j = 0; j < locations_length; j++) { + if (data->parameters[fake_parameter_operation_clean].locations.array[i] < locations[j]) { for (k = locations_length; k > j; k--) { locations[k] = locations[k - 1]; @@ -189,7 +193,9 @@ extern "C" { } // for for (i = 0; i < data->parameters[fake_parameter_operation_make].locations.used; i++) { + for (j = 0; j < locations_length; j++) { + if (data->parameters[fake_parameter_operation_make].locations.array[i] < locations[j]) { for (k = locations_length; k > j; k--) { locations[k] = locations[k - 1]; @@ -206,7 +212,9 @@ extern "C" { } // for for (i = 0; i < data->parameters[fake_parameter_operation_skeleton].locations.used; i++) { + for (j = 0; j < locations_length; j++) { + if (data->parameters[fake_parameter_operation_skeleton].locations.array[i] < locations[j]) { for (k = locations_length; k > j; k--) { locations[k] = locations[k - 1]; diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index 39cd976..cd380bd 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -173,6 +173,7 @@ extern "C" { } f_macro_string_dynamic_t_new(*status, path_source, source.used); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "f_macro_string_dynamic_t_new", F_true); @@ -197,12 +198,14 @@ extern "C" { path_source.used = source.used; *status = fl_string_dynamic_append_nulless(files.array[i], &path_source); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = fl_string_dynamic_terminate_after(&path_source); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; @@ -245,12 +248,14 @@ extern "C" { destination_file.used = 0; *status = fl_string_dynamic_append_nulless(destination, &destination_file); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = f_file_name_base(path_source.string, path_source.used, &destination_file); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "f_file_name_base", F_true); break; @@ -435,6 +440,7 @@ extern "C" { if (data.define.used) { for (f_array_length_t i = 0; i < data.define.used; i++) { + *status = fl_string_dynamic_mash(" ", 1, data.define.array[i], &defines); if (F_status_is_error(*status)) { @@ -451,6 +457,7 @@ extern "C" { } *status = fl_string_dynamic_terminate_after(&defines); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); @@ -612,6 +619,7 @@ extern "C" { if (path.used == 0) return F_none; f_status_t status = f_file_name_base(path.string, path.used, name); + if (F_status_is_error(status)) { fake_print_error(data, F_status_set_fine(status), "f_file_name_base", F_true); return status; @@ -627,6 +635,7 @@ extern "C" { } // for status = fl_string_dynamic_terminate_after(name); + if (F_status_is_error(status)) { fake_print_error(data, F_status_set_fine(status), "fl_string_dynamic_terminate_after", F_true); return status; @@ -675,6 +684,7 @@ extern "C" { f_string_length_t source_length = 0; for (f_array_length_t i = 0; i < data_build.setting.build_sources_library.used; i++) { + source_length = path_sources->used + data_build.setting.build_sources_library.array[i].used; char source[source_length + 1]; @@ -1001,6 +1011,7 @@ extern "C" { source_path.used = 0; *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); break; @@ -1020,18 +1031,21 @@ extern "C" { if (source_path.used) { *status = fl_string_dynamic_prepend(data.path_build_objects, &source_path); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); break; } *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &source_path); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(&source_path); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; @@ -1315,6 +1329,7 @@ extern "C" { }; for (uint8_t i = 0; i < 1; i++) { + if (settings[i]->used == 0) { fprintf(f_type_error, "%c", f_string_eol[0]); fl_color_print(f_type_error, data.context.set.error, "ERROR: The setting '"); @@ -1537,6 +1552,7 @@ extern "C" { found = F_false; for (j = 0; j < setting->modes.used; j++) { + if (fl_string_dynamic_compare_trim(modes->array[i], setting->modes.array[j]) == F_equal_to) { found = F_true; break; @@ -1563,9 +1579,11 @@ extern "C" { memset(&setting_mode_lengths, 0, sizeof(f_string_length_t) * fake_build_setting_total); for (j = 0; j < fake_build_setting_total; j++) { + setting_mode_lengths[j] = settings_length[j] + 1 + modes->array[i].used; f_macro_string_dynamic_t_new(*status, settings_mode_name_dynamic[j], setting_mode_lengths[j]); + if (F_status_is_error(*status)) { function = "f_macro_string_dynamic_t_new"; break; @@ -2176,6 +2194,7 @@ extern "C" { for (uint8_t i = 0; i < fake_build_stage_total; i++) { *status = fl_string_dynamic_append_nulless(data.path_build_stage, values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; @@ -2183,12 +2202,14 @@ extern "C" { if (data.process.used) { *status = fl_string_append(data.process.string, data.process.used, values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); break; } *status = fl_string_append(fake_build_stage_separate, fake_build_stage_separate_length, values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); break; @@ -2196,30 +2217,35 @@ extern "C" { } *status = fl_string_append_nulless(names[i], lengths[i], values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append_nulless", F_true); break; } *status = fl_string_append(fake_build_stage_separate, fake_build_stage_separate_length, values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); break; } *status = fl_string_dynamic_append(settings_file_base, values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_append", F_true); break; } *status = fl_string_append(fake_build_stage_built, fake_build_stage_built_length, values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_append", F_true); break; } *status = fl_string_dynamic_terminate_after(values[i]); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; @@ -2272,6 +2298,7 @@ extern "C" { source[source_length] = 0; *status = fake_build_get_file_name_without_extension(data, data_build.setting.build_sources_library.array[i], &file_name); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fake_build_get_file_name_without_extension", F_true); break; @@ -2283,6 +2310,7 @@ extern "C" { } *status = f_file_name_directory(data_build.setting.build_sources_library.array[i].string, data_build.setting.build_sources_library.array[i].used, &destination_path); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "f_file_name_directory", F_true); break; @@ -2290,18 +2318,21 @@ extern "C" { if (destination_path.used) { *status = fl_string_dynamic_prepend(data.path_build_objects, &destination_path); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_prepend", F_true); break; } *status = fl_string_append_assure(f_path_separator, f_path_separator_length, &destination_path); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_append_assure", F_true); break; } *status = fl_string_dynamic_terminate_after(&destination_path); + if (F_status_is_error(*status)) { fake_print_error(data, F_status_set_fine(*status), "fl_string_dynamic_terminate_after", F_true); break; @@ -2389,6 +2420,7 @@ extern "C" { }; for (uint8_t j = 0; j < 5; j++) { + *status = fll_execute_arguments_add(values[j], lengths[j], &arguments); if (F_status_is_error(*status)) break; } // for diff --git a/level_3/fake/c/private-fake.c b/level_3/fake/c/private-fake.c index fe2e631..fcc7c2f 100644 --- a/level_3/fake/c/private-fake.c +++ b/level_3/fake/c/private-fake.c @@ -100,6 +100,7 @@ extern "C" { } f_macro_string_dynamic_t_new((status), (*buffer), size_file); + if (F_status_is_error(status)) { fake_print_error_file(data, F_status_set_fine(status), name_function, path_file, "allocate buffer size for", F_true, F_true); @@ -616,6 +617,7 @@ extern "C" { }; for (uint8_t i = 0; i < 3; i++) { + if (data->parameters[parameters_id[i]].result == f_console_result_found) { fake_print_error_parameter_missing_value(*data, parameters_name[i]); return F_status_set_error(F_parameter); @@ -752,6 +754,7 @@ extern "C" { }; for (uint8_t i = 0; i < 4; i++) { + if (data->parameters[parameters_id[i]].result == f_console_result_found) { fake_print_error_parameter_missing_value(*data, parameters_name[i]); return F_status_set_error(F_parameter); @@ -814,7 +817,9 @@ extern "C" { f_string_length_t width_max = 0; for (; i < data->define.used; i++) { + for (j = 0; j < data->define.array[i].used; j++) { + width_max = data->define.array[i].used - j; status = f_utf_is_word(data->define.array[i].string + j, width_max, F_false); @@ -869,7 +874,9 @@ extern "C" { f_string_length_t width_max = 0; for (; i < data->mode.used; i++) { + for (j = 0; j < data->mode.array[i].used; j++) { + width_max = data->mode.array[i].used - j; status = f_utf_is_word_dash_plus(data->mode.array[i].string + j, width_max, F_false); diff --git a/level_3/fake/c/private-make.c b/level_3/fake/c/private-make.c index ecbbe4b..f6f692b 100644 --- a/level_3/fake/c/private-make.c +++ b/level_3/fake/c/private-make.c @@ -659,6 +659,7 @@ extern "C" { f_string_dynamic_t combined = f_string_dynamic_t_initialize; for (f_array_length_t i = 0; i < define.used; i++) { + status_validate = fake_make_operate_validate_define_name(define.array[i].name); if (status_validate) { @@ -864,6 +865,7 @@ extern "C" { f_array_length_t j = 0; for (; i < 2; i ++) { + for (j = 0; j < source[i]->used; j++) { if (destination[i]->used >= destination[i]->size) { @@ -1218,6 +1220,7 @@ extern "C" { used_arguments = arguments->used; *status = fl_iki_read(&data_make->buffer, &range, &iki_variable, &iki_vocabulary, &iki_content); + if (F_status_is_error(*status)) { fake_print_message(data, F_status_set_fine(*status), "fl_iki_read", F_true, data_make->print); break; @@ -1225,6 +1228,7 @@ extern "C" { if (arguments->used >= arguments->size) { *status = fl_string_dynamics_size_increase(f_memory_default_allocation_step, arguments); + if (F_status_is_error(*status)) { fake_print_message(data, F_status_set_fine(*status), "fl_string_lengths_size_increase", F_true, data_make->print); return; @@ -1237,6 +1241,7 @@ extern "C" { range.stop = iki_variable.array[0].start - 1; *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, range, &arguments->array[arguments->used]); + if (F_status_is_error(*status)) { fake_print_message(data, F_status_set_fine(*status), "fl_string_dynamic_partial_append_nulless", F_true, data_make->print); break; @@ -1420,6 +1425,7 @@ extern "C" { if (unmatched) { *status = fake_make_operate_expand_build(data, quoteds.array[i], iki_content.array[j], data_make, arguments); + if (F_status_is_error(*status)) { fake_print_message(data, F_status_set_fine(*status), "fake_make_operate_expand_build", F_true, data_make->print); break; @@ -1428,6 +1434,7 @@ extern "C" { } else if (define_is && data_make->setting_make.load_build) { *status = fake_make_operate_expand_environment(data, quoteds.array[i], iki_content.array[j], data_make, arguments); + if (F_status_is_error(*status)) { fake_print_message(data, F_status_set_fine(*status), "fake_make_operate_expand_environment", F_true, data_make->print); break; @@ -1467,6 +1474,7 @@ extern "C" { } else { *status = fl_string_dynamic_partial_append_nulless(data_make->buffer, content.array[i], &arguments->array[arguments->used]); + if (F_status_is_error(*status)) { fake_print_message(data, F_status_set_fine(*status), "fl_string_append_nulless", F_true, data_make->print); break; @@ -1476,6 +1484,7 @@ extern "C" { // if iki variable did not match (results in empty string) or iki variable is inside quotes, then increment. if (used_arguments == arguments->used) { *status = fl_string_dynamic_terminate_after(&arguments->array[arguments->used]); + if (F_status_is_error(*status)) { fake_print_message(data, F_status_set_fine(*status), "fl_string_terminate_after", F_true, data_make->print); break; @@ -2003,6 +2012,7 @@ extern "C" { } for (j = 0; j < fake_make_operation_total; j++) { + if (fl_string_dynamic_partial_compare(operations_name[j], data_make->buffer, operations_range[j], section->objects.array[i]) == F_equal_to) { operation = operations_type[j]; operation_name = &operations_name[j]; @@ -2654,6 +2664,7 @@ extern "C" { f_status_t status_file = F_none; for (f_array_length_t i = 1; i < arguments.used; i++) { + status_file = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(status_file)) { @@ -2745,12 +2756,14 @@ extern "C" { uint8_t mode_replace = 0; *status = fake_make_get_id_mode(data, data_make->print, arguments.array[2], &mode_rule, &mode_replace); + if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; return; } *status = f_file_mode_to_mode(mode_rule, &mode_match); + if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; fake_print_message(data, F_status_set_fine(*status), "f_file_mode_to_mode", F_true, data_make->print); @@ -2765,6 +2778,7 @@ extern "C" { for (f_array_length_t i = 3; i < arguments.used; i++, mode_file = 0) { *status = f_file_mode_read(arguments.array[i].string, &mode_file); + if (F_status_is_error(*status)) { *operation_if = fake_make_operation_if_type_false_always_next; fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "get mode of", F_true, F_true, data_make->print); @@ -2989,6 +3003,7 @@ extern "C" { f_array_length_t j = 0; for (; i < arguments.used; i++) { + for (j = i + 1; j < arguments.used; j++) { if (fl_string_dynamic_compare(arguments.array[i], arguments.array[j]) == F_equal_to) { @@ -3177,18 +3192,21 @@ extern "C" { mode = 0; *status = f_file_mode_read(arguments.array[i].string, &mode_file); + if (F_status_is_error(*status)) { fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); break; } *status = f_file_mode_determine(mode_file, mode_rule, replace, f_macro_file_type_is_directory(mode_file), &mode); + if (F_status_is_error(*status)) { fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_determine", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); break; } *status = f_file_mode_set(arguments.array[i].string, mode); + if (F_status_is_error(*status)) { fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_set", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); break; @@ -3216,18 +3234,21 @@ extern "C" { mode = 0; *status = f_file_mode_read(arguments.array[i].string, &mode_file); + if (F_status_is_error(*status)) { fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_read", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); break; } *status = f_file_mode_determine(mode_file, mode_rule, replace, f_macro_file_type_is_directory(mode_file), &mode); + if (F_status_is_error(*status)) { fake_print_message_file(data, F_status_set_fine(*status), "f_file_mode_determine", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); break; } *status = fll_file_mode_set_all(arguments.array[i].string, mode, fake_make_operation_recursion_depth_max); + if (F_status_is_error(*status)) { fake_print_message_file(data, F_status_set_fine(*status), "fll_file_mode_set_all", arguments.array[i].string, "change mode of", F_true, F_true, data_make->print); break; @@ -3335,6 +3356,7 @@ extern "C" { f_status_t status_file = F_none; for (f_array_length_t i = 1; i < arguments.used; i++) { + status_file = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(status_file)) { @@ -3370,6 +3392,7 @@ extern "C" { f_status_t status_file = F_none; for (f_array_length_t i = 1; i < arguments.used; i++) { + status_file = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(status_file)) { @@ -3401,6 +3424,7 @@ extern "C" { data_make->path.stack.used--; *status = f_path_change(data_make->path.stack.array[data_make->path.stack.used - 1].string); + if (F_status_is_error(*status)) { fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", data_make->path.stack.array[data_make->path.stack.used - 1].string, data_make->print); return; @@ -3527,6 +3551,7 @@ extern "C" { if (operation == fake_make_operation_type_top) { *status = f_path_change_at(data_make->path.top); + if (F_status_is_error(*status)) { fake_print_message_section_operation_path_stack_max(data, F_status_set_fine(*status), "f_path_change", arguments.array[0].string, data_make->print); return; @@ -3630,6 +3655,7 @@ extern "C" { } status = f_environment_get(data_make->setting_build.environment.array[i].string, &data_make->environment.values.array[data_make->environment.values.used]); + if (F_status_is_error(status)) { fake_print_message(data, F_status_set_fine(status), "f_environment_get", F_true, data_make->print); return status; @@ -3638,6 +3664,7 @@ extern "C" { if (status == F_exist_not) continue; fl_string_dynamic_append(data_make->setting_build.environment.array[i], &data_make->environment.names.array[data_make->environment.names.used]); + if (F_status_is_error(status)) { fake_print_message(data, F_status_set_fine(status), "f_environment_get", F_true, data_make->print); return status; @@ -3721,6 +3748,7 @@ extern "C" { f_string_dynamic_t number = f_string_dynamic_t_initialize; status2 = f_conversion_number_signed_to_string(WEXITSTATUS(return_code), 10, &number); + if (F_status_is_error(status2)) { *status = status2; @@ -3960,6 +3988,7 @@ extern "C" { if (operation == fake_make_operation_type_clone) { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; i++) { + *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { @@ -3972,6 +4001,7 @@ extern "C" { } // for for (f_array_length_t i = 0; i < arguments.used - 1; i++) { + if (f_file_exists(arguments.array[i].string) != F_true) { if (data.verbosity != fake_verbosity_quiet && data_make->print.to) { printf("%c", f_string_eol[0]); @@ -4061,6 +4091,7 @@ extern "C" { if (operation == fake_make_operation_type_copy) { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; i++) { + *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { @@ -4073,6 +4104,7 @@ extern "C" { } // for for (f_array_length_t i = 0; i < arguments.used - 1; i++) { + if (f_file_exists(arguments.array[i].string) != F_true) { if (data.verbosity != fake_verbosity_quiet && data_make->print.to) { printf("%c", f_string_eol[0]); @@ -4139,6 +4171,7 @@ extern "C" { if (operation == fake_make_operation_type_delete || operation == fake_make_operation_type_deletes) { if (arguments.used) { for (f_array_length_t i = 0; i < arguments.used; i++) { + *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { @@ -4439,6 +4472,7 @@ extern "C" { f_string_length_t i = 0; for (; i < 14; i++) { + if (fl_string_dynamic_compare_string(if_type_strings[i], arguments.array[0], if_type_lengths[i]) == F_equal_to) { *operation_if = if_type_codes[i]; break; @@ -4526,6 +4560,7 @@ extern "C" { uint8_t type_file = 0; for (i = 1; i < arguments.used; i++) { + if (fl_string_dynamic_compare_string(fake_make_operation_argument_if_is_for, arguments.array[i], fake_make_operation_argument_if_is_for_length) == F_equal_to) { i++; break; @@ -4578,6 +4613,7 @@ extern "C" { if (i < arguments.used) { for (f_status_t status_file = F_none; i < arguments.used; i++) { + status_file = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(status_file)) { @@ -4668,6 +4704,7 @@ extern "C" { // @fixme there needs to handle converting numbers with decimals (like 1.01), perhaps operate on them as strings or provide a special processor. for (i = 1; i < arguments.used; i++, status_number = F_none) { + if (arguments.array[i].used) { range.start = 0; range.stop = arguments.array[i].used - 1; @@ -4772,6 +4809,7 @@ extern "C" { if (operation == fake_make_operation_type_move) { if (arguments.used > 1) { for (f_array_length_t i = 0; i < arguments.used; i++) { + *status = fake_make_assure_inside_project(data, arguments.array[i], data_make); if (F_status_is_error(*status)) { @@ -4784,6 +4822,7 @@ extern "C" { } // for for (f_array_length_t i = 0; i < arguments.used - 1; i++) { + if (f_file_exists(arguments.array[i].string) != F_true) { if (data.verbosity != fake_verbosity_quiet && data_make->print.to) { printf("%c", f_string_eol[0]); @@ -4860,6 +4899,7 @@ extern "C" { f_array_length_t id_section = 0; for (; id_section < data_make->fakefile.used; id_section++) { + if (fl_string_dynamic_partial_compare_string(arguments.array[0].string, data_make->buffer, arguments.array[0].used, data_make->fakefile.array[id_section].name) == F_equal_to) { break; } @@ -4873,6 +4913,7 @@ extern "C" { } else { for (f_array_length_t i = 0; i < section_stack->used; i++) { + if (section_stack->array[i] == id_section) { printf("%c", f_string_eol[0]); fl_color_print(data_make->print.to, data_make->print.context, "%s: The section operation '", data_make->print.prefix); @@ -5014,6 +5055,7 @@ extern "C" { } for (f_string_length_t i = 0; i < name.used; i++) { + if (!(isalnum(name.string[i]) || name.string[i] == '_')) { return F_false; } diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index 1cb8d1d..194c1ef 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -163,6 +163,7 @@ extern "C" { if (path.used == 0) return F_none; status = f_directory_exists(path.string); + if (status == F_true) { if (data.verbosity == fake_verbosity_verbose) { printf("Directory '%s' already exists.%c", path.string, f_string_eol[0]); @@ -218,6 +219,7 @@ extern "C" { if (path.used == 0) return F_none; status = f_file_is(path.string, f_file_type_regular, F_false); + if (status == F_true) { if (data.verbosity == fake_verbosity_verbose) { printf("File '%s' already exists.%c", path.string, f_string_eol[0]); @@ -280,6 +282,7 @@ extern "C" { file.size_write = content.used; status = f_file_open(path.string, 0, &file); + if (F_status_is_error(status)) { fake_print_error_file(data, F_status_set_fine(status), "f_file_open", path.string, "pre-populate", F_true, F_true); @@ -287,6 +290,7 @@ extern "C" { } status = f_file_write(file, content, 0); + if (F_status_is_error(status)) { fake_print_error_file(data, F_status_set_fine(status), "f_file_write", path.string, "pre-populate", F_true, F_true); diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 8fc4110..8030ae9 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -13,6 +13,7 @@ extern "C" { #ifndef _di_firewall_print_help_ f_return_status firewall_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, firewall_name_long, firewall_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -159,6 +160,7 @@ extern "C" { f_string_length_t counter = 0; for (; counter < data->remaining.used; counter++) { + if (strncmp("nat", arguments.argv[data->remaining.array[counter]], 4) != 0) { if (strncmp("mangle", arguments.argv[data->remaining.array[counter]], 7) != 0) { if (strncmp("ports", arguments.argv[data->remaining.array[counter]], 6) != 0) { @@ -499,6 +501,7 @@ extern "C" { local.is_lock = F_false; while (i < local.chain_contents.used) { + input.start = local.chain_contents.array[i].array[0].start; input.stop = local.chain_contents.array[i].array[0].stop; @@ -574,6 +577,7 @@ extern "C" { local.is_lock = F_false; for (; j < local.chain_contents.used; j++) { + input.start = local.chain_contents.array[j].array[0].start; input.stop = local.chain_contents.array[j].array[0].stop; @@ -617,6 +621,7 @@ extern "C" { local.is_lock = F_false; while (i < local.chain_contents.used) { + input.start = local.chain_contents.array[i].array[0].start; input.stop = local.chain_contents.array[i].array[0].stop; diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index 4b1073b..c2d271b 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -317,6 +317,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con } for (r = repeat; r > 0; r--) { + // first add the program name f_macro_string_dynamics_t_delete_simple(arguments); f_macro_string_dynamics_new(status, arguments, firewall_default_allocation_step); @@ -530,6 +531,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con } for (; subcounter < local.rule_contents.array[i].used; subcounter++) { + length = firewall_macro_structure_size(local.rule_contents.array[i], subcounter); if (length > 0) { @@ -713,6 +715,7 @@ f_return_status firewall_perform_commands(const firewall_local_data_t local, con // the ip_list file contains objects and no content, all objects are what matter an nothing else for (; buffer_counter < basic_objects.used; buffer_counter++) { + ip_length = firewall_macro_structure_size(basic_objects, buffer_counter); f_macro_string_dynamic_t_new(status, ip_argument, ip_length); @@ -1009,6 +1012,7 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains_t *reserv // copy the string character by character, ignoring placeholders. while (j <= local->chain_objects.array[i].stop) { + if (local->buffer.string[j] == f_fss_delimit_placeholder) { j++; continue; diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index f3d6f9b..b513f54 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_fss_basic_list_read_print_help_ f_return_status fss_basic_list_read_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_basic_list_read_name_long, fss_basic_list_read_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); diff --git a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c index 2daaa6a..7028c64 100644 --- a/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/private-fss_basic_list_read.c @@ -131,6 +131,7 @@ extern "C" { if (data.parameters[fss_basic_list_read_parameter_at].result == f_console_result_additional) { for (; position_at < data.parameters[fss_basic_list_read_parameter_at].additional.used; position_at++) { + if (data.parameters[fss_basic_list_read_parameter_at].additional.array[position_at] < position_depth) { continue; } @@ -153,6 +154,7 @@ extern "C" { if (data.parameters[fss_basic_list_read_parameter_name].result == f_console_result_additional) { for (; position_name < data.parameters[fss_basic_list_read_parameter_name].additional.used; position_name++) { + if (data.parameters[fss_basic_list_read_parameter_name].additional.array[position_name] < position_depth) { continue; } @@ -211,7 +213,9 @@ extern "C" { } // for for (f_array_length_t i = 0; i < depths->used; i++) { + for (f_array_length_t j = i + 1; j < depths->used; j++) { + if (depths->array[i].depth == depths->array[j].depth) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '"); fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth); @@ -303,6 +307,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); + if (F_status_is_error(status)) { fss_basic_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; @@ -321,6 +326,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range); + if (F_status_is_error(status)) { fss_basic_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_list_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; @@ -336,6 +342,7 @@ extern "C" { if (data->parameters[fss_basic_list_read_parameter_trim].result == f_console_result_found) { for (f_string_length_t i = 0; i < data->objects.used; i++) { + name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1; if (name_length == depths.array[0].value_name.used) { @@ -406,6 +413,7 @@ extern "C" { f_array_length_t i = 0; for (; i < data->objects.used; i++) { + if (names[i]) { if (at == depths.array[0].value_at) { print_object(f_type_output, data->buffer, data->objects.array[i]); @@ -500,6 +508,7 @@ extern "C" { for (; i <= data->contents.array[i].array[0].stop; i++) { if (data->buffer.string[i] == 0) continue; + if (data->buffer.string[i] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); break; @@ -568,9 +577,7 @@ extern "C" { f_string_length_t j = 0; for (; i < data->contents.used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (data->contents.array[i].used == 0) { if (include_empty) { @@ -589,6 +596,7 @@ extern "C" { if (line_current != line) { for (; j <= data->contents.array[i].array[0].stop; j++) { + if (data->buffer.string[j] == f_string_eol[0]) { line_current++; @@ -622,9 +630,7 @@ extern "C" { } for (f_string_length_t i = 0; i < data->contents.used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (data->contents.array[i].used == 0) { if (include_empty) { diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index 799f049..4811088 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -6,6 +6,7 @@ extern "C" { #ifndef _di_fss_basic_list_write_print_help_ f_return_status fss_basic_list_write_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_basic_list_write_name_long, fss_basic_list_write_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 29fea78..6ef5401 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_fss_basic_read_print_help_ f_return_status fss_basic_read_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_basic_read_name_long, fss_basic_read_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -282,6 +283,7 @@ extern "C" { } status = fss_basic_read_main_process_file(arguments, data, "-", depths); + if (F_status_is_error(status)) { macro_fss_basic_read_depths_t_delete_simple(depths); fss_basic_read_delete_data(data); @@ -343,6 +345,7 @@ extern "C" { } status = fss_basic_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths); + if (F_status_is_error(status)) { macro_fss_basic_read_depths_t_delete_simple(depths); fss_basic_read_delete_data(data); diff --git a/level_3/fss_basic_read/c/private-fss_basic_read.c b/level_3/fss_basic_read/c/private-fss_basic_read.c index 090a104..11c6aec 100644 --- a/level_3/fss_basic_read/c/private-fss_basic_read.c +++ b/level_3/fss_basic_read/c/private-fss_basic_read.c @@ -94,6 +94,7 @@ extern "C" { } macro_fss_basic_read_depths_t_new(status, (*depths), depth_size); + if (F_status_is_error(status)) { fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); return status; @@ -123,6 +124,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth])); status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range); + if (F_status_is_error(status)) { fss_basic_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); return status; @@ -131,6 +133,7 @@ extern "C" { if (data.parameters[fss_basic_read_parameter_at].result == f_console_result_additional) { for (; position_at < data.parameters[fss_basic_read_parameter_at].additional.used; position_at++) { + if (data.parameters[fss_basic_read_parameter_at].additional.array[position_at] < position_depth) { continue; } @@ -144,6 +147,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at])); status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range); + if (F_status_is_error(status)) { fss_basic_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); return status; @@ -153,6 +157,7 @@ extern "C" { if (data.parameters[fss_basic_read_parameter_name].result == f_console_result_additional) { for (; position_name < data.parameters[fss_basic_read_parameter_name].additional.used; position_name++) { + if (data.parameters[fss_basic_read_parameter_name].additional.array[position_name] < position_depth) { continue; } @@ -211,7 +216,9 @@ extern "C" { } // for for (f_array_length_t i = 0; i < depths->used; i++) { + for (f_array_length_t j = i + 1; j < depths->used; j++) { + if (depths->array[i].depth == depths->array[j].depth) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '"); fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth); @@ -287,6 +294,7 @@ extern "C" { return F_status_set_error(status); } else if (status == F_data_not_stop || status == F_data_not_eos) { + // Clear buffers, then attempt the next file. f_macro_fss_contents_t_delete_simple(data->contents); f_macro_fss_objects_t_delete_simple(data->objects); @@ -303,6 +311,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); + if (F_status_is_error(status)) { fss_basic_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; @@ -321,6 +330,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range); + if (F_status_is_error(status)) { fss_basic_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_basic_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; @@ -336,6 +346,7 @@ extern "C" { if (data->parameters[fss_basic_read_parameter_trim].result == f_console_result_found) { for (f_string_length_t i = 0; i < data->objects.used; i++) { + name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1; if (name_length == depths.array[0].value_name.used) { @@ -347,6 +358,7 @@ extern "C" { } else { for (f_string_length_t i = 0; i < data->objects.used; i++) { + name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1; if (name_length == depths.array[0].value_name.used) { @@ -406,6 +418,7 @@ extern "C" { f_array_length_t i = 0; for (; i < data->objects.used; i++) { + if (names[i]) { if (at == depths.array[0].value_at) { print_object(f_type_output, data->buffer, data->objects.array[i]); @@ -449,6 +462,7 @@ extern "C" { f_array_length_t i = 0; for (; i < data->objects.used; i++) { + if (names[i]) { if (at == depths.array[0].value_at) { if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) { @@ -492,9 +506,7 @@ extern "C" { f_string_length_t total = 0; for (f_string_length_t i = 0; i < data->objects.used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (data->contents.array[i].used == 0 && !include_empty) { continue; @@ -511,9 +523,7 @@ extern "C" { f_string_length_t line_current = 0; for (f_string_length_t i = 0; i < data->contents.used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (data->contents.array[i].used == 0) { if (include_empty) { @@ -542,9 +552,7 @@ extern "C" { } for (f_string_length_t i = 0; i < data->contents.used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (data->contents.array[i].used == 0) { if (include_empty) { diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index 76e1a3a..787cd77 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -6,6 +6,7 @@ extern "C" { #ifndef _di_fss_basic_write_print_help_ f_return_status fss_basic_write_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_basic_write_name_long, fss_basic_write_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -37,6 +38,7 @@ extern "C" { const f_console_parameters_t parameters = { data->parameters, fss_basic_write_total_parameters }; status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + if (F_status_is_error(status)) { fss_basic_write_delete_data(data); return status; diff --git a/level_3/fss_extended_list_read/c/fss_extended_list_read.c b/level_3/fss_extended_list_read/c/fss_extended_list_read.c index e377071..762d738 100644 --- a/level_3/fss_extended_list_read/c/fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/fss_extended_list_read.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_fss_extended_list_read_print_help_ f_return_status fss_extended_list_read_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_extended_list_read_name_long, fss_extended_list_read_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -235,6 +236,7 @@ extern "C" { f_string_length_t original_size = data->quantity.total; status = fss_extended_list_read_main_preprocess_depth(arguments, *data, &depths); + if (F_status_is_error(status)) { macro_fss_extended_list_read_depths_t_delete_simple(depths); fss_extended_list_read_delete_data(data); @@ -257,6 +259,7 @@ extern "C" { file.id = f_type_descriptor_input; status = f_file_read(file, &data->buffer); + if (F_status_is_error(status)) { fss_extended_list_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status)); @@ -266,6 +269,7 @@ extern "C" { } status = fss_extended_list_read_main_process_file(arguments, data, "-", depths); + if (F_status_is_error(status)) { macro_fss_extended_list_read_depths_t_delete_simple(depths); fss_extended_list_read_delete_data(data); diff --git a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c index 4989d21..cb2543b 100644 --- a/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c +++ b/level_3/fss_extended_list_read/c/private-fss_extended_list_read.c @@ -94,6 +94,7 @@ extern "C" { } macro_fss_extended_list_read_depths_t_new(status, (*depths), depth_size); + if (F_status_is_error(status)) { fl_color_print_line(f_type_error, data.context.set.error, "CRITICAL ERROR: Unable to allocate memory."); return status; @@ -123,6 +124,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth])); status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range); + if (F_status_is_error(status)) { fss_extended_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); return status; @@ -131,6 +133,7 @@ extern "C" { if (data.parameters[fss_extended_list_read_parameter_at].result == f_console_result_additional) { for (; position_at < data.parameters[fss_extended_list_read_parameter_at].additional.used; position_at++) { + if (data.parameters[fss_extended_list_read_parameter_at].additional.array[position_at] < position_depth) { continue; } @@ -144,6 +147,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at])); status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range); + if (F_status_is_error(status)) { fss_extended_list_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); return status; @@ -153,6 +157,7 @@ extern "C" { if (data.parameters[fss_extended_list_read_parameter_name].result == f_console_result_additional) { for (; position_name < data.parameters[fss_extended_list_read_parameter_name].additional.used; position_name++) { + if (data.parameters[fss_extended_list_read_parameter_name].additional.array[position_name] < position_depth) { continue; } @@ -211,7 +216,9 @@ extern "C" { } // for for (f_array_length_t i = 0; i < depths->used; i++) { + for (f_array_length_t j = i + 1; j < depths->used; j++) { + if (depths->array[i].depth == depths->array[j].depth) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '"); fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth); @@ -313,6 +320,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); + if (F_status_is_error(status)) { fss_extended_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; @@ -334,6 +342,7 @@ extern "C" { f_number_unsigned_t number = 0; status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); + if (F_status_is_error(status)) { fss_extended_list_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_list_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; @@ -436,6 +445,7 @@ extern "C" { } for (f_array_length_t i = 0; i < items->used; i++) { + if (names[i]) { print_object(f_type_output, data->buffer, items->array[i].object); fprintf(f_type_output, "%c", f_string_eol[0]); @@ -458,6 +468,7 @@ extern "C" { f_array_length_t i = 0; for (; i < items->used; i++) { + if (names[i]) { if (at == depth_setting.value_at) { if (data->parameters[fss_extended_list_read_parameter_total].result == f_console_result_found) { @@ -492,7 +503,9 @@ extern "C" { if (line == 0) { for (; i <= items->array[i].content.array[0].stop; i++) { + if (data->buffer.string[i] == 0) continue; + if (data->buffer.string[i] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); break; @@ -514,7 +527,9 @@ extern "C" { i++; for (; i <= items->array[i].content.array[0].stop; i++) { + if (data->buffer.string[i] == 0) continue; + if (data->buffer.string[i] == f_string_eol[0]) { fprintf(f_type_output, "%c", f_string_eol[0]); break; @@ -583,9 +598,7 @@ extern "C" { f_string_length_t j = 0; for (; i < items->used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (items->array[i].content.used == 0) { if (include_empty) { @@ -637,9 +650,7 @@ extern "C" { } for (f_string_length_t i = 0; i < items->used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (items->array[i].content.used == 0) { if (include_empty) { diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index fb6da2a..30956c6 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_fss_extended_read_print_help_ f_return_status fss_extended_read_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_extended_read_name_long, fss_extended_read_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -235,6 +236,7 @@ extern "C" { f_string_length_t original_size = data->quantity.total; status = fss_extended_read_main_preprocess_depth(arguments, *data, &depths); + if (F_status_is_error(status)) { macro_fss_extended_read_depths_t_delete_simple(depths); fss_extended_read_delete_data(data); @@ -272,6 +274,7 @@ extern "C" { file.id = f_type_descriptor_input; status = f_file_read(file, &data->buffer); + if (F_status_is_error(status)) { fss_extended_read_print_file_error(data->context, "f_file_read", "-", F_status_set_fine(status)); @@ -281,6 +284,7 @@ extern "C" { } status = fss_extended_read_main_process_file(arguments, data, "-", depths); + if (F_status_is_error(status)) { macro_fss_extended_read_depths_t_delete_simple(depths); fss_extended_read_delete_data(data); @@ -342,6 +346,7 @@ extern "C" { } status = fss_extended_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths); + if (F_status_is_error(status)) { macro_fss_extended_read_depths_t_delete_simple(depths); fss_extended_read_delete_data(data); diff --git a/level_3/fss_extended_read/c/private-fss_extended_read.c b/level_3/fss_extended_read/c/private-fss_extended_read.c index 1f4255b..b3c5966 100644 --- a/level_3/fss_extended_read/c/private-fss_extended_read.c +++ b/level_3/fss_extended_read/c/private-fss_extended_read.c @@ -123,6 +123,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[position_depth])); status = fl_conversion_string_to_number_unsigned(arguments.argv[position_depth], &depths->array[i].depth, range); + if (F_status_is_error(status)) { fss_extended_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_depth, arguments.argv[position_depth], F_status_set_fine(status)); return status; @@ -131,6 +132,7 @@ extern "C" { if (data.parameters[fss_extended_read_parameter_at].result == f_console_result_additional) { for (; position_at < data.parameters[fss_extended_read_parameter_at].additional.used; position_at++) { + if (data.parameters[fss_extended_read_parameter_at].additional.array[position_at] < position_depth) { continue; } @@ -144,6 +146,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[depths->array[i].index_at])); status = fl_conversion_string_to_number_unsigned(arguments.argv[depths->array[i].index_at], &depths->array[i].value_at, range); + if (F_status_is_error(status)) { fss_extended_read_print_number_argument_error(data.context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_at, arguments.argv[depths->array[i].index_at], F_status_set_fine(status)); return status; @@ -153,6 +156,7 @@ extern "C" { if (data.parameters[fss_extended_read_parameter_name].result == f_console_result_additional) { for (; position_name < data.parameters[fss_extended_read_parameter_name].additional.used; position_name++) { + if (data.parameters[fss_extended_read_parameter_name].additional.array[position_name] < position_depth) { continue; } @@ -211,7 +215,9 @@ extern "C" { } // for for (f_array_length_t i = 0; i < depths->used; i++) { + for (f_array_length_t j = i + 1; j < depths->used; j++) { + if (depths->array[i].depth == depths->array[j].depth) { fl_color_print(f_type_error, data.context.set.error, "ERROR: The value '"); fl_color_print(f_type_error, data.context.set.notable, "%llu", depths->array[i].depth); @@ -287,6 +293,7 @@ extern "C" { return F_status_set_error(status); } else if (status == F_data_not_stop || status == F_data_not_eos) { + // Clear buffers, then attempt the next file. f_macro_fss_contents_t_delete_simple(data->contents); f_macro_fss_objects_t_delete_simple(data->objects); @@ -303,6 +310,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &select, range); + if (F_status_is_error(status)) { fss_extended_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_select, arguments.argv[index], F_status_set_fine(status)); return status; @@ -316,6 +324,7 @@ extern "C" { const f_string_range_t range = f_macro_string_range_t_initialize(strlen(arguments.argv[index])); status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &line, range); + if (F_status_is_error(status)) { fss_extended_read_print_number_argument_error(data->context, "fl_conversion_string_to_number_unsigned", fss_extended_read_long_line, arguments.argv[index], F_status_set_fine(status)); return status; @@ -331,6 +340,7 @@ extern "C" { if (data->parameters[fss_extended_read_parameter_trim].result == f_console_result_found) { for (f_string_length_t i = 0; i < data->objects.used; i++) { + name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1; if (name_length == depths.array[0].value_name.used) { @@ -342,6 +352,7 @@ extern "C" { } else { for (f_string_length_t i = 0; i < data->objects.used; i++) { + name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1; if (name_length == depths.array[0].value_name.used) { @@ -401,6 +412,7 @@ extern "C" { f_array_length_t i = 0; for (; i < data->objects.used; i++) { + if (names[i]) { if (at == depths.array[0].value_at) { print_object(f_type_output, data->buffer, data->objects.array[i]); @@ -438,6 +450,7 @@ extern "C" { f_array_length_t i = 0; for (; i < data->objects.used; i++) { + if (names[i]) { if (at == depths.array[0].value_at) { if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) { @@ -556,9 +569,7 @@ extern "C" { f_string_length_t j = 0; for (; i < data->contents.used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (data->contents.array[i].used == 0) { if (include_empty) { @@ -605,9 +616,7 @@ extern "C" { f_string_length_t j = 0; for (; i < data->contents.used; i++) { - if (!names[i]) { - continue; - } + if (!names[i]) continue; if (data->contents.array[i].used == 0) { if (include_empty && select == 0) { diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 43c9d00..d1d92c1 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -6,6 +6,7 @@ extern "C" { #ifndef _di_fss_extended_write_print_help_ f_return_status fss_extended_write_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_extended_write_name_long, fss_extended_write_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -37,6 +38,7 @@ extern "C" { const f_console_parameters_t parameters = { data->parameters, fss_extended_write_total_parameters }; status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + if (F_status_is_error(status)) { fss_extended_write_delete_data(data); return status; @@ -156,6 +158,7 @@ extern "C" { range.stop = input.used - 1; status = fl_fss_extended_object_write(input, 0, &range, &buffer); + if (F_status_is_error(status) || status == F_data_not_stop || status == F_data_not_eos) { f_macro_string_dynamic_t_delete_simple(buffer); fss_extended_write_delete_data(data); diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index d49a448..42f9cb0 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_fss_status_code_print_help_ f_return_status fss_status_code_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, fss_status_code_name_long, fss_status_code_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -107,6 +108,7 @@ extern "C" { if (data->remaining.used > 0) { for (f_array_length_t i = 0; i < data->remaining.used; i++) { + status2 = fss_status_code_process_check(*data, arguments.argv[data->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { @@ -122,6 +124,7 @@ extern "C" { if (data->remaining.used > 0) { for (f_array_length_t i = 0; i < data->remaining.used; i++) { + status2 = fss_status_code_process_number(*data, arguments.argv[data->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { diff --git a/level_3/fss_status_code/c/private-fss_status_code.c b/level_3/fss_status_code/c/private-fss_status_code.c index 1383730..e674dbc 100644 --- a/level_3/fss_status_code/c/private-fss_status_code.c +++ b/level_3/fss_status_code/c/private-fss_status_code.c @@ -8,11 +8,9 @@ extern "C" { #ifndef _di_fss_status_code_process_check_ f_return_status fss_status_code_process_check(const fss_status_code_data_t data, const f_string_t value) { f_number_unsigned_t number = 0; - f_status_t status = fss_status_code_convert_number(data, value, &number); - if (F_status_is_error(status)) { - return status; - } + f_status_t status = fss_status_code_convert_number(data, value, &number); + if (F_status_is_error(status)) return status; if (data.parameters[fss_status_code_parameter_is_error].result == f_console_result_found) { if (F_status_is_error(number)) { @@ -103,11 +101,9 @@ extern "C" { #ifndef _di_fss_status_code_process_normal_ f_return_status fss_status_code_process_normal(const fss_status_code_data_t data, const f_string_t value) { f_number_unsigned_t number = 0; - f_status_t status = fss_status_code_convert_number(data, value, &number); - if (F_status_is_error(status)) { - return status; - } + f_status_t status = fss_status_code_convert_number(data, value, &number); + if (F_status_is_error(status)) return status; const f_status_t code = (f_status_t) number; f_string_t string = 0; diff --git a/level_3/iki_read/c/iki_read.c b/level_3/iki_read/c/iki_read.c index f1d4f52..57df3a4 100644 --- a/level_3/iki_read/c/iki_read.c +++ b/level_3/iki_read/c/iki_read.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_iki_read_print_help_ f_return_status iki_read_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, iki_read_name_long, iki_read_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -95,6 +96,7 @@ extern "C" { const f_console_parameters_t parameters = { data->parameters, iki_read_total_parameters }; status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + if (F_status_is_error(status)) { iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true); @@ -162,6 +164,7 @@ extern "C" { f_number_unsigned_t number = 0; status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); + if (F_status_is_error(status)) { iki_read_print_error_number_argument(data->context, data->verbosity, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", iki_read_long_line, arguments.argv[index]); @@ -201,6 +204,7 @@ extern "C" { f_number_unsigned_t number = 0; status = fl_conversion_string_to_number_unsigned(arguments.argv[index], &number, range); + if (F_status_is_error(status)) { iki_read_print_error_number_argument(data->context, data->verbosity, F_status_set_fine(status), "fl_conversion_string_to_number_unsigned", iki_read_long_line, arguments.argv[index]); @@ -378,12 +382,14 @@ extern "C" { total = 0; status = f_file_open(arguments.argv[data->remaining.array[i]], 0, &file); + if (F_status_is_error(status)) { iki_read_print_error_file(data->context, data->verbosity, F_status_set_fine(status), "f_file_open", arguments.argv[data->remaining.array[i]], "process", F_true, F_true); break; } status = f_file_size_by_id(file.id, &total); + if (F_status_is_error(status)) { iki_read_print_error_file(data->context, data->verbosity, F_status_set_fine(status), "f_file_size_by_id", arguments.argv[data->remaining.array[i]], "process", F_true, F_true); diff --git a/level_3/iki_read/c/private-iki_read.c b/level_3/iki_read/c/private-iki_read.c index 381877d..bb43403 100644 --- a/level_3/iki_read/c/private-iki_read.c +++ b/level_3/iki_read/c/private-iki_read.c @@ -397,6 +397,7 @@ extern "C" { bool unmatched = F_true; status = fl_iki_read(&data->buffer, buffer_range, variable, vocabulary, content); + if (F_status_is_error(status)) { iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_iki_read", F_true); return status; @@ -410,6 +411,7 @@ extern "C" { if (data->mode == iki_read_mode_literal || data->mode == iki_read_mode_content) { status = iki_read_substitutions_identify(arguments, file_name, data, vocabulary, substitutionss); + if (F_status_is_error(status)) { iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "iki_read_substitutions_identify", F_true); @@ -430,10 +432,12 @@ extern "C" { buffer_range->start = 0; for (; i < data->parameters[iki_read_parameter_name].additional.used; i++) { + index = data->parameters[iki_read_parameter_name].additional.array[i]; name.used = 0; status = fl_string_append_nulless(arguments.argv[index], strlen(arguments.argv[index]), &name); + if (F_status_is_error(status)) { iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true); @@ -448,6 +452,7 @@ extern "C" { buffer_range->stop = name.used - 1; for (j = 0; j < vocabulary->used; j++) { + status = fl_string_dynamic_partial_compare(name, data->buffer, *buffer_range, vocabulary->array[j]); if (status == F_equal_to) { @@ -551,10 +556,12 @@ extern "C" { f_string_length_t length_argument = 0; for (f_array_length_t index = 0; i < data->parameters[iki_read_parameter_name].additional.used; i++) { + index = data->parameters[iki_read_parameter_name].additional.array[i]; length_argument = strnlen(arguments.argv[index], f_console_length_size); 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) { @@ -690,6 +697,7 @@ extern "C" { } status = fl_iki_read(&data->buffer, &range, variable, vocabulary, content); + if (F_status_is_error(status)) { iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_iki_read", F_true); return status; @@ -707,10 +715,12 @@ extern "C" { range.start = 0; for (; i < data->parameters[iki_read_parameter_name].additional.used; i++) { + index = data->parameters[iki_read_parameter_name].additional.array[i]; name.used = 0; status = fl_string_append_nulless(arguments.argv[index], strlen(arguments.argv[index]), &name); + if (F_status_is_error(status)) { iki_read_print_error(data->context, data->verbosity, F_status_set_fine(status), "fl_string_append_nulless", F_true); @@ -741,7 +751,10 @@ extern "C" { #ifndef _di_iki_read_substitutions_identify_ f_return_status iki_read_substitutions_identify(const f_console_arguments_t arguments, const f_string_t file_name, iki_read_data_t *data, f_iki_vocabulary_t *vocabulary, iki_read_substitutions_t *substitutionss) { - if (data->parameters[iki_read_parameter_substitute].result != f_console_result_additional) return F_none; + + if (data->parameters[iki_read_parameter_substitute].result != f_console_result_additional) { + return F_none; + } f_status_t status = F_none; @@ -756,10 +769,12 @@ extern "C" { f_console_parameter_t *parameter = &data->parameters[iki_read_parameter_substitute]; for (; i < parameter->additional.used; i += 3) { + index = parameter->additional.array[i]; length = strnlen(arguments.argv[index], f_console_length_size); for (j = 0; j < vocabulary->used; j++) { + status = fl_string_compare(arguments.argv[index], data->buffer.string + vocabulary->array[j].start, length, (vocabulary->array[j].stop - vocabulary->array[j].start) + 1); if (status == F_equal_to) { diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index 2cb9979..0a7813e 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -7,6 +7,7 @@ extern "C" { #ifndef _di_iki_write_print_help_ f_return_status iki_write_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, iki_write_name_long, iki_write_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); @@ -58,6 +59,7 @@ extern "C" { const f_console_parameter_ids_t choices = { ids, 3 }; status = fll_program_parameter_process(arguments, parameters, choices, F_true, &data->remaining, &data->context); + if (F_status_is_error(status)) { iki_write_print_error(data->context, data->verbosity, F_status_set_fine(status), "fll_program_parameter_process", F_true); diff --git a/level_3/init/c/init.c b/level_3/init/c/init.c index c7a49ca..239c046 100644 --- a/level_3/init/c/init.c +++ b/level_3/init/c/init.c @@ -25,6 +25,7 @@ extern "C" { #ifndef _di_init_print_help_ f_return_status init_print_help(const f_color_context_t context) { + fll_program_print_help_header(context, init_name_long, init_version); fll_program_print_help_option(context, f_console_standard_short_help, f_console_standard_long_help, f_console_symbol_short_enable, f_console_symbol_long_enable, " Print this help message."); diff --git a/level_3/init/c/private-init.c b/level_3/init/c/private-init.c index c74e1ad..1921af5 100644 --- a/level_3/init/c/private-init.c +++ b/level_3/init/c/private-init.c @@ -287,7 +287,6 @@ system(init_program_chgrp " " init_group_process_random " " init_path_device_random); system(init_program_chgrp " " init_group_process_urandom " " init_path_device_urandom); - // attempt to load kernel command line, but do not stop on failure. if (run_level > 0 && run_level[0] != 0) { f_file_p kernel_command_line_file = 0; @@ -345,6 +344,7 @@ // create the required directories if they do not already exist and then perform appropriate mount. status = f_file_stat(init_paths_devices, &stat); + if (status == F_file_found_not || status == F_status_set_error(F_directory)) { system(init_program_mkdir " -p " init_paths_devices); memset(&stat, 0, sizeof(f_stat)); @@ -406,7 +406,6 @@ system(init_program_mount " " tmp_path); - // create the required devices system(init_program_mknod " -m 0660 " init_path_device_null " c 1 3"); system(init_program_mknod " -m 0660 " init_path_device_zero " c 1 5"); diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index be7d2e7..28e8912 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -109,6 +109,7 @@ extern "C" { if (data->remaining.used > 0) { for (f_array_length_t i = 0; i < data->remaining.used; i++) { + status2 = status_code_process_check(*data, arguments.argv[data->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { @@ -139,6 +140,7 @@ extern "C" { if (data->remaining.used > 0) { for (f_array_length_t i = 0; i < data->remaining.used; i++) { + status2 = status_code_process_normal(*data, arguments.argv[data->remaining.array[i]]); if (F_status_is_error(status2) && status == F_none) { -- 1.8.3.1