Lines Matching refs:opts
46 static void opts_setcmdarg(struct opts *opts, const char *cmdarg);
49 struct opts { struct
126 struct opts *
127 opts_parse(struct opts *opts, char **argv, int flags) in opts_parse() argument
132 if (opts == NULL) { in opts_parse()
133 opts = MALLOC(sizeof (*opts)); in opts_parse()
134 opts->op_raw = opts->op_ints = NULL; in opts_parse()
135 opts->op_cmdargs = fn_list_new(NULL); in opts_parse()
140 return (opts); in opts_parse()
146 opts_setcmdarg(opts, ptr); in opts_parse()
180 (void) opts_set(opts, info->oi_o, ""); in opts_parse()
190 opts_set(opts, info->oi_o, ptr); in opts_parse()
195 return (opts); in opts_parse()
202 opts_free(struct opts *opts) in opts_free() argument
204 if (opts) { in opts_free()
205 lut_free(opts->op_raw, NULL); in opts_free()
206 lut_free(opts->op_ints, NULL); in opts_free()
207 fn_list_free(opts->op_cmdargs); in opts_free()
208 FREE(opts); in opts_free()
216 opts_set(struct opts *opts, const char *o, const char *optarg) in opts_set() argument
222 opts->op_raw = lut_add(opts->op_raw, o, (void *)optarg); in opts_set()
226 opts->op_ints = lut_add(opts->op_ints, o, (void *)rval); in opts_set()
234 opts_setcmdarg(struct opts *opts, const char *cmdarg) in opts_setcmdarg() argument
236 fn_list_adds(opts->op_cmdargs, cmdarg); in opts_setcmdarg()
243 opts_count(struct opts *opts, const char *options) in opts_count() argument
251 if (lut_lookup(opts->op_raw, lhs)) in opts_count()
261 opts_optarg(struct opts *opts, const char *o) in opts_optarg() argument
263 return ((char *)lut_lookup(opts->op_raw, o)); in opts_optarg()
270 opts_optarg_int(struct opts *opts, const char *o) in opts_optarg_int() argument
274 ret = (off_t *)lut_lookup(opts->op_ints, o); in opts_optarg_int()
284 opts_cmdargs(struct opts *opts) in opts_cmdargs() argument
286 return (opts->op_cmdargs); in opts_cmdargs()
300 struct opts *
301 opts_merge(struct opts *back, struct opts *front) in opts_merge()
303 struct opts *ret = MALLOC(sizeof (struct opts)); in opts_merge()
495 opts_print(struct opts *opts, FILE *stream, char *exclude) in opts_print() argument
504 lut_walk(opts->op_raw, printer, &pi); in opts_print()
506 fn_list_rewind(opts->op_cmdargs); in opts_print()
507 while ((fnp = fn_list_next(opts->op_cmdargs)) != NULL) { in opts_print()
531 struct opts *opts; in main() local
544 opts = opts_parse(NULL, argv, OPTF_CLI); in main()
547 opts_print(opts, stdout, NULL); in main()