From: Paul Brossier Date: Mon, 11 Feb 2013 20:52:24 +0000 (-0500) Subject: examples/utils.c: make -i optional X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d7954636ea75c1403fc1b4b9178516ea83ce27de;p=aubio.git examples/utils.c: make -i optional --- diff --git a/examples/utils.c b/examples/utils.c index 246d9b43..2c0bacbc 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -174,6 +174,18 @@ parse_args (int argc, char **argv) } while (next_option != -1); + if ( source_uri == NULL ) { + if (argc - optind == 1) { + source_uri = argv[optind]; + } else if ( argc - optind > 1 ) { + errmsg ("Error: too many non-option arguments `%s'\n", argv[argc - 1]); + usage ( stderr, 1 ); + } + } else if ( argc - optind > 0 ) { + errmsg ("Error: extra non-option argument %s\n", argv[optind]); + usage ( stderr, 1 ); + } + if (source_uri != NULL) { debug ("Input file : %s\n", source_uri); } else if (source_uri != NULL && sink_uri != NULL) {