commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. rel-2_1-21-g08b3da3


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-21-g08b3da3
Date: Tue, 29 Dec 2009 19:30:22 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=08b3da3417d572cd3567196c8ccb04ec7f068d8d

The branch, master has been updated
       via  08b3da3417d572cd3567196c8ccb04ec7f068d8d (commit)
       via  1428bd4560d2e740c4941a0f8121c674c2ee7500 (commit)
      from  d39f4c2db3ea8bc387cde7dcc2825598aa166ff6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 08b3da3417d572cd3567196c8ccb04ec7f068d8d
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Dec 29 17:36:29 2009 +0200

    Version 2.1.90
    
    * configure.ac, NEWS: Set version number 2.1.90
    
    * testsuite/lib/mailutils.exp: Quote arguments to the --set option.
    (mu_exec): escape backslashes and double-quotes in $sw.
    * frm/testsuite/frm/test.exp: Quote arguments to the --set option.
    * mail/testsuite/lib/mail.exp: Likewise.
    * mailbox/testsuite/lib/mailbox.exp: Likewise.
    * messages/testsuite/messages/test.exp: Likewise.
    * sieve/testsuite/sieve/action.exp: Likewise.
    * readmsg/testsuite/readmsg/test.exp: Remove extra backslashes,
    not needed due to the changes in mu_exec

commit 1428bd4560d2e740c4941a0f8121c674c2ee7500
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Dec 29 17:34:59 2009 +0200

    Support for multibyte-encoding in MH.
    
    * gnulib.modules (mbchar, mbiter, mbslen): New modules.
    * mh/mh.h (mh_charset): New function.
    * mh/mh_format.c (DFLWIDTH): New macro.
    (mbsubstrlen, mbsnlen): New functions.
    (compress_ws): Handle multibyte strings.
    (put_string): Use number of characters, not
    octets, to update ind.
    (print_hdr_segment): Handle multibyte strings.
    (print_simple_segment, print_fmt_string): Likewise.
    (reset_fmt_defaults): Restore default WS compression.
    (mh_format): Set LC_TYPE based on the settings of
    profile variables Charset and LC_BASE (new variable).
    * mh/mh_init.c (mh_charset): New function.
    (mh_decode_2047): Use mh_charset.

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                 |    7 +-
 configure.ac                         |    2 +-
 frm/testsuite/frm/test.exp           |    2 +-
 gnulib.modules                       |    3 +
 mail/testsuite/lib/mail.exp          |    2 +-
 mailbox/testsuite/lib/mailbox.exp    |    2 +-
 messages/testsuite/messages/test.exp |    2 +-
 mh/mh.h                              |    1 +
 mh/mh_format.c                       |  214 ++++++++++++++++++++++++----------
 mh/mh_init.c                         |   16 ++-
 readmsg/testsuite/readmsg/test.exp   |    4 +-
 sieve/testsuite/sieve/action.exp     |    2 +-
 testsuite/lib/mailutils.exp          |    8 +-
 13 files changed, 183 insertions(+), 82 deletions(-)

diff --git a/NEWS b/NEWS
index c25a1ef..a4d939c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2009-09-10
+GNU mailutils NEWS -- history of user-visible changes. 2009-12-29
 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 
 2008, 2009 Free Software Foundation, Inc.
 See the end of file for copying conditions.
@@ -6,6 +6,11 @@ See the end of file for copying conditions.
 Please send mailutils bug reports to <address@hidden>.
 
 
+Version 2.1.90 (Git)
+
+See git log.
+
+
 Version 2.1 "Ten Years Later" - 2009-09-10:
 
 This release marks the 10 years anniversary of GNU Mailutils.
diff --git a/configure.ac b/configure.ac
index e6151ce..fe84ac5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ dnl with GNU Mailutils; if not, write to the Free Software 
Foundation,
 dnl Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 AC_PREREQ(2.63)
