aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-21 16:38:43 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-21 16:38:43 +0000
commit76f8576ee32f8c6bfcdfe0149dd2e4e1cb985f13 (patch)
treedee95a0439b1ac266ceb806daed706a9c65745c9
parent[w3m-dev 02877] some fixes for urimethodmap (diff)
downloadw3m-76f8576ee32f8c6bfcdfe0149dd2e4e1cb985f13.tar.gz
w3m-76f8576ee32f8c6bfcdfe0149dd2e4e1cb985f13.zip
[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>
-rw-r--r--ChangeLog9
-rw-r--r--regex.c6
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 252919f..c68aca2 100644
--- 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
@@ -2163,4 +2170,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.245 2002/01/21 15:56:12 ukai Exp $
+$Id: ChangeLog,v 1.246 2002/01/21 16:38:43 ukai Exp $
diff --git a/regex.c b/regex.c
index 7311eab..165e120 100644
--- a/regex.c
+++ b/regex.c
@@ -1,4 +1,4 @@
-/* $Id: regex.c,v 1.14 2002/01/21 15:56:13 ukai Exp $ */
+/* $Id: regex.c,v 1.15 2002/01/21 16:38:43 ukai Exp $ */
/*
* regex: Regular expression pattern match library
*
@@ -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++;
}