commit e9bee96a74588a9fd4248737eb44ec1e570844c0
parent 940f160269193fc7255563419827ec0cafaeb67f
Author: ukai <ukai>
Date: Mon, 21 Jan 2002 16:38:43 +0000
[w3m-dev 02878] fix regexp [-...], [...-], []...]
* regexp.c (newRegex0): if first char is `-' or ']' after '[',
it isn't meta char.
if last char in [..] is `-', it isn't meta char.
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,10 @@
+2002-01-22 Fumitoshi UKAI <ukai@debian.or.jp>
+
+ * [w3m-dev 02878] fix regexp [-...], [...-], []...]
+ * regexp.c (newRegex0): if first char is `-' or ']' after '[',
+ it isn't meta char.
+ if last char in [..] is `-', it isn't meta char.
+
2002-01-22 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 02877] some fixes for urimethodmap
diff --git a/regex.c b/regex.c
@@ -150,6 +150,8 @@ newRegex0(char **ex, int igncase, Regex *regex, char **msg, int level)
}
else
m = RE_WHICH;
+ if (*p == '-' || *p == ']')
+ *(st_ptr++) = (unsigned char)*(p++);
while (*p != ']') {
if (*p == '\\') {
p++;
@@ -162,7 +164,7 @@ newRegex0(char **ex, int igncase, Regex *regex, char **msg, int level)
#endif
*(st_ptr++) = (unsigned char)*(p++);
}
- else if (*p == '-') {
+ else if (*p == '-' && *(p+1) != ']') {
*(st_ptr++) = RE_WHICH_RANGE;
p++;
}