]> Kevux Git Server - fll/commitdiff
Update: explode parameter priotization into left & right, add quiet and verbose optio...
authorKevin Day <thekevinday@gmail.com>
Sat, 9 May 2020 19:22:04 +0000 (14:22 -0500)
committerKevin Day <thekevinday@gmail.com>
Sat, 9 May 2020 20:07:42 +0000 (15:07 -0500)
The (right) parameter prioritization function should be expanded into a left-prioritization and a right-prioritaztion.

Make +q/++quiet and +V/++verbose standard options for verbose.

Add length defines for console standard defines.

Make sure the status return is handled.
There were a few cases where it was not being handled.

Minor code structure cleanups for structural issues I happened to observe.

19 files changed:
level_0/f_console/c/console.c
level_0/f_console/c/console.h
level_2/fll_program/c/program.c
level_2/fll_program/c/program.h
level_3/byte_dump/c/byte_dump.c
level_3/fake/c/fake.c
level_3/fake/c/fake.h
level_3/fake/data/build/settings
level_3/firewall/c/firewall.c
level_3/fss_basic_list_read/c/fss_basic_list_read.c
level_3/fss_basic_list_write/c/fss_basic_list_write.c
level_3/fss_basic_read/c/fss_basic_read.c
level_3/fss_basic_write/c/fss_basic_write.c
level_3/fss_extended_list_read/c/fss_extended_list_read.c
level_3/fss_extended_read/c/fss_extended_read.c
level_3/fss_extended_write/c/fss_extended_write.c
level_3/fss_status_code/c/fss_status_code.c
level_3/init/c/init.c
level_3/status_code/c/status_code.c

index e9764b1cc3ed12517eaa36352579dd33372e662b..a535802f5dd534d62e0d57697bd89d7a5693bca7 100644 (file)
@@ -315,15 +315,57 @@ extern "C" {
   }
 #endif // _di_f_console_parameter_process_
 
