aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-21 20:19:46 +0000
committerDavid Robillard <d@drobilla.net>2011-01-21 20:19:46 +0000
commitfbf024e07f80f547677f9d39e64dd4bdd4be99f3 (patch)
tree9a4127096a87216e9acd30a45a9ea29411a0f616 /src
parentfcdfb13091eee0066e7e45ba6fcae375202b6389 (diff)
downloadserd-fbf024e07f80f547677f9d39e64dd4bdd4be99f3.tar.gz
serd-fbf024e07f80f547677f9d39e64dd4bdd4be99f3.tar.bz2
serd-fbf024e07f80f547677f9d39e64dd4bdd4be99f3.zip
Fix command line argument handling when options are given.
git-svn-id: http://svn.drobilla.net/serd/trunk@27 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r--src/serdi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/serdi.c b/src/serdi.c
index d793d65a..b14df3d3 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -158,6 +158,7 @@ main(int argc, char** argv)
output_syntax = SERD_NTRIPLES;
} else {
fprintf(stderr, "unknown output format `%s'\n", argv[a]);
+ return 1;
}
} else {
fprintf(stderr, "unknown option `%s'\n", argv[a]);
@@ -165,7 +166,7 @@ main(int argc, char** argv)
}
}
- const uint8_t* in_filename = (const uint8_t*)argv[a];
+ const uint8_t* in_filename = (const uint8_t*)argv[a++];
if (!in_fd && serd_uri_string_has_scheme(in_filename)) {
// Input is an absolute URI, ensure it's a file: URI and chop scheme
@@ -181,8 +182,8 @@ main(int argc, char** argv)
SerdString* base_uri_str = NULL;
SerdURI base_uri;
- if (argc > 2) { // Base URI given on command line
- const uint8_t* const in_base_uri = (const uint8_t*)argv[2];
+ if (a < argc) { // Base URI given on command line
+ const uint8_t* const in_base_uri = (const uint8_t*)argv[a++];
if (!serd_uri_parse((const uint8_t*)in_base_uri, &base_uri)) {
fprintf(stderr, "invalid base URI `%s'\n", argv[2]);
return 1;