summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Gjengset <jon@thesquareplanet.com>2019-10-24 15:41:16 -0400
committerJon Gjengset <jon@thesquareplanet.com>2019-10-24 15:41:16 -0400
commit331b4aef50dc71b4e796993b0f2f91c37d6d5af3 (patch)
treefbef16d4aeaa4193db1a8707dc09bc57793c2f95
parentRemove debug prints (diff)
downloadmktrayicon-331b4aef50dc71b4e796993b0f2f91c37d6d5af3.tar.gz
mktrayicon-331b4aef50dc71b4e796993b0f2f91c37d6d5af3.tar.bz2
mktrayicon-331b4aef50dc71b4e796993b0f2f91c37d6d5af3.zip
Support both types of quotes
-rw-r--r--mktrayicon.c6
1 files 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] == '\\') {
bgstack15