Implement special character escaping
This commit is contained in:
@@ -15,6 +15,7 @@ static bool is_special(char c)
|
||||
switch (c) {
|
||||
case '|':
|
||||
case '.':
|
||||
case '\\':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -26,6 +27,9 @@ static int parse_literal(const char *input, int rem, char *out)
|
||||
if (rem > 0 && !is_special(input[0])) {
|
||||
*out = input[0];
|
||||
return 1;
|
||||
} else if (rem > 1 && '\\' == input[0]) {
|
||||
*out = input[1];
|
||||
return 2;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user