mp_printf_append
mp_vprintf_append
# ucw/opt-internal.h
-opt_failure
opt_precompute
# ucw/opt.h
+opt_failure
opt_handle_config
opt_handle_set
opt_handle_dumpconfig
#define _UCW_OPT_INTERNAL_H
#ifdef CONFIG_UCW_CLEAN_ABI
-#define opt_failure ucw_opt_failure
#define opt_precompute ucw_opt_precompute
#endif
short count;
};
-void opt_failure(const char * mesg, ...) FORMAT_CHECK(printf,1,2) NONRET;
void opt_precompute(struct opt_precomputed *opt, struct opt_item *item);
#endif
bool stop_parsing;
};
-// FIXME: Make public?
void opt_failure(const char * mesg, ...) {
va_list args;
va_start(args, mesg);
vfprintf(stderr, mesg, args);
- fprintf(stderr, "\n");
- opt_usage();
+ fprintf(stderr, "\nRun with --help for more information.\n");
exit(OPT_EXIT_BAD_ARGS);
}
#define cf_def_file ucw_cf_def_file
#define cf_env_file ucw_cf_env_file
#define opt_conf_hook_internal ucw_opt_conf_hook_internal
+#define opt_failure ucw_opt_failure
#define opt_handle_config ucw_opt_handle_config
#define opt_handle_dumpconfig ucw_opt_handle_dumpconfig
#define opt_handle_help ucw_opt_handle_help
#define OPT_HOOK_AFTER_VALUE 0x4 /** Call after value parsing **/
#define OPT_HOOK_FINAL 0x8 /** Call just before opt_parse() returns **/
+void opt_failure(const char * mesg, ...) FORMAT_CHECK(printf,1,2) NONRET;
void opt_help(const struct opt_section * sec);
void opt_handle_help(struct opt_item * opt, const char * value, void * data);
-// FIXME: Should this be public?
-static inline void opt_usage(void) {
- fprintf(stderr, "Run with argument --help for more information.\n");
-}
-
/**
* Parse all arguments, given in a NULL-terminated array of strings.
*
Run: ../obj/ucw/opt-test 2>&1 1>/dev/null
Exit: 2
Out: Required option -t/--temperature not found.
- Run with argument --help for more information.
+ Run with --help for more information.
Name: Opt-2
Run: ../obj/ucw/opt-test -t95C -w640 -gG darjeeling
Run: ../obj/ucw/opt-test -ghx 2>&1 1>/dev/null
Exit: 2
Out: Multiple switches: -h
- Run with argument --help for more information.
+ Run with --help for more information.
Name: Opt-6
Run: ../obj/ucw/opt-test -t120F -w4 -b15 -he -- --puerh darjeeling earl-grey
Run: ../obj/ucw/opt-test -h -SX.Y=Z 2>&1 1>/dev/null
Exit: 2
Out: Config options must stand before other options.
- Run with argument --help for more information.
+ Run with --help for more information.
Name: Opt-Hook-1
Run: ../obj/ucw/opt-test -Ht 95C -w640 -gG darjeeling