[cli] To print version info to stdout when everything is ok.

This commit is contained in:
Joose Sainio 2022-05-05 13:28:50 +03:00
parent c8539a3701
commit feb8a4d2e3
3 changed files with 6 additions and 5 deletions

View file

@ -391,9 +391,9 @@ void print_usage(void)
}
void print_version(void)
void print_version(bool to_stderr)
{
fprintf(stdout,
fprintf(to_stderr ? stderr : stdout,
"uvg266 " VERSION_STRING " [" UVG_COMPILER_STRING "] " UVG_COMPILE_DATE "\n");
}

View file

@ -65,7 +65,7 @@ cmdline_opts_t* cmdline_opts_parse(const uvg_api *api, int argc, char *argv[]);
void cmdline_opts_free(const uvg_api *api, cmdline_opts_t *opts);
void print_usage(void);
void print_version(void);
void print_version(bool);
void print_help(void);
void print_frame_info(const uvg_frame_info *const info,
const double frame_psnr[3],

View file

@ -479,23 +479,24 @@ int main(int argc, char *argv[])
const uvg_api * const api = uvg_api_get(8);
print_version();
opts = cmdline_opts_parse(api, argc, argv);
// If problem with command line options, print banner and shutdown.
if (!opts) {
print_version(false);
print_usage();
goto exit_failure;
}
if (opts->version) {
print_version();
print_version(false);
goto done;
}
if (opts->help) {
print_help();
goto done;
}
print_version(true);
input = open_input_file(opts->input);
if (input == NULL) {