summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-02-09 21:10:09 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-02-09 21:10:09 +0100
commit078beeeaae30503620d0c9266bb8fd9ce3e08f1f (patch)
tree9441e34998fe02bcfcafe7e524d568c625f9193c /src
parentb0bd5ee468aa566ff22e30f6b36fc9eef5b60524 (diff)
parse_options_from_string: only leave quote if start and end character match
Closes #381
Diffstat (limited to 'src')
-rw-r--r--src/options.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/options.c b/src/options.c
index 837d7a8..bf5c67c 100644
--- a/src/options.c
+++ b/src/options.c
@@ -214,7 +214,7 @@ static void feh_parse_options_from_string(char *opts)
char *s;
char *t;
char last = 0;
- int inquote = 0;
+ char inquote = 0;
int i = 0;
/* So we don't reinvent the wheel (not again, anyway), we use the
@@ -229,7 +229,7 @@ static void feh_parse_options_from_string(char *opts)
eprintf(PACKAGE " does not support more than 64 words per "
"theme definition.\n Please shorten your lines.");
- if ((*t == ' ') && !(inquote)) {
+ if ((*t == ' ') && !inquote) {
*t = '\0';
num++;
@@ -240,8 +240,10 @@ static void feh_parse_options_from_string(char *opts)
list[num - 1] = feh_string_normalize(s);
break;
- } else if (((*t == '\"') || (*t == '\'')) && last != '\\')
- inquote = !(inquote);
+ } else if ((*t == inquote) && (last != '\\')) {
+ inquote = 0;
+ } else if (((*t == '\"') || (*t == '\'')) && (last != '\\') && !inquote)
+ inquote = *t;
last = *t;
}