25 #ifndef __MOTR_LIB_USER_SPACE_GETOPTS_H__ 26 #define __MOTR_LIB_USER_SPACE_GETOPTS_H__ 169 #define M0_GETOPTS(progname, argc, argv, ...) \ 170 m0_getopts((progname), (argc), (argv), \ 171 (const struct m0_getopts_opt []){ __VA_ARGS__ }, \ 172 ARRAY_SIZE(((const struct m0_getopts_opt []){ __VA_ARGS__ }))) 177 #define M0_VOIDARG(ch, desc, func) { \ 178 .go_type = GOT_VOID, \ 181 .go_u = { .got_void = (func) } \ 187 #define M0_NUMBERARG(ch, desc, func) { \ 188 .go_type = GOT_NUMBER, \ 191 .go_u = { .got_number = (func) } \ 197 #define M0_SCALEDARG(ch, desc, func) { \ 198 .go_type = GOT_SCALED, \ 201 .go_u = { .got_scaled = (func) } \ 207 #define M0_STRINGARG(ch, desc, func) { \ 208 .go_type = GOT_STRING, \ 211 .go_u = { .got_string = (func) } \ 218 #define M0_FORMATARG(ch, desc, fmt, ptr) { \ 219 .go_type = GOT_FORMAT, \ 224 .f_string = (fmt), .f_out = (ptr) \ 232 #define M0_FLAGARG(ch, desc, ptr) { \ 233 .go_type = GOT_FLAG, \ 236 .go_u = { .got_flag = (ptr) } \ 242 #define M0_HELPARG(ch) { \ 243 .go_type = GOT_HELP, \ 245 .go_desc = "display this help and exit",\ 246 .go_u = { .got_void = NULL } \
void(* got_number)(int64_t num)
enum m0_getopts_opt_type go_type
void(* got_string)(const char *string)
struct m0_getopts_opt::m0_getopts_union::@271 got_fmt
union m0_getopts_opt::m0_getopts_union go_u
static const char * progname
void(* got_scaled)(m0_bcount_t num)
int m0_getopts(const char *progname, int argc, char *const *argv, const struct m0_getopts_opt *opts, unsigned nr)