diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/frontend.h | 3 | ||||
-rw-r--r-- | src/jalv_console.c | 6 | ||||
-rw-r--r-- | src/main.c | 9 |
4 files changed, 13 insertions, 8 deletions
@@ -11,6 +11,7 @@ jalv (1.6.9) unstable; urgency=medium * Fix Jack latency recomputation when plugin latency changes * Fix clashing command line options * Fix minor memory leaks + * Make help and version commands exit successfully * Only send control messages to designated lv2:control ports * Reduce Jack process callback overhead * Remove Gtk2 interface @@ -22,7 +23,7 @@ jalv (1.6.9) unstable; urgency=medium * Use fewer platform-specific APIs * Use portable zix filesystem API - -- David Robillard <d@drobilla.net> Fri, 22 Nov 2024 18:13:15 +0000 + -- David Robillard <d@drobilla.net> Mon, 25 Nov 2024 01:29:18 +0000 jalv (1.6.8) stable; urgency=medium diff --git a/src/frontend.h b/src/frontend.h index c798ea8..f18fb86 100644 --- a/src/frontend.h +++ b/src/frontend.h @@ -15,6 +15,9 @@ // Interface that must be implemented by UIs JALV_BEGIN_DECLS +/// Arbitrary return code for successful early exit (for --help and so on) +#define JALV_EARLY_EXIT_STATUS (-431) + /// Command-line arguments passed to an executable typedef struct { int* argc; ///< Pointer to `argc` like in `main` diff --git a/src/jalv_console.c b/src/jalv_console.c index 664d175..1a700fc 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -54,7 +54,7 @@ print_usage(const char* name, bool error) " -U URI Load the UI with the given URI\n" " -V Display version information and exit\n" " -x Exit if the requested JACK client name is taken\n"); - return error ? 1 : 0; + return error ? 1 : JALV_EARLY_EXIT_STATUS; } static int @@ -65,7 +65,7 @@ print_version(void) "License ISC: <https://spdx.org/licenses/ISC>.\n" "This is free software; you are free to change and redistribute it." "\nThere is NO WARRANTY, to the extent permitted by law.\n"); - return 1; + return JALV_EARLY_EXIT_STATUS; } static int @@ -116,7 +116,7 @@ jalv_frontend_init(JalvFrontendArgs* const args, JalvOptions* const opts) int a = 1; for (; a < argc && argv[a][0] == '-'; ++a) { if (argv[a][1] == 'h' || !strcmp(argv[a], "--help")) { - return print_usage(cmd, true); + return print_usage(cmd, false); } if (argv[a][1] == 'V' || !strcmp(argv[a], "--version")) { @@ -53,9 +53,10 @@ main(int argc, char** argv) jalv.backend = jalv_backend_allocate(); // Initialize application - if (jalv_open(&jalv, &argc, &argv)) { + const int orc = jalv_open(&jalv, &argc, &argv); + if (orc) { jalv_close(&jalv); - return EXIT_FAILURE; + return orc == JALV_EARLY_EXIT_STATUS ? EXIT_SUCCESS : EXIT_FAILURE; } // Set up signal handlers and activate audio processing @@ -70,7 +71,7 @@ main(int argc, char** argv) // Deactivate audio processing and tear down application jalv_deactivate(&jalv); - const int ret = jalv_close(&jalv); + const int crc = jalv_close(&jalv); jalv_backend_free(jalv.backend); - return ret; + return crc; } |