aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-09-29 19:35:32 -0400
committerDavid Robillard <d@drobilla.net>2024-10-12 14:07:10 -0400
commitdc6747841ece7250ccdd964b19ac30f8c66889be (patch)
tree4306c61829dab11a40ed120feeef89da7fdd6a9e /src/jalv.c
parent6451316012d42ad5efad6fe41ec555d772f5c25d (diff)
downloadjalv-dc6747841ece7250ccdd964b19ac30f8c66889be.tar.gz
jalv-dc6747841ece7250ccdd964b19ac30f8c66889be.tar.bz2
jalv-dc6747841ece7250ccdd964b19ac30f8c66889be.zip
Factor frontend command-line arguments into a struct
Diffstat (limited to 'src/jalv.c')
-rw-r--r--src/jalv.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 419f419..8b6c927 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -1121,8 +1121,9 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
#endif
// Parse command-line arguments
- int ret = 0;
- if ((ret = jalv_frontend_init(argc, argv, &jalv->opts))) {
+ JalvFrontendArgs args = {argc, argv};
+ const int ret = jalv_frontend_init(&args, &jalv->opts);
+ if (ret) {
jalv_close(jalv);
return ret;
}
@@ -1187,12 +1188,14 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv)
return -2;
}
plugin_uri = lilv_node_duplicate(lilv_state_get_plugin_uri(state));
- } else if (*argc > 1) {
- plugin_uri = lilv_new_uri(world, (*argv)[*argc - 1]);
- }
-
- if (!plugin_uri) {
+ } else if (*args.argc == 0) {
plugin_uri = jalv_frontend_select_plugin(jalv);
+ } else if (*args.argc == 1) {
+ plugin_uri = lilv_new_uri(world, (*args.argv)[0]);
+ } else {
+ jalv_log(JALV_LOG_ERR, "Unexpected trailing arguments\n");
+ jalv_close(jalv);
+ return -1;
}
if (!plugin_uri) {