summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2004-11-15 08:32:38 +0000
committerPaolo Bonzini <bonzini@gnu.org>2008-01-09 16:10:53 +0100
commit7f53c1c16e7654427dc884e528f5e2d201c15fc5 (patch)
tree6b93c7428c98ab288a85522223bf2c851ce128c0
parentfd8f5daad7b858955182827b44205a862376667b (diff)
downloadsed-7f53c1c16e7654427dc884e528f5e2d201c15fc5.tar.gz
fix \l and \u in a multi-byte configuration
2004-11-15 Paolo Bonzini <bonzini@gnu.org> * sed/execute.c (str_append_modified): Copy the first character when using \l or \u in a multi-byte configuration. Use WCRTOMB instead of wcrtomb. * sed/sed.h (WCRTOMB): New. git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-19
-rw-r--r--ChangeLog11
-rw-r--r--sed/execute.c4
-rw-r--r--sed/sed.h8
3 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 979e9cf..13c8660 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-2004-11-11 Paolo Bonzini <bonzini@gnu
+2004-11-15 Paolo Bonzini <bonzini@gnu.org>
+
+ * sed/execute.c (str_append_modified): Copy the first character
+ when using \l or \u in a multi-byte configuration. Use
+ WCRTOMB instead of wcrtomb.
+ * sed/sed.h (WCRTOMB): New.
+
+2004-11-11 Paolo Bonzini <bonzini@gnu.org>
* tst-rxspecer.c: Do not mix instructions and
declarations.
@@ -6,7 +13,7 @@
gettext, to avoid breakage under Solaris.
* sed/sed.c: do not include locale.h.
-2004-11-03 Paolo Bonzini <bonzini@gnu
+2004-11-03 Paolo Bonzini <bonzini@gnu.org>
* bug-regex11.c: Improve portability.
* bug-regex12.c: Improve portability.
diff --git a/sed/execute.c b/sed/execute.c
index 005a063..2249a24 100644
--- a/sed/execute.c
+++ b/sed/execute.c
@@ -313,6 +313,8 @@ str_append_modified(to, string, length, type)
type &= ~(REPL_LOWERCASE_FIRST | REPL_UPPERCASE_FIRST);
if (type == REPL_ASIS)
{
+ n = WCRTOMB (to->active + to->length, wc, &to->mbstate);
+ to->length += n;
str_append(to, string, length);
return;
}
@@ -324,7 +326,7 @@ str_append_modified(to, string, length, type)
wc = towlower(wc);
/* Copy the new wide character to the end of the string. */
- n = wcrtomb (to->active + to->length, wc, &to->mbstate);
+ n = WCRTOMB (to->active + to->length, wc, &to->mbstate);
to->length += n;
if (n == -1)
{
diff --git a/sed/sed.h b/sed/sed.h
index 01969d9..91587a9 100644
--- a/sed/sed.h
+++ b/sed/sed.h
@@ -233,9 +233,17 @@ extern int mb_cur_max;
(mb_cur_max == 1 ? \
(*(pwc) = btowc (*(unsigned char *) (s)), 1) : \
mbrtowc ((pwc), (s), (n), (ps)))
+
+#define WCRTOMB(s, wc, ps) \
+ (mb_cur_max == 1 ? \
+ (*(s) = wctob ((wint_t) (wc)), 1) : \
+ wcrtomb ((s), (wc), (ps)))
#else
#define MBRTOWC(pwc, s, n, ps) \
mbrtowc ((pwc), (s), (n), (ps))
+
+#define WCRTOMB(s, wc, ps) \
+ wcrtomb ((s), (wc), (ps))
#endif
#define MBRLEN(s, n, ps) \