diff options
author | Robin Gareus <robin@gareus.org> | 2015-01-14 02:24:38 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-01-14 02:24:38 +0100 |
commit | e586d0df139def91f7f55ca580b22ad29ca75e6c (patch) | |
tree | 1c0d0feed25e692183d1bc1ea57dd09f19099162 /libjack | |
parent | 268a22822bc2f89641b75d5ce1fac9a153e05c1b (diff) | |
download | jack1-e586d0df139def91f7f55ca580b22ad29ca75e6c.tar.gz |
support [unescaped] double-quotes in jackdrc
allow autostart of jackd on OSX where device-names can
contain spaces.
Diffstat (limited to 'libjack')
-rw-r--r-- | libjack/client.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/libjack/client.c b/libjack/client.c index 0b279e7..11f6a9a 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -932,17 +932,33 @@ _start_server (const char *server_name) } } - result = strcspn(arguments+pos, " "); - if (result == 0) { + /* skip whitespace */ + while (pos < strlen(arguments) && arguments[pos] && arguments[pos] == ' ') { + ++pos; + } + + if (pos >= strlen(arguments)) { break; } - argv[i] = (char*)malloc(result+1); - strncpy(argv[i], arguments+pos, result); - argv[i][result] = '\0'; + if (arguments[pos] == '\"') { + ++pos; + result = strcspn(arguments + pos, "\""); + } else { + result = strcspn(arguments + pos, " "); + } - pos += result+1; - ++i; + if (0 == result) { + break; + } + + argv[i] = (char*)malloc(result + 1); + strncpy(argv[i], arguments + pos, result); + argv[i][result] = '\0'; + pos += result + 1; + if (++i > 253) { + break; + } } argv[i] = 0; |