From: Andre Noll Date: Sun, 19 Jun 2016 20:16:41 +0000 (+0200) Subject: afh: Print help if no arguments are given. X-Git-Tag: v0.5.7~36 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=2b12fc963d15219721dd23eb7947bf516f2ad574;p=paraslash.git afh: Print help if no arguments are given. Currently, if para_afh is invoked with no non-option arguments, the command fails with main: afh syntax error This message is not very helpful, so let's print the short help in this case, and exit successfully. --- diff --git a/afh.c b/afh.c index 195b3788..8975777b 100644 --- a/afh.c +++ b/afh.c @@ -169,7 +169,7 @@ __noreturn static void print_help_and_die(void) */ int main(int argc, char **argv) { - int i, ret, audio_format_num, fd; + int i, ret = 0, audio_format_num, fd; void *audio_file_data; size_t audio_file_size; struct afh_info afhi; @@ -177,12 +177,9 @@ int main(int argc, char **argv) afh_cmdline_parser(argc, argv, &conf); loglevel = get_loglevel_by_name(conf.loglevel_arg); version_handle_flag("afh", conf.version_given); - if (conf.help_given || conf.detailed_help_given) + if (conf.help_given || conf.detailed_help_given || conf.inputs_num == 0) print_help_and_die(); afh_init(); - ret = -E_AFH_SYNTAX; - if (conf.inputs_num == 0) - goto out; for (i = 0; i < conf.inputs_num; i++) { int ret2; ret = mmap_full_file(conf.inputs[i], O_RDONLY, &audio_file_data,