#ifndef CLI_H #define CLI_H #include #include enum cli_code { CLI_EXIT_SUCCESS = -1, CLI_SUCCESS = 0, CLI_ERROR = 1 }; typedef int (*t_option_handler)(const char *arg, void *config); enum option_arg_type { OPT_ARG_NONE = 0, OPT_ARG_INT, OPT_ARG_UINT, OPT_ARG_SECONDS, OPT_ARG_BYTES, OPT_ARG_TTL, OPT_ARG_STRING }; struct option_descriptor { char short_opt; const char *long_opt; int has_arg; t_option_handler handler; enum option_arg_type arg_type; const char *description; }; enum cli_code cli_parse(int argc, char **argv, void *config, const struct option_descriptor *opts, size_t nb_opts, char *opt_str, struct option *long_opts); #endif