If there are two consecutive backslashes, skip past both so the
second is not mistakenly treated as an escape character.
This is consistent with how escaped backslashes are treated
in ex_substitute() and global(). From Bosco G. G.
-/* $OpenBSD: search.c,v 1.14 2016/08/14 21:47:16 guenther Exp $ */
+/* $OpenBSD: search.c,v 1.15 2022/12/10 16:06:18 millert Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
++p;
break;
}
- if (plen > 1 && p[0] == '\\' && p[1] == delim) {
- ++p;
- --plen;
+ if (plen > 1 && p[0] == '\\') {
+ if (p[1] == delim) {
+ ++p;
+ --plen;
+ } else if (p[1] == '\\') {
+ *t++ = *p++;
+ --plen;
+ }
}
}
if (epp != NULL)