* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
- * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
* commands_parser.c: hand-written parser to parse commands (commands are what
* you bind on keys and what you can send to i3 using the IPC interface, like
if (**walk == '"') {
beginning++;
(*walk)++;
- while (**walk != '\0' && (**walk != '"' || *(*walk - 1) == '\\'))
- (*walk)++;
+ for (; **walk != '\0' && **walk != '"'; (*walk)++)
+ if (**walk == '\\' && *(*walk + 1) != '\0')
+ (*walk)++;
} else {
if (!as_word) {
/* For a string (starting with 's'), the delimiters are
for (inpos = 0, outpos = 0;
inpos < (*walk - beginning);
inpos++, outpos++) {
- /* We only handle escaped double quotes to not break
- * backwards compatibility with people using \w in
- * regular expressions etc. */
- if (beginning[inpos] == '\\' && beginning[inpos + 1] == '"')
+ /* We only handle escaped double quotes and backslashes to not break
+ * backwards compatibility with people using \w in regular expressions
+ * etc. */
+ if (beginning[inpos] == '\\' && (beginning[inpos + 1] == '"' || beginning[inpos + 1] == '\\'))
inpos++;
str[outpos] = beginning[inpos];
}