diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-08-29 07:03:24 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-09-04 13:12:00 +0200 |
commit | dad09ff93f5df1ec987493f404d43cd16991e992 (patch) | |
tree | d69e680344af9464ab4f6f3e37b974ba9430bbd3 /cmdutils.c | |
parent | 346ea9e22240b4442f479518f6c3b40c9bec9487 (diff) | |
download | ffmpeg-dad09ff93f5df1ec987493f404d43cd16991e992.tar.gz |
cmdutils: move exit_program() declaration to cmdutils from avconv
Allows cmdutils to call each tool's own cleanup function.
Diffstat (limited to 'cmdutils.c')
-rw-r--r-- | cmdutils.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cmdutils.c b/cmdutils.c index a6402af596..a86c55bc6d 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -92,7 +92,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do else return d; fprintf(stderr, error, context, numstr, min, max); - exit(1); + exit_program(1); + return 0; } int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration) @@ -101,7 +102,7 @@ int64_t parse_time_or_die(const char *context, const char *timestr, int is_durat if (av_parse_time(&us, timestr, is_duration) < 0) { fprintf(stderr, "Invalid %s specification for %s: %s\n", is_duration ? "duration" : "date", context, timestr); - exit(1); + exit_program(1); } return us; } @@ -237,14 +238,14 @@ void parse_options(int argc, char **argv, const OptionDef *options, if (!po->name) { unknown_opt: fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt); - exit(1); + exit_program(1); } arg = NULL; if (po->flags & HAS_ARG) { arg = argv[optindex++]; if (!arg) { fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt); - exit(1); + exit_program(1); } } if (po->flags & OPT_STRING) { @@ -262,11 +263,11 @@ unknown_opt: } else if (po->u.func_arg) { if (po->u.func_arg(opt, arg) < 0) { fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt); - exit(1); + exit_program(1); } } if(po->flags & OPT_EXIT) - exit(0); + exit_program(0); } else { if (parse_arg_function) parse_arg_function(opt); @@ -336,7 +337,7 @@ int opt_loglevel(const char *opt, const char *arg) "Possible levels are numbers or:\n", arg); for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) fprintf(stderr, "\"%s\"\n", log_levels[i].name); - exit(1); + exit_program(1); } av_log_set_level(level); return 0; |