-AC_INIT([GNU Mailutils], [2.1], address@hidden, [mailutils])
+AC_INIT([GNU Mailutils], [2.1.90], address@hidden, [mailutils])
 AC_CONFIG_SRCDIR([mailbox/mailbox.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([gnits 1.11 dist-bzip2 dist-lzma dist-xz std-options 
silent-rules])
diff --git a/frm/testsuite/frm/test.exp b/frm/testsuite/frm/test.exp
index 72b8015..a12e4aa 100644
--- a/frm/testsuite/frm/test.exp
+++ b/frm/testsuite/frm/test.exp
@@ -51,7 +51,7 @@ mu_exec -retcode 1 -message "frm -qS" -arg -qS \
 mu_exec -retcode 1 -arg -q -message "frm -q"  \
 "There are messages in that folder."
 
-mu_exec -retcode 1 -arg "--set mailbox.folder=$MU_SPOOL_DIR" -arg +mbox 
-message "frm +mbox" \
+mu_exec -retcode 1 -arg "--set mailbox.folder=\"'$MU_SPOOL_DIR'\"" -arg +mbox 
-message "frm +mbox" \
 "Sergey Poznyakoff\tMBOX"
 
 mu_exec -arg -q -arg %nonexistent -retcode 2 -message "frm -q %nonexistent" \
diff --git a/gnulib.modules b/gnulib.modules
index 37093a7..4368cf7 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -14,6 +14,9 @@ gitlog-to-changelog
 intprops
 inttostr
 malloc
+mbchar
+mbiter
+mbslen
 mbswidth
 obstack
 realloc
diff --git a/mail/testsuite/lib/mail.exp b/mail/testsuite/lib/mail.exp
index 6990161..bdae899 100644
--- a/mail/testsuite/lib/mail.exp
+++ b/mail/testsuite/lib/mail.exp
@@ -64,7 +64,7 @@ proc default_mail_start {args} {
     
     if [info exists host_board] {
        if [board_info $host_board exists top_srcdir] {
-           append sw " --set mailbox.mail-spool=[board_info $host_board 
top_srcdir]/mail/testsuite/spool"
+           append sw " --set \"mailbox.mail-spool='[board_info $host_board 
top_srcdir]/mail/testsuite/spool'\""
        }
     }
 
diff --git a/mailbox/testsuite/lib/mailbox.exp 
b/mailbox/testsuite/lib/mailbox.exp
index 2c23d16..c836fa1 100644
--- a/mailbox/testsuite/lib/mailbox.exp
+++ b/mailbox/testsuite/lib/mailbox.exp
@@ -31,7 +31,7 @@ proc mailbox_run {args} {
        if {"$a" == "-mail-spool"} {
            if [info exists host_board] {
                if [board_info $host_board exists top_srcdir] {
-                   append sw "--set mailbox.mail-spool=[board_info $host_board 
top_srcdir]/mail/testsuite/spool"
+                   append sw "--set mailbox.mail-spool=\"'[board_info 
$host_board top_srcdir]/mail/testsuite/spool'\""
                }
            }
            if {![info exists init_spool]} {
diff --git a/messages/testsuite/messages/test.exp 
b/messages/testsuite/messages/test.exp
index 75758ea..89461ef 100644
--- a/messages/testsuite/messages/test.exp
+++ b/messages/testsuite/messages/test.exp
@@ -31,7 +31,7 @@ mu_exec -message "messages" \
 mu_exec -message "messages -q" -arg -q "5"
 
 mu_exec -message "messages +teaparty.mbox" \
-     -arg "--set mailbox.folder=$MU_SPOOL_DIR" -arg +teaparty.mbox \
+     -arg "--set mailbox.folder=\"'$MU_SPOOL_DIR'\"" -arg +teaparty.mbox \
 "Number of messages in $MU_SPOOL_DIR/teaparty.mbox: 95"
 
 #end of test.exp
diff --git a/mh/mh.h b/mh/mh.h
index 0ccaeac..0f9c600 100644
--- a/mh/mh.h
+++ b/mh/mh.h
@@ -334,6 +334,7 @@ char *mh_create_message_id (int);
 int mh_whom (const char *filename, int check);
 void mh_set_reply_regex (const char *str);
 int mh_decode_2047 (char *text, char **decoded_text);
+const char *mh_charset (const char *);
 
 int mh_alias_read (char *name, int fail);
 int mh_alias_get (const char *name, mu_list_t *return_list);
diff --git a/mh/mh_format.c b/mh/mh_format.c
index f7b18f1..f7980f4 100644
--- a/mh/mh_format.c
+++ b/mh/mh_format.c
@@ -26,9 +26,15 @@
 #ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif
+#include <string.h>
+#include "mbiter.h"
+#include "mbchar.h"
+#include "mbswidth.h"
 
 static char *_get_builtin_name (mh_builtin_fp ptr);
 
+#define DFLWIDTH(mach) ((mach)->width - (mach)->ind)
+
 /* Functions for handling string objects. */
 
 void
@@ -106,17 +112,53 @@ strobj_realloc (strobj_t *obj, size_t length)
     }
 }
 
