diff options
author | David Robillard <d@drobilla.net> | 2013-12-25 19:11:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-12-25 19:11:30 +0000 |
commit | e0b7e4f26111f0e5dddf6a6b5f2285b39e1e0368 (patch) | |
tree | 81eb9322074a3af06bddd354150d0933f83e3178 /src/jalv_console.c | |
parent | d8f7e5c92f7e03bfd28cb137ce40536f9f36818f (diff) | |
download | jalv-e0b7e4f26111f0e5dddf6a6b5f2285b39e1e0368.tar.gz jalv-e0b7e4f26111f0e5dddf6a6b5f2285b39e1e0368.tar.bz2 jalv-e0b7e4f26111f0e5dddf6a6b5f2285b39e1e0368.zip |
Add -c option for setting controls from the command line (#816).
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5202 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/jalv_console.c')
-rw-r--r-- | src/jalv_console.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/jalv_console.c b/src/jalv_console.c index 0fb3125..b75bb3c 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -53,7 +53,11 @@ jalv_ui_port_event(Jalv* jalv, int jalv_init(int* argc, char*** argv, JalvOptions* opts) { - int a = 1; + opts->controls = malloc(sizeof(char*)); + opts->controls[0] = NULL; + + int n_controls = 0; + int a = 1; for (; a < *argc && (*argv)[a][0] == '-'; ++a) { if ((*argv)[a][1] == 'h') { return print_usage((*argv)[0], true); @@ -75,6 +79,15 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts) return 1; } opts->buffer_size = atoi((*argv)[a]); + } else if ((*argv)[a][1] == 'c') { + if (++a == *argc) { + fprintf(stderr, "Missing argument for -c\n"); + return 1; + } + opts->controls = realloc(opts->controls, + (++n_controls + 1) * sizeof(char*)); + opts->controls[n_controls - 1] = (*argv)[a]; + opts->controls[n_controls] = NULL; } else if ((*argv)[a][1] == 'd') { opts->dump = true; } else { |