]> Kevux Git Server - fll/commitdiff
Update: Add missing fll_program function for short option, fix some parameters, and...
authorKevin Day <Kevin@kevux.org>
Thu, 19 Sep 2024 03:50:59 +0000 (22:50 -0500)
committerKevin Day <Kevin@kevux.org>
Thu, 19 Sep 2024 03:50:59 +0000 (22:50 -0500)
The `fll_program_print_help_option_short()` function is missing, should be defined, and now is defined.

The `description` parameters for these functions should have the `const` qualifier.

The `fll_program_print_help_option_standard()` implementation is not in the correct alphabetical position.

level_2/fll_program/c/private-program.c
level_2/fll_program/c/private-program.h
level_2/fll_program/c/program/print.c
level_2/fll_program/c/program/print.h

index 15997159b956e8392c65496f7d6ed796800d6cb0..5194b128d00fa8ff193fd28b56c4e1626299a05d 100644 (file)
@@ -68,7 +68,7 @@ extern "C" {
 #endif // !defined(_di_fll_program_parameter_process_context_) || !defined(_di_fll_program_parameter_process_context_standard_)
 
 #if !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
-  f_status_t private_fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) {
+  f_status_t private_fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char * const description) {
 
     fl_print_format("  %Q%[%Q%]", print->to, symbol_short, print->set->standout, option_short, print->set->standout);
     fl_print_format(", %Q%[%Q%]  %S%r", print->to, symbol_long, print->set->standout, option_long, print->set->standout, description, f_string_eol_s);
index 3262cfbc046be348a8cbcbb40a0402290466b797..48913318df66e0e1626789042061b0f6da9fff46 100644 (file)
@@ -80,7 +80,7 @@ extern "C" {
  * @see fll_program_print_help_option_standard()
  */
 #if !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
-  extern f_status_t private_fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) F_attribute_visibility_internal_d;
+  extern f_status_t private_fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char * const description) F_attribute_visibility_internal_d;
 #endif // !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
 
 /**
index 7c59693ab9f4f56f65e9b85e9fcf50039b025623..63e72288e5619b07ad9bbf27d71e5b05d5c82f37 100644 (file)
@@ -574,7 +574,7 @@ extern "C" {
 #endif // _di_fll_program_print_help_operations_
 
 #ifndef _di_fll_program_print_help_option_
-  f_status_t fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description) {
+  f_status_t fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char * const description) {
     #ifndef _di_level_2_parameter_checking_
       if (!print) return F_status_set_error(F_parameter);
     #endif // _di_level_2_parameter_checking_
@@ -583,51 +583,63 @@ extern "C" {
   }
 #endif // _di_fll_program_print_help_option_
 
-#ifndef _di_fll_program_print_help_option_standard_
-  f_status_t fll_program_print_help_option_standard(fl_print_t * const print) {
+#ifndef _di_fll_program_print_help_option_long_
+  f_status_t fll_program_print_help_option_long(fl_print_t * const print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char * const description) {
     #ifndef _di_level_2_parameter_checking_
       if (!print) return F_status_set_error(F_parameter);
     #endif // _di_level_2_parameter_checking_
 
-    private_fll_program_print_help_option(print, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "     Print this help message.");
-    private_fll_program_print_help_option(print, f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "Print the copyright.");
-    private_fll_program_print_help_option(print, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "     Output using colors that show up better on dark backgrounds.");
-    private_fll_program_print_help_option(print, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Output using colors that show up better on light backgrounds.");
-    private_fll_program_print_help_option(print, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Do not print using color.");
-    private_fll_program_print_help_option(print, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Decrease verbosity, silencing most print->to.");
-    private_fll_program_print_help_option(print, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Decrease verbosity, using only error print->to.");
-    private_fll_program_print_help_option(print, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "   Set verbosity to normal.");
-    private_fll_program_print_help_option(print, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "  Increase verbosity beyond normal print->to.");
-    private_fll_program_print_help_option(print, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Enable debugging, significantly increasing verbosity beyond normal print->to.");
-    private_fll_program_print_help_option(print, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "  Print only the version number.");
+    fl_print_format("      %Q%[%Q%]  %S%r", print->to, symbol_long, print->set->standout, option_long, print->set->standout, description, f_string_eol_s);
 
     return F_okay;
   }
-#endif // _di_fll_program_print_help_option_standard_
+#endif // _di_fll_program_print_help_option_long_
 
-#ifndef _di_fll_program_print_help_option_long_
-  f_status_t fll_program_print_help_option_long(fl_print_t * const print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char *description) {
+#ifndef _di_fll_program_print_help_option_other_
+  f_status_t fll_program_print_help_option_other(fl_print_t * const print, const f_string_static_t option_other, const char * const description) {
     #ifndef _di_level_2_parameter_checking_
       if (!print) return F_status_set_error(F_parameter);
     #endif // _di_level_2_parameter_checking_
 
-    fl_print_format("      %Q%[%Q%]  %S%r", print->to, symbol_long, print->set->standout, option_long, print->set->standout, description, f_string_eol_s);
+    fl_print_format("  %[%Q%]  %S%r", print->to, print->set->standout, option_other, print->set->standout, description, f_string_eol_s);
 
     return F_okay;
   }
-#endif // _di_fll_program_print_help_option_long_
+#endif // _di_fll_program_print_help_option_other_
 
-#ifndef _di_fll_program_print_help_option_other_
-  f_status_t fll_program_print_help_option_other(fl_print_t * const print, const f_string_static_t option_other, const char *description) {
+#ifndef _di_fll_program_print_help_option_short_
+  f_status_t fll_program_print_help_option_short(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t symbol_short, const char * const description) {
     #ifndef _di_level_2_parameter_checking_
       if (!print) return F_status_set_error(F_parameter);
     #endif // _di_level_2_parameter_checking_
 
-    fl_print_format("  %[%Q%]  %S%r", print->to, print->set->standout, option_other, print->set->standout, description, f_string_eol_s);
+    fl_print_format("  %Q%[%Q%]  %S%r", print->to, symbol_short, print->set->standout, option_short, print->set->standout, description, f_string_eol_s);
 
     return F_okay;
   }
-#endif // _di_fll_program_print_help_option_other_
+#endif // _di_fll_program_print_help_option_short_
+
+#ifndef _di_fll_program_print_help_option_standard_
+  f_status_t fll_program_print_help_option_standard(fl_print_t * const print) {
+    #ifndef _di_level_2_parameter_checking_
+      if (!print) return F_status_set_error(F_parameter);
+    #endif // _di_level_2_parameter_checking_
+
+    private_fll_program_print_help_option(print, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "     Print this help message.");
+    private_fll_program_print_help_option(print, f_console_standard_short_copyright_s, f_console_standard_long_copyright_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "Print the copyright.");
+    private_fll_program_print_help_option(print, f_console_standard_short_dark_s, f_console_standard_long_dark_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "     Output using colors that show up better on dark backgrounds.");
+    private_fll_program_print_help_option(print, f_console_standard_short_light_s, f_console_standard_long_light_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Output using colors that show up better on light backgrounds.");
+    private_fll_program_print_help_option(print, f_console_standard_short_no_color_s, f_console_standard_long_no_color_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, " Do not print using color.");
+    private_fll_program_print_help_option(print, f_console_standard_short_quiet_s, f_console_standard_long_quiet_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Decrease verbosity, silencing most print->to.");
+    private_fll_program_print_help_option(print, f_console_standard_short_error_s, f_console_standard_long_error_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Decrease verbosity, using only error print->to.");
+    private_fll_program_print_help_option(print, f_console_standard_short_normal_s, f_console_standard_long_normal_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "   Set verbosity to normal.");
+    private_fll_program_print_help_option(print, f_console_standard_short_verbose_s, f_console_standard_long_verbose_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "  Increase verbosity beyond normal print->to.");
+    private_fll_program_print_help_option(print, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "    Enable debugging, significantly increasing verbosity beyond normal print->to.");
+    private_fll_program_print_help_option(print, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_inverse_s, f_console_symbol_long_inverse_s, "  Print only the version number.");
+
+    return F_okay;
+  }
+#endif // _di_fll_program_print_help_option_standard_
 
 #ifndef _di_fll_program_print_help_special_options_
   f_status_t fll_program_print_help_special_options(fl_print_t * const print) {
index e0bc4d2904d7423c52a902b59ac2d2163b784eaf..9d5acf80b9ec5f6aeed15ffec31b383ffbdd758c 100644 (file)
@@ -866,7 +866,7 @@ extern "C" {
  * @see fl_print_format()
  */
 #ifndef _di_fll_program_print_help_option_
