]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/opt.h
tableprinter: code cleanup
[libucw.git] / ucw / opt.h
index cdc6a0aa9b2779b6417bf1b3048b6e5a4f2bf1fb..557cadb16491255fcd62bf31ad120a87e9f001c9 100644 (file)
--- a/ucw/opt.h
+++ b/ucw/opt.h
@@ -105,7 +105,7 @@ struct opt_item {
     struct opt_section * section;      // subsection for OPT_CL_SECTION
     int value;                         // value for OPT_CL_SWITCH
     void (* call)(struct opt_item * opt, const char * value, void * data);             // function to call for OPT_CL_CALL
-    void (* hook)(struct opt_item * opt, uns event, const char * value, void * data);  // function to call for OPT_CL_HOOK
+    void (* hook)(struct opt_item * opt, uint event, const char * value, void * data); // function to call for OPT_CL_HOOK
     struct cf_user_type * utype;       // specification of the user-defined type for CT_USER
   } u;
   u16 flags;                           // as defined below (for hooks, event mask is stored instead)
@@ -182,8 +182,8 @@ struct opt_item {
 /** IP address option, currently IPv4 only. @target should be a variable of type `u32`. **/
 #define OPT_IP(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, u32 *), .help = desc, .flags = fl, .cls = OPT_CL_STATIC, .type = CT_IP }
 
-/** Multi-valued string option. @target should be a growing array of `int`s. **/
-#define OPT_BOOL_MULTIPLE(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, char ***), .help = desc, .flags = fl, .cls = OPT_CL_MULTIPLE, .type = CT_STRING }
+/** Multi-valued string option. @target should be a growing array of `char *`s. **/
+#define OPT_STRING_MULTIPLE(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, char ***), .help = desc, .flags = fl, .cls = OPT_CL_MULTIPLE, .type = CT_STRING }
 
 /** Multi-valued integer option. @target should be a growing array of `int`s. **/
 #define OPT_INT_MULTIPLE(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, int **), .help = desc, .flags = fl, .cls = OPT_CL_MULTIPLE, .type = CT_INT }
@@ -206,6 +206,11 @@ struct opt_item {
 /** Incrementing option. @target should be a variable of type `int`. **/
 #define OPT_INC(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, int *), .flags = fl, .help = desc, .cls = OPT_CL_INC, .type = CT_INT }
 
+/* FIXME: Backwards compatibility only, should not be used anymore. */
+#define OPT_UNS OPT_UINT
+#define OPT_UNS_MULTIPLE OPT_UINT_MULTIPLE
+
+
 /**
  * When this option appears, call the function @fn with parameters @item, @value, @data,
  * where @item points to the <<struct_opt_item,`struct opt_item`>> of this option,
@@ -345,7 +350,7 @@ void opt_handle_help(struct opt_item * opt, const char * value, void * data);
 void opt_handle_config(struct opt_item * opt, const char * value, void * data);
 void opt_handle_set(struct opt_item * opt, const char * value, void * data);
 void opt_handle_dumpconfig(struct opt_item * opt, const char * value, void * data);
-void opt_conf_hook_internal(struct opt_item * opt, uns event, const char * value, void * data);
+void opt_conf_hook_internal(struct opt_item * opt, uint event, const char * value, void * data);
 
 // XXX: This is duplicated with <ucw/getopt.h>, but that one will hopefully go away one day.
 /**