#include #include #include "cli.h" #include "cli_opt.h" #undef X #define X(short_opt, long_opt, has_arg, handler, arg_type, desc) \ { short_opt, long_opt, has_arg, handler, arg_type, desc }, const t_option_descriptor g_options[] = { CLI_OPTIONS_LIST {0, NULL, 0, NULL, OPT_ARG_NONE, NULL } }; const size_t g_options_len = ((sizeof(g_options) / sizeof(*g_options)) - 1); #undef X #define X(short_opt, long_opt, has_arg, handler, arg_type, desc) \ + (1 * (has_arg == no_argument) \ + (2 * (has_arg == required_argument) \ + (3 * (has_arg == optional_argument)))) const size_t g_opt_str_len = CLI_OPT_STR_LEN; #undef X