From d7954636ea75c1403fc1b4b9178516ea83ce27de Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 11 Feb 2013 15:52:24 -0500 Subject: [PATCH] examples/utils.c: make -i optional --- examples/utils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) { -- 2.11.0