-  extern f_status_t fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char *description);
+  extern f_status_t fll_program_print_help_option(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t option_long, const f_string_static_t symbol_short, const f_string_static_t symbol_long, const char * const description);
 #endif // _di_fll_program_print_help_option_
 
 /**
@@ -894,7 +894,7 @@ extern "C" {
  * @see fl_print_format()
  */
 #ifndef _di_fll_program_print_help_option_long_
-  extern f_status_t fll_program_print_help_option_long(fl_print_t * const print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char *description);
+  extern f_status_t fll_program_print_help_option_long(fl_print_t * const print, const f_string_static_t option_long, const f_string_static_t symbol_long, const char * const description);
 #endif // _di_fll_program_print_help_option_long_
 
 /**
@@ -920,10 +920,38 @@ extern "C" {
  * @see fl_print_format()
  */
 #ifndef _di_fll_program_print_help_option_other_
-  extern f_status_t fll_program_print_help_option_other(fl_print_t * const print, const f_string_static_t option_other, const char *description);
+  extern f_status_t fll_program_print_help_option_other(fl_print_t * const print, const f_string_static_t option_other, const char * const description);
 #endif // _di_fll_program_print_help_option_other_
 
 /**
+ * Print standard help option (short option only).
+ *
+ * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.
+ *
+ * @param print
+ *   The output structure to print to.
+ *   This uses but does not lock or unlock file stream.
+ *   This requires print.set to be non-NULL.
+ * @param option_short
+ *   The short name of the option.
+ * @param symbol_short
+ *   The short symbol of the option.
+ * @param description
+ *   A desciption associated with the option.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_output_not on success, but no printing is performed.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see fl_print_format()
+ */
+#ifndef _di_fll_program_print_help_option_short_
+  extern f_status_t fll_program_print_help_option_short(fl_print_t * const print, const f_string_static_t option_short, const f_string_static_t symbol_short, const char * const description);
+#endif // _di_fll_program_print_help_option_short_
+
+/**
  * Print all standard help options.
  *
  * This print function does not use locking, be sure something like flockfile() and funlockfile() are appropriately called.