basic/extract-word: allow escape character to be escaped
With EXTRACT_UNESCAPE_SEPARATORS, backslash is used to escape the separator. But it wasn't possible to insert the backslash itself. Let's allow this and add test.
This commit is contained in:
@@ -102,8 +102,8 @@ int extract_first_word(const char **p, char **ret, const char *separators, Extra
|
||||
else
|
||||
sz += utf8_encode_unichar(s + sz, u);
|
||||
} else if ((flags & EXTRACT_UNESCAPE_SEPARATORS) &&
|
||||
strchr(separators, **p))
|
||||
/* An escaped separator char */
|
||||
(strchr(separators, **p) || **p == '\\'))
|
||||
/* An escaped separator char or the escape char itself */
|
||||
s[sz++] = c;
|
||||
else if (flags & EXTRACT_CUNESCAPE_RELAX) {
|
||||
s[sz++] = '\\';
|
||||
|
||||
Reference in New Issue
Block a user