-#ifndef _di_f_console_parameter_prioritize_
-  f_return_status f_console_parameter_prioritize(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision) {
+#ifndef _di_f_console_parameter_prioritize_left_
+  f_return_status f_console_parameter_prioritize_left(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision) {
     #ifndef _di_level_0_parameter_checking_
       if (decision == 0) return f_status_set_error(f_invalid_parameter);
-      if (parameters.used == 0) return f_status_set_error(f_invalid_parameter);
       if (choices.id == 0) return f_status_set_error(f_invalid_parameter);
-      if (choices.used == 0) return f_status_set_error(f_invalid_parameter);
     #endif // _di_level_0_parameter_checking_
 
+    if (choices.used == 0) return f_no_data;
+    if (parameters.used == 0) return f_no_data;
+
+    f_array_length location = 0;
+    f_array_length location_sub = 0;
+    f_console_parameter_id priority = 0;
+
+    for (f_array_length i = 0; i < choices.used; i++) {
+      if (choices.id[i] > parameters.used) return f_status_set_error(f_invalid_parameter);
+
+      if (parameters.parameter[choices.id[i]].result == f_console_result_found) {
+        if (parameters.parameter[choices.id[i]].location < location) {
+          location = parameters.parameter[choices.id[i]].location;
+          location_sub = parameters.parameter[choices.id[i]].location_sub;
+          priority = choices.id[i];
+        }
+        else if (parameters.parameter[choices.id[i]].location == location && parameters.parameter[choices.id[i]].location_sub < location_sub) {
+          location_sub = parameters.parameter[choices.id[i]].location_sub;
+          priority = choices.id[i];
+        }
+      }
+    } // for
+
+    // The first parameter location (argc = 0) is the program name, therefore if the location is 0, then no matches were found.
+    if (location == 0) {
+      return f_no_data;
+    }
+
+    *decision = priority;
+
+    return f_none;
+  }
+#endif // _di_f_console_parameter_prioritize_left_
+
+#ifndef _di_f_console_parameter_prioritize_right_
+  f_return_status f_console_parameter_prioritize_right(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision) {
+    #ifndef _di_level_0_parameter_checking_
+      if (decision == 0) return f_status_set_error(f_invalid_parameter);
+      if (choices.id == 0) return f_status_set_error(f_invalid_parameter);
+    #endif // _di_level_0_parameter_checking_
+
+    if (choices.used == 0) return f_no_data;
+    if (parameters.used == 0) return f_no_data;
+
     f_array_length location = 0;
     f_array_length location_sub = 0;
     f_console_parameter_id priority = 0;
@@ -353,7 +395,7 @@ extern "C" {
 
     return f_none;
   }
-#endif // _di_f_console_parameter_prioritize_
+#endif // _di_f_console_parameter_prioritize_right_
 
 #ifdef __cplusplus
 } // extern "C"
index 7f60c71685c873d37738ec6ab1302fc8de2cee97..0b6316e5d56a4551d4aa3582d2c73ff9edfc1563 100644 (file)
@@ -67,7 +67,25 @@ extern "C" {
 #endif // _di_f_console_symbols_
 
 /**
- * Create some standard command line parameter options required by the kevux/fss/fll specifications.
+ * Create some standard command line parameter options required/expected by the kevux/fss/fll specifications.
+ *
+ * It is expected that all of the "+" and "++" console options described below are reserved for these purposes.
+ * This is not a strict requirement as such a thing is non-sense in open-source, but this should be considered a strong recommendation.
+ *
+ * It is acceptable for any of these options, when specified multiple times, for that number of times to represent the "level".
+ * For example, a "+D +D" means more debug output than simply "+D".
+ *
+ * The following options are subjective in interpretation but are expected to follow the general interpretation:
+ * - debug: Enable debugging, which will likely increase output verbosity.
+ * - quiet: Decrease verbosity, print less, in some use cases this could mean printing nothing.
+ * - verbose: Increase verbosity, print more, in some use cases this could mean printing just about everything.
+ *
+ * The following are less subjective in interpretation but do allow some flexibility.
+ * - dark: Do display color intended for dark backgrounds (often the default behavior) when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.)
+ * - help: Display the help text. This does not define how the text is displayed only that the text is displayed.
+ * - light: Do display color intended for light backgrounds when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.)
+ * - no_color: Do not display color when printing to the console. Other contexts may be acceptable (such as voice inflections, or lack-thereof) for audio.)
+ * - version: Should always print only the version number, no colors, but what represents the version number is undefined by this project.
  */
 #ifndef _di_f_standard_console_parameters_
   #define f_console_standard_short_dark     "d"
@@ -75,14 +93,36 @@ extern "C" {
   #define f_console_standard_short_help     "h"
   #define f_console_standard_short_light    "l"
   #define f_console_standard_short_no_color "n"
+  #define f_console_standard_short_quiet    "q"
+  #define f_console_standard_short_verbose  "V"
   #define f_console_standard_short_version  "v"
 
+  #define f_console_standard_short_dark_length     1
+  #define f_console_standard_short_debug_length    1
+  #define f_console_standard_short_help_length     1
+  #define f_console_standard_short_light_length    1
+  #define f_console_standard_short_no_color_length 1
+  #define f_console_standard_short_quiet_length    1
+  #define f_console_standard_short_verbose_length  1
+  #define f_console_standard_short_version_length  1
+
   #define f_console_standard_long_dark     "dark"
   #define f_console_standard_long_debug    "debug"
   #define f_console_standard_long_help     "help"
   #define f_console_standard_long_light    "light"
   #define f_console_standard_long_no_color "no_color"
+  #define f_console_standard_long_quiet    "quiet"
+  #define f_console_standard_long_verbose  "verbose"
   #define f_console_standard_long_version  "version"
+
+  #define f_console_standard_long_dark_length     4
+  #define f_console_standard_long_debug_length    5
+  #define f_console_standard_long_help_length     4
+  #define f_console_standard_long_light_length    5
+  #define f_console_standard_long_no_color_length 8
+  #define f_console_standard_long_quiet_length    5
+  #define f_console_standard_long_verbose_length  7
+  #define f_console_standard_long_version_length  7
 #endif // _di_f_standard_console_parameters_
 
 /**
@@ -290,6 +330,36 @@ extern "C" {
  * Given a set of parameter choices, determine which one has the highest priority.
  *
  * The priority is determined by viewing the parameters from left to right.
+ * The left-most parameter defined in the set has the priority over others.
+ *
+ * For example, the color context modes override each other, so only one gets priority.
+ * If given, say "+l ++no_color +d", the "+d" would be the left-most parameter "+l" and "++no_color".
+ * The decision would be "+d".
+ *
+ * This also applies to short parameters combined into one, such as "+lnd", the "d" would again be the decision.
+ *
+ * @param parameters
+ *   The parameters to process.
+ * @param choices
+ *   An array of numeric ids, each representing a parameter within the parameters variable.
+ *   The order does not matter.
+ * @param decision
+ *   The resulting decision.
+ *   If none of the parameters are found, then this will not be updated (therefore it is safe to have it pre-initialized to the default).
+ *
+ * @return
+ *   f_none on success.
+ *   f_no_data if no parameters were found.
+ *   f_invalid_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_console_parameter_prioritize_left_
+  extern f_return_status f_console_parameter_prioritize_left(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision);
+#endif // _di_f_console_parameter_prioritize_left_
+
+/**
+ * Given a set of parameter choices, determine which one has the highest priority.
+ *
+ * The priority is determined by viewing the parameters from left to right.
  * The right-most parameter defined in the set has the priority over others.
  *
  * For example, the color context modes override each other, so only one gets priority.
@@ -312,9 +382,9 @@ extern "C" {
  *   f_no_data if no parameters were found.
  *   f_invalid_parameter (with error bit) if a parameter is invalid.
  */
-#ifndef _di_f_console_parameter_prioritize_
-  extern f_return_status f_console_parameter_prioritize(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision);
-#endif // _di_f_console_parameter_prioritize_
+#ifndef _di_f_console_parameter_prioritize_right_
+  extern f_return_status f_console_parameter_prioritize_right(const f_console_parameters parameters, const f_console_parameter_ids choices, f_console_parameter_id *decision);
+#endif // _di_f_console_parameter_prioritize_right_
 
 #ifdef __cplusplus
 } // extern "C"
index d3b94108497b1ee7c73b0becdf4b0a7034b9758b..34a5e491eeae86038c4d26ee87046e8b1f96d543 100644 (file)
@@ -90,40 +90,24 @@ extern "C" {
 #endif // _di_fll_program_print_version_
 
 #ifndef _di_fll_program_parameter_process_
-  f_return_status fll_program_parameter_process(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, f_string_lengths *remaining, fl_color_context *context) {
+  f_return_status fll_program_parameter_process(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, const bool right, f_string_lengths *remaining, fl_color_context *context) {
     f_status status = f_none;
 
     status = f_console_parameter_process(arguments, parameters, remaining);
 
-    f_console_parameter_id decision = choices.id[2];
-
-    f_console_parameter_prioritize(parameters, choices, &decision);
-
-    // load colors unless told not to.
-    if (decision != choices.id[0]) {
-      f_status allocation_status = f_none;
-
-      fl_macro_color_context_new(allocation_status, (*context));
-
-      if (f_status_is_error(allocation_status)) {
-        fprintf(f_standard_error, "CRITICAL ERROR: Unable to allocate memory.\n");
-        return allocation_status;
-      }
-
-      fl_color_load_context(context, decision == choices.id[1]);
-    }
-
     if (f_status_is_error(status)) {
       status = f_status_set_fine(status);
 
       if (status == f_no_data) {
         fl_color_print_line(f_standard_error, context->error, context->reset, "ERROR: One of the parameters you passed requires an additional parameter that you did not pass.");
-        // TODO: there is a way to identify which parameter is incorrect
+        // @todo there is a way to identify which parameter is incorrect
         //       to do this, one must look for any "has_additional" and then see if the "additional" location is set to 0
         //       nothing can be 0 as that represents the program name, unless argv[] is improperly created
       }
       else if (status == f_error_allocation || status == f_error_reallocation) {
-        fl_color_print_line(f_standard_error, context->error, context->reset, "CRITICAL ERROR: Unable to allocate memory.");
+        fl_color_print(f_standard_error, context->error, context->reset, "CRITICAL ERROR: Unable to allocate memory while calling ");
+        fl_color_print(f_standard_error, context->notable, context->reset, "f_console_parameter_process");
+        fl_color_print_line(f_standard_error, context->error, context->reset, ").");
       }
       else if (status == f_invalid_utf) {
         fl_color_print(f_standard_error, context->error, context->reset, "ENCODING ERROR: Invalid UTF-8 character in parameter when calling ");
@@ -146,10 +130,98 @@ extern "C" {
       return f_status_set_error(status);
     }
 
+    f_console_parameter_id decision = choices.id[2];
+
+    f_string function;
+
+    if (right) {
+      function = "f_console_parameter_prioritize_right";
+      status = f_console_parameter_prioritize_right(parameters, choices, &decision);
+    }
+    else {
+      function = "f_console_parameter_prioritize_left";
+      status = f_console_parameter_prioritize_left(parameters, choices, &decision);
+    }
+
+    if (f_status_is_error(status)) {
+      status = f_status_set_fine(status);
+
+      if (status == f_error_allocation || status == f_error_reallocation) {
+        fl_color_print(f_standard_error, context->error, context->reset, "CRITICAL ERROR: Unable to allocate memory while calling ");
+        fl_color_print(f_standard_error, context->notable, context->reset, "%s", function);
+        fl_color_print_line(f_standard_error, context->error, context->reset, ").");
+      }
+      else if (status == f_invalid_parameter) {
+        fl_color_print(f_standard_error, context->error, context->reset, "INTERNAL ERROR: Invalid parameter when calling ");
+        fl_color_print(f_standard_error, context->notable, context->reset, "%s", function);
+        fl_color_print_line(f_standard_error, context->error, context->reset, "().");
+      }
+      else {
+        fl_color_print(f_standard_error, context->error, context->reset, "INTERNAL ERROR: An unhandled error (");
+        fl_color_print(f_standard_error, context->notable, context->reset, "%u", status);
+        fl_color_print(f_standard_error, context->error, context->reset, ") has occurred while calling ");
+        fl_color_print(f_standard_error, context->notable, context->reset, "%s", function);
+        fl_color_print_line(f_standard_error, context->error, context->reset, "().");
+      }
+
+      return f_status_set_error(status);
+    }
+
+    // load colors unless told not to.
+    if (decision != choices.id[0]) {
+      f_status allocation_status = f_none;
+
+      fl_macro_color_context_new(allocation_status, (*context));
+
+      if (f_status_is_error(allocation_status)) {
+        fl_color_print(f_standard_error, context->error, context->reset, "CRITICAL ERROR: Unable to allocate memory while calling ");
+        fl_color_print(f_standard_error, context->notable, context->reset, "fl_macro_color_context_new");
+        fl_color_print_line(f_standard_error, context->error, context->reset, "().");
+
+        return allocation_status;
+      }
+
+      status = fl_color_load_context(context, decision == choices.id[1]);
+    }
+
     return status;
   }
 #endif // _di_fll_program_parameter_process_
 
+#ifndef _di_fll_program_parameter_process_quietly_
+  f_return_status fll_program_parameter_process_quietly(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, const bool right, f_string_lengths *remaining, fl_color_context *context) {
+    f_status status = f_none;
+
+    status = f_console_parameter_process(arguments, parameters, remaining);
+
+    if (f_status_is_error(status)) return status;
+
+    f_console_parameter_id decision = choices.id[2];
+
+    if (right) {
+      status = f_console_parameter_prioritize_right(parameters, choices, &decision);
+    }
+    else {
+      status = f_console_parameter_prioritize_left(parameters, choices, &decision);
+    }
+
+    if (f_status_is_error(status)) return status;
+
+    // load colors unless told not to.
+    if (decision != choices.id[0]) {
+      f_status allocation_status = f_none;
+
+      fl_macro_color_context_new(allocation_status, (*context));
+
+      if (f_status_is_error(allocation_status)) return allocation_status;
+
+      status = fl_color_load_context(context, decision == choices.id[1]);
+    }
+
+    return status;
+  }
+#endif // _di_fll_program_parameter_process_quietly_
+
 #ifndef _di_fll_program_parameter_additional_append_
   f_return_status fll_program_parameter_additional_append(const f_string *argv, const f_string_lengths additional, f_string_dynamics *destination) {
     #ifndef _di_level_2_parameter_checking_
index 26dd64705543db98675ac1da58d5f7217cdfa05a..5494f4483c0fe23161fda5511bf9ab97a0bdd5e7 100644 (file)
@@ -144,6 +144,8 @@ extern "C" {
  * @param choices
  *   A set of the color options: no-color option, light-color option, dark-color option.
  *   This must have its used size set to 3 and the ids are expected to be in this order: no_color, light, and dark.
+ * @param right
+ *   Set to TRUE for right priortization and FALSE for left prioritization.
  * @param remaining
  *   A list of remaining parameters not associated with anything.
  * @param context
@@ -156,8 +158,34 @@ extern "C" {
  *   f_error_reallocation (with error bit) on memory reallocation error.
  */
 #ifndef _di_fll_program_parameter_process_
-  extern f_return_status fll_program_parameter_process(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, f_string_lengths *remaining, fl_color_context *context);
+  extern f_return_status fll_program_parameter_process(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, const bool right, f_string_lengths *remaining, fl_color_context *context);
 #endif // _di_fll_program_parameter_process_
+/**
+ * Perform basic parameter loading, including initialization of color context but does not print errors.
+ *
+ * @param arguments
+ *   The parameters passed to the process.
+ * @param parameters
+ *   The console parameters to look for.
+ * @param choices
+ *   A set of the color options: no-color option, light-color option, dark-color option.
+ *   This must have its used size set to 3 and the ids are expected to be in this order: no_color, light, and dark.
+ * @param right
+ *   Set to TRUE for right priortization and FALSE for left prioritization.
+ * @param remaining
+ *   A list of remaining parameters not associated with anything.
+ * @param context
+ *   The color context.
+ *
+ * @return
+ *   f_none on success.
+ *   f_no_data if "additional" parameters were expected but not found.
+ *   f_invalid_parameter (with error bit) if a parameter is invalid.
+ *   f_error_reallocation (with error bit) on memory reallocation error.
+ */
+#ifndef _di_fll_program_parameter_process_quietly_
+  extern f_return_status fll_program_parameter_process_quietly(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, const bool right, f_string_lengths *remaining, fl_color_context *context);
+#endif // _di_fll_program_parameter_process_quietly_
 
 /**
  * Allocate new strings from all of the provided locations.
index c6aa474021fe6cc3d75dccdfccd1fa36bf3ec4c2..c008f3db43d09cc4d2f24e8bf2848d5310232515 100644 (file)
@@ -82,12 +82,14 @@ extern "C" {
         choices.id = ids;
         choices.used = 3;
 
-        status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
+        status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
         if (f_status_is_error(status)) {
           byte_dump_delete_data(data);
           return f_status_set_error(status);
         }
+
+        status = f_none;
       }
 
       // Identify priority of mode parameters.
@@ -97,7 +99,7 @@ extern "C" {
         choices.id = ids;
         choices.used = 5;
 
-        status = f_console_parameter_prioritize(parameters, choices, &choice);
+        status = f_console_parameter_prioritize_right(parameters, choices, &choice);
 
         if (f_status_is_error(status)) {
           byte_dump_delete_data(data);
@@ -128,7 +130,7 @@ extern "C" {
         choices.id = ids;
         choices.used = 3;
 
-        status = f_console_parameter_prioritize(parameters, choices, &choice);
+        status = f_console_parameter_prioritize_right(parameters, choices, &choice);
 
         if (f_status_is_error(status)) {
           byte_dump_delete_data(data);
index 981f78eef02b3340bc6a17f7f7ec50d0f3843b13..d5fd1af9100b1dc44752d380a4263a1598319011 100644 (file)
@@ -17,6 +17,8 @@ extern "C" {
     fll_program_print_help_option(context, f_console_standard_short_light, f_console_standard_long_light, f_console_symbol_short_disable, f_console_symbol_long_disable, "   Output using colors that show up better on light backgrounds.");
     fll_program_print_help_option(context, f_console_standard_short_dark, f_console_standard_long_dark, f_console_symbol_short_disable, f_console_symbol_long_disable, "    Output using colors that show up better on dark backgrounds.");
     fll_program_print_help_option(context, f_console_standard_short_no_color, f_console_standard_long_no_color, f_console_symbol_short_disable, f_console_symbol_long_disable, "Do not output in color.");
+    fll_program_print_help_option(context, f_console_standard_short_quiet, f_console_standard_long_quiet, f_console_symbol_short_disable, f_console_symbol_long_disable, "   Decrease verbosity beyond normal output.");
+    fll_program_print_help_option(context, f_console_standard_short_verbose, f_console_standard_long_verbose, f_console_symbol_short_disable, f_console_symbol_long_disable, " Increase verbosity beyond normal output.");
     fll_program_print_help_option(context, f_console_standard_short_version, f_console_standard_long_version, f_console_symbol_short_disable, f_console_symbol_long_disable, " Print only the version number.");
 
     printf("%c", f_string_eol);
@@ -93,12 +95,14 @@ extern "C" {
         choices.id = ids;
         choices.used = 3;
 
-        status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
+        status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
         if (f_status_is_error(status)) {
           fake_delete_data(data);
           return f_status_set_error(status);
         }
+
+        status = f_none;
       }
 
       // Determine order of operations.
index cd690251dac2be4f71ba2a78bf6dd0d2cd76a9aa..0732e7d601cf7feca36bb56169054884b0c40caa 100644 (file)
@@ -337,7 +337,10 @@ extern "C" {
     fake_parameter_help,
     fake_parameter_light,
     fake_parameter_dark,
+    fake_parameter_debug,
     fake_parameter_no_color,
+    fake_parameter_quiet,
+    fake_parameter_verbose,
     fake_parameter_version,
 
     fake_parameter_defines,
@@ -374,7 +377,10 @@ extern "C" {
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_console_type_normal), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_dark, f_console_standard_long_dark, 0, 0, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_debug, f_console_standard_long_debug, 0, 0, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_quiet, f_console_standard_long_quiet, 0, 0, f_console_type_inverse), \
+      f_console_parameter_initialize(f_console_standard_short_verbose, f_console_standard_long_verbose, 0, 0, f_console_type_inverse), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_console_type_inverse), \
       f_console_parameter_initialize(fake_short_defines, fake_long_defines, 0, 1, f_console_type_normal), \
       f_console_parameter_initialize(fake_short_mode, fake_long_mode, 0, 1, f_console_type_normal), \
@@ -401,7 +407,7 @@ extern "C" {
       f_console_parameter_initialize(0, 0, fake_other_operation_skeleton, 0, f_console_type_other), \
     }
 
-  #define fake_total_parameters 28
+  #define fake_total_parameters 31
 #endif // _di_fake_defines_
 
 #ifndef _di_fake_data_
index 83922a08e93a6d7d7604fb6930629f2b2f1195c5..55bef6b33ea57ee8c6bc2c8253dca773a0e58196 100644 (file)
@@ -1,4 +1,4 @@
-# fss-0000
+# fss-0001
 
 project_name fake
 project_level 3
index ccd98581b23c5436fc95040523654b7a632b912c..d5e32858331846789982392275f281845cf8d659 100644 (file)
@@ -63,15 +63,15 @@ extern "C" {
       f_console_parameter_id ids[3] = { firewall_parameter_no_color, firewall_parameter_light, firewall_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
-    }
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
-    if (f_status_is_error(status)) {
-      firewall_delete_data(data);
-      return f_status_set_error(status);
-    }
+      if (f_status_is_error(status)) {
+        firewall_delete_data(data);
+        return f_status_set_error(status);
+      }
 
-    status = f_none;
+      status = f_none;
+    }
 
     if (data->parameters[firewall_parameter_help].result == f_console_result_found) {
       firewall_print_help(data->context);
index c1c7ebe51cbf80b804db34eb9d1f631b9730fb13..8da900bfc742b20c517f6b199a7def1e1c08713c 100644 (file)
@@ -130,7 +130,7 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_basic_list_read_parameter_no_color, fss_basic_list_read_parameter_light, fss_basic_list_read_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
       if (f_status_is_error(status)) {
         fss_basic_list_read_delete_data(data);
index 57e5dd341cbaf40c47200f77d4c221f2a1d65e9a..d4470e9718724a8a8cf7bff6195d6ef2e080de3a 100644 (file)
@@ -35,15 +35,15 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_basic_list_write_parameter_no_color, fss_basic_list_write_parameter_light, fss_basic_list_write_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
-    }
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
-    if (f_status_is_error(status)) {
-      fss_basic_list_write_delete_data(data);
-      return f_status_set_error(status);
-    }
+      if (f_status_is_error(status)) {
+        fss_basic_list_write_delete_data(data);
+        return f_status_set_error(status);
+      }
 
-    status = f_none;
+      status = f_none;
+    }
 
     if (data->parameters[fss_basic_list_write_parameter_help].result == f_console_result_found) {
       fss_basic_list_write_print_help(data->context);
index dfff8b63d234e9029d0563c6c7279b403c45258c..55f527f2b9bfbf6fc886984d797c404829ddeefc 100644 (file)
@@ -130,7 +130,7 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_basic_read_parameter_no_color, fss_basic_read_parameter_light, fss_basic_read_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
       if (f_status_is_error(status)) {
         fss_basic_read_delete_data(data);
index 9d93e92f7991ea1bed06f8715c139f47043b16cf..e3e85d1ebc5fb08d49471f7cc1a598e2b3e4b721 100644 (file)
@@ -35,15 +35,15 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_basic_write_parameter_no_color, fss_basic_write_parameter_light, fss_basic_write_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-       status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
-    }
+       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 f_status_set_error(status);
-    }
+      if (f_status_is_error(status)) {
+        fss_basic_write_delete_data(data);
+        return f_status_set_error(status);
+      }
 
-    status = f_none;
+      status = f_none;
+    }
 
     if (data->parameters[fss_basic_write_parameter_help].result == f_console_result_found) {
       fss_basic_write_print_help(data->context);
index c54a1ab05ee815fbedbc15700f705aa1f153b006..547e203ff0c111431572102db6d93c78ba0a9ce4 100644 (file)
@@ -130,7 +130,7 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_extended_list_read_parameter_no_color, fss_extended_list_read_parameter_light, fss_extended_list_read_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
       if (f_status_is_error(status)) {
         fss_extended_list_read_delete_data(data);
index 18abb1e582ddd00f141a5487fa19565a14f81212..8153fb9e5762350361fef849514488eec87048cf 100644 (file)
@@ -130,7 +130,7 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_extended_read_parameter_no_color, fss_extended_read_parameter_light, fss_extended_read_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
       if (f_status_is_error(status)) {
         fss_extended_read_delete_data(data);
index 2552c29a0e43b64a0e872e69677aef2a9f7ef85e..2dadede5c7dc9b601918ef648b870e7dab57e9b0 100644 (file)
@@ -36,15 +36,15 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_extended_write_parameter_no_color, fss_extended_write_parameter_light, fss_extended_write_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
-    }
+      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 f_status_set_error(status);
-    }
+      if (f_status_is_error(status)) {
+        fss_extended_write_delete_data(data);
+        return f_status_set_error(status);
+      }
 
-    status = f_none;
+      status = f_none;
+    }
 
     if (f_status_is_error(status)) {
       status = f_status_set_fine(status);
index 02131b23bd128cdba240377a1be4bff1e3f51a9e..66b34c1e69257744621dff92af1ee84248684d79 100644 (file)
@@ -37,16 +37,15 @@ extern "C" {
       f_console_parameter_id ids[3] = { fss_status_code_parameter_no_color, fss_status_code_parameter_light, fss_status_code_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
-    }
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
-    if (f_status_is_error(status)) {
-      fss_status_code_delete_data(data);
-      return f_status_set_error(status);
-    }
+      if (f_status_is_error(status)) {
+        fss_status_code_delete_data(data);
+        return f_status_set_error(status);
+      }
 
-    f_status status2 = f_none;
-    status = f_none;
+      status = f_none;
+    }
 
     if (data->parameters[fss_status_code_parameter_help].result == f_console_result_found) {
       fss_status_code_print_help(data->context);
@@ -99,6 +98,8 @@ extern "C" {
       return f_status_set_error(f_invalid_parameter);
     }
 
+    f_status status2 = f_none;
+
     if (data->parameters[fss_status_code_parameter_is_error].result == f_console_result_found || data->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found || data->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) {
       if (data->process_pipe) {
         // @todo: call fss_status_code_process_check() here for all data from pipe that is space separated.
index 04d87c1e5d743129669c44bc0152194360e8cf99..e4fa957e1c02973dc16fb3fa3dbe37d2a554d427 100644 (file)
@@ -57,16 +57,15 @@ extern "C" {
       f_console_parameter_id ids[3] = { init_parameter_no_color, init_parameter_light, init_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
-    }
-
-    if (f_status_is_error(status)) {
-      // @todo: init_delete_data(data);
-      return f_status_set_error(status);
-    }
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
-    status = f_none;
+      if (f_status_is_error(status)) {
+        // @todo: init_delete_data(data);
+        return f_status_set_error(status);
+      }
 
+      status = f_none;
+    }
 
     if (data->parameters[init_parameter_runlevel].result == f_console_result_found) {
       const unsigned int parameter_length = strlen(arguments.argv[data->parameters[init_parameter_runlevel].additional.array[0]]);
index b6a2910f5491062675d3c2e8300c2a7c7725bc79..d7a92d5e4ef10fd016ee5daa0eaffbc136471a8e 100644 (file)
@@ -37,16 +37,15 @@ extern "C" {
       f_console_parameter_id ids[3] = { status_code_parameter_no_color, status_code_parameter_light, status_code_parameter_dark };
       f_console_parameter_ids choices = { ids, 3 };
 
-      status = fll_program_parameter_process(arguments, parameters, choices, &data->remaining, &data->context);
-    }
+      status = fll_program_parameter_process(arguments, parameters, choices, f_true, &data->remaining, &data->context);
 
-    if (f_status_is_error(status)) {
-      status_code_delete_data(data);
-      return f_status_set_error(status);
-    }
+      if (f_status_is_error(status)) {
+        status_code_delete_data(data);
+        return f_status_set_error(status);
+      }
 
-    f_status status2 = f_none;
-    status = f_none;
+      status = f_none;
+    }
 
     if (data->parameters[status_code_parameter_help].result == f_console_result_found) {
       status_code_print_help(data->context);
@@ -99,6 +98,8 @@ extern "C" {
       return f_status_set_error(f_invalid_parameter);
     }
 
+    f_status status2 = f_none;
+
     if (data->parameters[status_code_parameter_is_error].result == f_console_result_found || data->parameters[status_code_parameter_is_warning].result == f_console_result_found || data->parameters[status_code_parameter_is_fine].result == f_console_result_found) {
       if (data->process_pipe) {
         // @todo: call status_code_process_check() here for all data from pipe that is space separated.