diff options
author | David Robillard <d@drobilla.net> | 2024-09-29 19:35:32 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-10-12 14:07:10 -0400 |
commit | dc6747841ece7250ccdd964b19ac30f8c66889be (patch) | |
tree | 4306c61829dab11a40ed120feeef89da7fdd6a9e /src/jalv.c | |
parent | 6451316012d42ad5efad6fe41ec555d772f5c25d (diff) | |
download | jalv-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.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -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) { |