-/* Compress whitespace in a string */
+/* Return the length (number of octets) of a substring of
+   string STR of length LEN, such that it contains NCOL
+   multibyte characters. */
+int
+mbsubstrlen (char *str, size_t len, size_t ncol)
+{
+  int ret = 0;
+  mbi_iterator_t iter;
+
+  if (ncol <= 0)
+    return 0;
+  
+  for (mbi_init (iter, str, len);
+       ncol && mbi_avail (iter);
+       ncol--, mbi_advance (iter))
+    ret += mb_len (mbi_cur (iter));
+  return ret;
+}
+
+/* Return the number of multibyte characters in the first LEN bytes
+   of character string STRING.  */
+size_t
+mbsnlen (char *str, size_t len)
+{
+  int ret = 0;
+  mbi_iterator_t iter;
+
+  for (mbi_init (iter, str, len); mbi_avail (iter); mbi_advance (iter))
+    ret++;
+  return ret;
+}
+
+/* Compress whitespace in a string (multi-byte) */
 static void
-compress_ws (char *str, size_t *size)
+compress_ws (char *str, size_t *psize)
 {
   unsigned char *p, *q;
-  size_t len = *size;
+  size_t size = *psize;
+  mbi_iterator_t iter;
   int space = 0;
-
-  for (p = q = (unsigned char*) str; len; len--, q++)
+  
+  for (p = q = (unsigned char*) str,
+        mbi_init (iter, str, size);
+       mbi_avail (iter);
+       mbi_advance (iter))
     {
-      if (isspace (*q))
+      if (mb_isspace (mbi_cur (iter)))
        {
          if (!space)
            *p++ = ' ';
@@ -126,11 +168,15 @@ compress_ws (char *str, size_t *size)
       else if (space)
        space = 0;
 
-      if (isprint (*q))
-       *p++ = *q;
+      if (mb_isprint (mbi_cur (iter)))
+       {
+         size_t len = mb_len (mbi_cur (iter));
+         memcpy (p, mb_ptr (mbi_cur (iter)), len);
+         p += len;
+       }
     }
   *p = 0;
-  *size = p - (unsigned char*) str;
+  *psize = p - (unsigned char*) str;
 }
 
 #define COMPRESS_WS(mach, str, size)           \
@@ -145,8 +191,9 @@ static void
 put_string (struct mh_machine *mach, char *str, int len)
 {
   if (len == 0)
-    len = strlen (str);
+    return;
   obstack_grow (&mach->stk, str, len);
+  len = mbsnwidth (str, len, 0);
   mach->ind += len;
 }
 
@@ -156,40 +203,46 @@ print_hdr_segment (struct mh_machine *mach, char *str, 
size_t len)
   if (!len)
     len = strlen (str);
 
-  if (len < mach->width)
+  if (mbsnlen (str, len) < mach->width)
     put_string (mach, str, len);
   else
     {
-      char *endp = str + len;
-      
-      while (str < endp)
+      while (1)
        {
-         size_t rest;
-         char *p;
-         size_t size;
+         mbi_iterator_t iter;
+         size_t rest = DFLWIDTH (mach);
+         size_t width = mbsnlen (str, len);
+         size_t off, size;
          
-         size = endp - str;
-         rest = mach->width - mach->ind;
-         if (size < rest)
+         if (width <= rest)
            {
-             put_string (mach, str, size);
+             put_string (mach, str, len);
              break;
            }
-         
-         for (p = str + rest - 1; p > str && !isspace (*p); p--)
-           ;
 
-         if (p > str)
+         size = off = 0;
+         for (mbi_init (iter, str, len);
+              mbi_avail (iter);
+              mbi_advance (iter))
            {
-             put_string (mach, str, p - str);
-             put_string (mach, "\n\t", 0);
+             if (mb_isspace (mbi_cur (iter)))
+               off = size;
+             size += mb_len (mbi_cur (iter));
+           }
+
+         if (off > 0)
+           {
+             put_string (mach, str, off);
+             put_string (mach, "\n        ", 9);
              mach->ind = 8;
-             str = p;
+             str += off;
+             len -= off;
            }
          else
            {
-             put_string (mach, str, size);
-             str += len;
+             size = mbsubstrlen (str, len, rest);
+             put_string (mach, str, len);
+             break;
            }
        }
     }
@@ -232,7 +285,7 @@ print_simple_segment (struct mh_machine *mach, size_t width,
   if (!width)
     width = mach->width;
 
-  rest = width - mach->ind;
+  rest = DFLWIDTH (mach);
   if (rest == 0)
     {
       if (len == 1 && str[0] == '\n')
@@ -240,10 +293,7 @@ print_simple_segment (struct mh_machine *mach, size_t 
width,
       return;
     }
   
-  if (len > rest)
-    len = rest;
-
-  put_string (mach, str, len);
+  put_string (mach, str, mbsubstrlen (str, len, rest));
 }
 
 static void
@@ -274,13 +324,21 @@ static void
 print_fmt_string (struct mh_machine *mach, size_t fmtwidth, char *str)
 {
   size_t len = strlen (str);
-  if (len > fmtwidth)
-    len = fmtwidth;
+  size_t width = mbslen (str);
+
+  if (fmtwidth && width > fmtwidth)
+    {
+      len = mbsubstrlen (str, len, fmtwidth);
+      width = fmtwidth;
+    }
+  else
+    len = mbsubstrlen (str, len, DFLWIDTH (mach));
+  
   put_string (mach, str, len);
 
-  if (fmtwidth > len)
+  if (fmtwidth > width)
     {
-      fmtwidth -= len;
+      fmtwidth -= width;
       mach->ind += fmtwidth;
       while (fmtwidth--)
        obstack_1grow (&mach->stk, ' ');
@@ -293,7 +351,7 @@ reset_fmt_defaults (struct mh_machine *mach)
   const char *p;
   
   mach->fmtflags = 0;
-  p = mh_global_profile_get ("Compress-WS", NULL);
+  p = mh_global_profile_get ("Compress-WS", "yes");
   if (p && (mu_c_strcasecmp (p, "yes") == 0
            || mu_c_strcasecmp (p, "true") == 0))
     mach->fmtflags |= MH_FMT_COMPWS;
@@ -409,6 +467,7 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t msgno,
 {
   struct mh_machine mach;
   char buf[64];
+  const char *charset = mh_global_profile_get ("Charset", NULL);
   
   memset (&mach, 0, sizeof (mach));
   mach.progsize = fmt->progsize;
@@ -421,13 +480,40 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t 
msgno,
   mach.pc = 1;
   obstack_init (&mach.stk);
   mu_list_create (&mach.addrlist);
-
+  
   reset_fmt_defaults (&mach);
+
+#if HAVE_SETLOCALE
+  if (charset && strcmp (charset, "auto"))
+    {
+      /* Try to set LC_CTYPE according to the value of Charset variable.
+        If Charset is `auto', there's no need to do anything, since it
+        is already set. Otherwise, we need to construct a valid locale
+        value with Charset as its codeset part. The problem is, what
+        language and territory to use for that locale.
+
+        Neither LANG nor any other environment variable is of any use,
+        because if it were, the user would have set "Charset: auto".
+        It would be logical to use 'C' or 'POSIX', but these do not
+        work with '.UTF-8'. So, in the absence of any viable alternative,
+        'en_US' is selected. This choice may be overridden by setting
+        the LC_BASE mh_profile variable to the desired base part.
+      */
+      const char *lc_base = mh_global_profile_get ("LC_BASE", "en_US");
+      char *locale = xmalloc (strlen (lc_base) + 1 + strlen (charset) + 1);
+      strcpy (locale, lc_base);
+      strcat (locale, ".");
+      strcat (locale, charset);
+      if (!setlocale (LC_CTYPE, locale))
+        mu_error (_("cannot set LC_CTYPE %s"), locale);
+      free (locale);
+    }
+#endif
   
-  while (!mach.stop)
+  while (!mach.stop && mach.ind < mach.width)
     {
       mh_opcode_t opcode;
-      switch (opcode = MHI_OPCODE(mach.prog[mach.pc++]))
+      switch (opcode = MHI_OPCODE (mach.prog[mach.pc++]))
        {
        case mhop_nop:
          break;
@@ -437,7 +523,7 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t msgno,
          break;
 
        case mhop_branch:
-         mach.pc += MHI_NUM(mach.prog[mach.pc]);
+         mach.pc += MHI_NUM (mach.prog[mach.pc]);
          break;
 
        case mhop_num_asgn:
@@ -449,27 +535,27 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t 
msgno,
          break;
          
        case mhop_num_arg:
-         mach.arg_num = MHI_NUM(mach.prog[mach.pc++]);
+         mach.arg_num = MHI_NUM (mach.prog[mach.pc++]);
          break;
          
        case mhop_str_arg:
          {
-           size_t skip = MHI_NUM(mach.prog[mach.pc++]);
-           strobj_set (&mach.arg_str, MHI_STR(mach.prog[mach.pc]));
+           size_t skip = MHI_NUM (mach.prog[mach.pc++]);
+           strobj_set (&mach.arg_str, MHI_STR (mach.prog[mach.pc]));
            mach.pc += skip;
          }
          break;
 
        case mhop_num_branch:
          if (!mach.arg_num)
-           mach.pc += MHI_NUM(mach.prog[mach.pc]);
+           mach.pc += MHI_NUM (mach.prog[mach.pc]);
          else
            mach.pc++;
          break;
 
        case mhop_str_branch:
          if (!*strobj_ptr (&mach.arg_str))
-           mach.pc += MHI_NUM(mach.prog[mach.pc]);
+           mach.pc += MHI_NUM (mach.prog[mach.pc]);
          else
            mach.pc++;
          break;
@@ -503,7 +589,7 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t msgno,
            mu_body_t body = NULL;
            mu_stream_t stream = NULL;
            size_t size = 0, off, str_off, nread;
-           size_t rest = mach.width - mach.ind;
+           size_t rest = DFLWIDTH (&mach);
 
            strobj_free (&mach.arg_str);
            mu_message_get_body (mach.message, &body);
@@ -564,7 +650,7 @@ mh_format (mh_format_t *fmt, mu_message_t msg, size_t msgno,
          break;
 
        case mhop_fmtspec:
-         mach.fmtflags = MHI_NUM(mach.prog[mach.pc++]);
+         mach.fmtflags = MHI_NUM (mach.prog[mach.pc++]);
          break;
 
        default:
@@ -615,7 +701,7 @@ mh_format_dump (mh_format_t *fmt)
       int num;
       
       printf ("% 4.4ld: ", (long) pc);
-      switch (opcode = MHI_OPCODE(prog[pc++]))
+      switch (opcode = MHI_OPCODE (prog[pc++]))
        {
        case mhop_nop:
          printf ("nop");
@@ -627,7 +713,7 @@ mh_format_dump (mh_format_t *fmt)
          break;
 
        case mhop_branch:
-         num = MHI_NUM(prog[pc++]);
+         num = MHI_NUM (prog[pc++]);
          printf ("branch %d, %lu",
                  num, (unsigned long) pc + num - 1);
          break;
@@ -641,14 +727,14 @@ mh_format_dump (mh_format_t *fmt)
          break;
          
        case mhop_num_arg:
-         num = MHI_NUM(prog[pc++]);
+         num = MHI_NUM (prog[pc++]);
          printf ("num_arg %d", num);
          break;
          
        case mhop_str_arg:
          {
-           size_t skip = MHI_NUM(prog[pc++]);
-           char *s = MHI_STR(prog[pc]);
+           size_t skip = MHI_NUM (prog[pc++]);
+           char *s = MHI_STR (prog[pc]);
            printf ("str_arg \"");
            for (; *s; s++)
              {
@@ -696,13 +782,13 @@ mh_format_dump (mh_format_t *fmt)
          break;
 
        case mhop_num_branch:
-         num = MHI_NUM(prog[pc++]);
+         num = MHI_NUM (prog[pc++]);
          printf ("num_branch %d, %lu",
                  num, (unsigned long) (pc + num - 1));
          break;
 
        case mhop_str_branch:
-         num = MHI_NUM(prog[pc++]);
+         num = MHI_NUM (prog[pc++]);
          printf ("str_branch %d, %lu",
                  num, (unsigned long) (pc + num - 1));
          break;
@@ -753,7 +839,7 @@ mh_format_dump (mh_format_t *fmt)
          {
            int space = 0;
            
-           num = MHI_NUM(prog[pc++]);
+           num = MHI_NUM (prog[pc++]);
            printf ("fmtspec: %#x, ", num);
            if (num & MH_FMT_RALIGN)
              {
@@ -840,7 +926,7 @@ builtin_width (struct mh_machine *mach)
 static void
 builtin_charleft (struct mh_machine *mach)
 {
-  mach->arg_num = mach->width - mach->ind;
+  mach->arg_num = DFLWIDTH (mach);
 }
 
 static void
@@ -1961,10 +2047,10 @@ mh_builtin_t builtin_tab[] = {
   { "comp",     builtin_comp,     mhtype_num,  mhtype_str,  MHA_OPTARG },
   { "compval",  builtin_compval,  mhtype_num,  mhtype_str },      
   { "trim",     builtin_trim,     mhtype_str,  mhtype_str,  MHA_OPTARG },
-  { "putstr",   builtin_putstr,   mhtype_none,  mhtype_str, MHA_OPTARG },
-  { "putstrf",  builtin_putstrf,  mhtype_none,  mhtype_str, MHA_OPTARG },
-  { "putnum",   builtin_putnum,   mhtype_none,  mhtype_num, MHA_OPTARG },
-  { "putnumf",  builtin_putnumf,  mhtype_none,  mhtype_num, MHA_OPTARG },
+  { "putstr",   builtin_putstr,   mhtype_none, mhtype_str,  MHA_OPTARG },
+  { "putstrf",  builtin_putstrf,  mhtype_none, mhtype_str,  MHA_OPTARG },
+  { "putnum",   builtin_putnum,   mhtype_none, mhtype_num,  MHA_OPTARG },
+  { "putnumf",  builtin_putnumf,  mhtype_none, mhtype_num,  MHA_OPTARG },
   { "sec",      builtin_sec,      mhtype_num,  mhtype_str },
   { "min",      builtin_min,      mhtype_num,  mhtype_str },
   { "hour",     builtin_hour,     mhtype_num,  mhtype_str },
diff --git a/mh/mh_init.c b/mh/mh_init.c
index 20cccda..eecae2c 100644
--- a/mh/mh_init.c
+++ b/mh/mh_init.c
@@ -870,17 +870,17 @@ mh_set_reply_regex (const char *str)
              err ? err : "");
 }
 
-int
-mh_decode_2047 (char *text, char **decoded_text)
+const char *
+mh_charset (const char *dfl)
 {
-  const char *charset = mh_global_profile_get ("Charset", NULL);
+  const char *charset = mh_global_profile_get ("Charset", dfl);
 
   if (!charset)
-    return 1;
+    return NULL;
   if (mu_c_strcasecmp (charset, "auto") == 0)
     {
       /* Try to deduce the charset from LC_ALL variable */
-
+      
       char *lc_all = getenv ("LC_ALL");
       if (lc_all)
        {
@@ -899,7 +899,13 @@ mh_decode_2047 (char *text, char **decoded_text)
          free (tmp);
        }
     }
+  return charset;
+}
 
+int
+mh_decode_2047 (char *text, char **decoded_text)
+{
+  const char *charset = mh_charset (NULL);
   if (!charset)
     return 1;
   
diff --git a/readmsg/testsuite/readmsg/test.exp 
b/readmsg/testsuite/readmsg/test.exp
index cc834d9..2492648 100644
--- a/readmsg/testsuite/readmsg/test.exp
+++ b/readmsg/testsuite/readmsg/test.exp
@@ -1,6 +1,6 @@
 # -*- tcl -*-
 # This file is part of Mailutils testsuite.
-# Copyright (C) 2002, 2007 Free Software Foundation
+# Copyright (C) 2002, 2007, 2009 Free Software Foundation
 #  
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ set env(FOLDER) $env(MAIL)
 
 mu_prepare_spools
 
-mu_exec -message "readmsg *" -arg "\\\\*" \
+mu_exec -message "readmsg *" -arg "\\*" \
 "Date: Fri, 28 Dec 2001 22:18:08 +0200"\
 "From: Foo Bar <address@hidden>"\
 "To: Bar <address@hidden>"\
diff --git a/sieve/testsuite/sieve/action.exp b/sieve/testsuite/sieve/action.exp
index faa82a3..dd6af96 100644
--- a/sieve/testsuite/sieve/action.exp
+++ b/sieve/testsuite/sieve/action.exp
@@ -37,7 +37,7 @@ sieve_test discard.sv -pattern\
 "DISCARD on msg uid 2: marking as deleted"\
 "DISCARD on msg uid 3: marking as deleted"
 
-sieve_test --set "mailbox.folder='$MU_SPOOL_DIR'" fileinto.sv -pattern\
+sieve_test --set "mailbox.folder=\"'$MU_SPOOL_DIR'\"" fileinto.sv -pattern\
 "FILEINTO on msg uid 1: delivering into +file"\
 "FILEINTO on msg uid 2: delivering into +file"\
 "FILEINTO on msg uid 3: delivering into +file"
diff --git a/testsuite/lib/mailutils.exp b/testsuite/lib/mailutils.exp
index d4101b2..10d8043 100644
--- a/testsuite/lib/mailutils.exp
+++ b/testsuite/lib/mailutils.exp
@@ -152,7 +152,7 @@ proc mu_init {args} {
        if {[llength $args] == 1 && [lindex $args 0] == "-noflags"} {
            set MU_TOOL_FLAGS "--no-site-rcfile --no-user-rcfile"
        } else {
-           set MU_TOOL_FLAGS "--set mailbox.mail-spool=$MU_SPOOL_DIR 
--no-site-rcfile --no-user-rcfile"
+           set MU_TOOL_FLAGS "--set mailbox.mail-spool=\"'$MU_SPOOL_DIR'\" 
--no-site-rcfile --no-user-rcfile"
            for {set i 0} {$i < [llength $args]} {incr i} {
                append MU_TOOL_FLAGS " [lindex $args $i]"
            }
@@ -181,7 +181,7 @@ proc mu_start {args} {
     
     if [info exists host_board] {
        if [board_info $host_board exists top_srcdir] {
-           append sw " --set mailbox.mail-spool=[board_info $host_board 
top_srcdir]/mail/testsuite/spool"
+           append sw " --set mailbox.mail-spool=\"'[board_info $host_board 
top_srcdir]/mail/testsuite/spool'\""
        }
     }
 
@@ -263,14 +263,14 @@ proc mu_exec {args} {
 
     if [info exists host_board] {
        if [board_info $host_board exists top_srcdir] {
-           append sw " --set mailbox.mail-spool=[board_info $host_board 
top_srcdir]/mail/testsuite/spool"
+           append sw " --set mailbox.mail-spool=\"'[board_info $host_board 
top_srcdir]/mail/testsuite/spool'""
        }
     }
 
     # Pity, dejagnu provides no way to retrieve exit status of the process.
     # This ugly construction is used to work around this. Hopefully, it
     # should execute on any decent platform...
-    set cmd "sh -c \"$MU_TOOL $sw\; echo \$?\""
+    set cmd "sh -c \"$MU_TOOL [regsub -all {["\\]} $sw {\\&}]\; echo \$?\""
     verbose "Executing $cmd"
 
     set res [remote_exec host $cmd]


hooks/post-receive
-- 
GNU Mailutils




reply via email to

[Prev in Thread] Current Thread [Next in Thread]