From 331b4aef50dc71b4e796993b0f2f91c37d6d5af3 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Thu, 24 Oct 2019 15:41:16 -0400 Subject: Support both types of quotes --- mktrayicon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mktrayicon.c b/mktrayicon.c index f815bb7..becf60d 100644 --- a/mktrayicon.c +++ b/mktrayicon.c @@ -85,6 +85,7 @@ gpointer watch_fifo(gpointer argv) { char *buf = malloc(1024*sizeof(char)); char cmd; + char quote; char *param; char *tmp = malloc(1024*sizeof(char)); char *read; @@ -133,7 +134,7 @@ gpointer watch_fifo(gpointer argv) len = strlen(read); if (len < 3) { param = NULL; - } else if (*(read + 2) != '\'') { + } else if (*(read + 2) != '\'' && *(read + 2) != '"') { // unquoted string read += 2; len -= 2; @@ -151,6 +152,7 @@ gpointer watch_fifo(gpointer argv) strncpy(param, read, len+1); } else { // quoted string + quote = *(read+2); read += 3; len -= 3; *tmp = '\0'; @@ -170,7 +172,7 @@ gpointer watch_fifo(gpointer argv) } i -= 1; } - if (tmp[i] == '\'') { + if (tmp[i] == quote) { // maybe the end! // let's make sure it isn't escaped if (i >= 2 && tmp[i-2] == '\\') { -- cgit