commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-3.0-43-ga923b22


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-3.0-43-ga923b22
Date: Mon, 12 Dec 2016 11:22:54 +0000 (UTC)

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=a923b221dc3a620dd5507ad935774cc70c9c28ec

The branch, master has been updated
       via  a923b221dc3a620dd5507ad935774cc70c9c28ec (commit)
       via  d8896b0e5fbd5628b54b7704ab6cb64560caa3b5 (commit)
       via  0f705faa6c5079c03319a49f37912f7f49bce6e1 (commit)
      from  506086e05f25c8082993940eac0883c7d72d485a (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 a923b221dc3a620dd5507ad935774cc70c9c28ec
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 12 13:19:24 2016 +0200

    mhn: allow for whitespace in edit commands

commit d8896b0e5fbd5628b54b7704ab6cb64560caa3b5
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 12 11:02:26 2016 +0200

    Fix -nowhatnow proc in mh
    
    * mh/mh.h (mh_whatnow_env) <nowhatnowproc>: New member.
    * mh/compcommon.c (check_draft_disposition): Return DISP_REPLACE
    if nowhatnowproc is set.
    * mh/mh_whatnow.c (mh_whatnowproc): Return 0 if nowhatnowproc is
    set.
    * mh/comp.c: Fix -nowhatnowproc
    * mh/forw.c: Likewise.
    * mh/repl.c: Likewise.

commit 0f705faa6c5079c03319a49f37912f7f49bce6e1
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 12 13:09:59 2016 +0200

    Bugfix
    
    * libmailutils/base/ctparse.c (parse_type)
    (parse_subtype): Fix memory allocation

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

Summary of changes:
 gint                        |    2 +-
 libmailutils/base/ctparse.c |    4 ++--
 mh/comp.c                   |    5 ++---
 mh/compcommon.c             |    3 +++
 mh/forw.c                   |    5 ++---
 mh/mh.h                     |    1 +
 mh/mh_whatnow.c             |    3 +++
 mh/mhn.c                    |   29 +++++++++++++++++++++++------
 mh/repl.c                   |   23 +++++------------------
 9 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/gint b/gint
index 42f4712..fd86bf7 160000
--- a/gint
+++ b/gint
@@ -1 +1 @@
-Subproject commit 42f4712085b40173eaea58e14b1a579291a6fe3a
+Subproject commit fd86bf7d44b0c970771830692ae7491447ebe8b1
diff --git a/libmailutils/base/ctparse.c b/libmailutils/base/ctparse.c
index 6ccac5c..7734660 100644
--- a/libmailutils/base/ctparse.c
+++ b/libmailutils/base/ctparse.c
@@ -60,7 +60,7 @@ parse_type (const char *input, mu_content_type_t ct)
          || !(mu_isalnum (input[i]) || input[i] == '-' || input[i] == '_'))
        return MU_ERR_PARSE;
     }
-  ct->type = malloc (i);
+  ct->type = malloc (i + 1);
   if (!ct->type)
     return ENOMEM;
   memcpy (ct->type, input, i);
@@ -83,7 +83,7 @@ parse_subtype (const char *input, mu_content_type_t ct)
       if (!ISTOKEN (input[i]))
        return MU_ERR_PARSE;
     }
-  ct->subtype = malloc (i);
+  ct->subtype = malloc (i + 1);
   if (!ct->subtype)
     return ENOMEM;
   memcpy (ct->subtype, input, i);
diff --git a/mh/comp.c b/mh/comp.c
index 8a9df01..16d24da 100644
--- a/mh/comp.c
+++ b/mh/comp.c
@@ -27,7 +27,6 @@ static char args_doc[] = N_("[MSG]");
 struct mh_whatnow_env wh_env = { 0 };
 static int initial_edit = 1;
 static const char *whatnowproc;
-static int nowhatnowproc;
 char *formfile;
 static int build_only = 0; /* -build flag */
 static int use_draft = 0;  /* -use flag */
@@ -81,7 +80,7 @@ static struct mu_option options[] = {
     mu_c_string, &whatnowproc },
   { "nowhatnowproc", 0, NULL, MU_OPTION_DEFAULT,
     N_("don't run whatnowproc"),
-    mu_c_string, &nowhatnowproc, NULL, "1" },
+    mu_c_int, &wh_env.nowhatnowproc, NULL, "1" },
   { "use",           0, NULL, MU_OPTION_DEFAULT,
     N_("use draft file preserved after the last session"),
     mu_c_bool, &use_draft },
@@ -235,7 +234,7 @@ main (int argc, char **argv)
     }
   
   /* Exit immediately if -build is given */
-  if (build_only || nowhatnowproc)
+  if (build_only || wh_env.nowhatnowproc)
     return 0;
 
   return mh_whatnowproc (&wh_env, initial_edit, whatnowproc);
diff --git a/mh/compcommon.c b/mh/compcommon.c
index 1298d1f..d6e5555 100644
--- a/mh/compcommon.c
+++ b/mh/compcommon.c
@@ -74,6 +74,9 @@ check_draft_disposition (struct mh_whatnow_env *wh, int 
use_draft)
   struct stat st;
   int disp = DISP_REPLACE;
 
+  if (wh->nowhatnowproc)
+    return disp;
+  
   /* First check if the draft exists */
   if (stat (wh->draftfile, &st) == 0)
     {
diff --git a/mh/forw.c b/mh/forw.c
index 5c9fd93..33d120f 100644
--- a/mh/forw.c
+++ b/mh/forw.c
@@ -37,7 +37,6 @@ static const char *whatnowproc;
 static char *mhl_filter_file = NULL; /* --filter flag */
 
 static int build_only = 0;      /* --build flag */
-static int nowhatnowproc = 0;   /* --nowhatnowproc */
 static int annotate = 0;        /* --annotate flag */
 static enum encap_type encap = encap_clear; /* controlled by --format, --form
                                               and --mime flags */
@@ -136,7 +135,7 @@ static struct mu_option options[] = {
     mu_c_string, &whatnowproc },
   { "nowhatnowproc", 0, NULL, MU_OPTION_DEFAULT,
     N_("don't run whatnowproc"),
-    mu_c_int, &nowhatnowproc, NULL, "1" },
+    mu_c_int, &wh_env.nowhatnowproc, NULL, "1" },
   { "use",           0, NULL, MU_OPTION_DEFAULT,
     N_("use draft file preserved after the last session"),
     mu_c_bool, &use_draft },
@@ -434,7 +433,7 @@ main (int argc, char **argv)
     }
   
   /* Exit immediately if --build is given */
-  if (build_only || nowhatnowproc)
+  if (build_only || wh_env.nowhatnowproc)
     {
       if (strcmp (wh_env.file, wh_env.draftfile))
        rename (wh_env.file, wh_env.draftfile);
diff --git a/mh/mh.h b/mh/mh.h
index 7d3ea0b..578a065 100644
--- a/mh/mh.h
+++ b/mh/mh.h
@@ -215,6 +215,7 @@ struct mh_whatnow_env     /* whatnow shell environment */
   char *anno_field;       /* Annotate field to be used */
   mu_list_t anno_list;    /* List of messages (mu_message_t) to annotate */
   mu_mailbox_t mbox;
+  int nowhatnowproc;
 };
 
 #define DISP_QUIT 0
diff --git a/mh/mh_whatnow.c b/mh/mh_whatnow.c
index 53eafb4..95a403a 100644
--- a/mh/mh_whatnow.c
+++ b/mh/mh_whatnow.c
@@ -582,6 +582,9 @@ mh_whatnowproc (struct mh_whatnow_env *wh, int 
initial_edit, const char *prog)
 {
   int rc;
   pid_t pid;
+
+  if (wh->nowhatnowproc)
+    return 0;
   
   if (!prog)
     return mh_whatnow (wh, initial_edit);
diff --git a/mh/mhn.c b/mh/mhn.c
index 9fcb83d..0d24011 100644
--- a/mh/mhn.c
+++ b/mh/mhn.c
@@ -1744,7 +1744,7 @@ parse_brace (char **pval, char **cmd, int c, struct 
compose_env *env)
   return 0;
 }
 
-#define isdelim(c) (mu_isspace (c) || strchr (";<[(", c))
+#define isdelim(c) (c == 0 || mu_isspace (c) || strchr (";<[(", c))
 #define skipws(ptr) (ptr) = mu_str_skip_class (ptr, MU_CTYPE_SPACE)
 
 int
@@ -1754,7 +1754,7 @@ parse_content_type (struct compose_env *env,
   int status = 0, stop = 0;
   char *rest = *prest;
   char *comment = NULL;
-
+  
   while (stop == 0 && status == 0 && *rest)
     {
       skipws (rest);
@@ -1823,12 +1823,29 @@ parse_content_type (struct compose_env *env,
          rest++;
          mu_opool_append_char (pool, '=');
          skipws (rest);
-         for (; *rest; rest++)
+         if (*rest == '"')
            {
-             if (isdelim (*rest))
-               break;
              mu_opool_append_char (pool, *rest);
+             rest++;
+             while (*rest != '"')
+               {
+                 if (*rest == '\\')
+                   {
+                     mu_opool_append_char (pool, *rest);
+                     if (rest[1])
+                       rest++;
+                     else
+                       break;
+                   }
+                 mu_opool_append_char (pool, *rest);
+                 rest++;
+               }
+             mu_opool_append_char (pool, *rest);
+             rest++;
            }
+         else
+           for (; !isdelim (*rest); rest++)
+             mu_opool_append_char (pool, *rest);
          break;
            
        default:
@@ -1867,7 +1884,7 @@ parse_type_command (char **pcmd, struct compose_env *env, 
mu_header_t hdr)
   char *rest = *pcmd;
   
   skipws (rest);
-  for (sp = rest; *sp && !isdelim (*sp); sp++)
+  for (sp = rest; !isdelim (*sp); sp++)
     ;
   c = *sp;
   *sp = 0;
diff --git a/mh/repl.c b/mh/repl.c
index 2d27ab5..e3467f8 100644
--- a/mh/repl.c
+++ b/mh/repl.c
@@ -35,7 +35,6 @@ static const char *whatnowproc;
 static mu_msgset_t msgset;
 static mu_mailbox_t mbox;
 static int build_only = 0; /* -build flag */
-static int nowhatnowproc = 0; /* -nowhatnowproc */
 static int use_draft = 0;  /* -use flag */
 static char *mhl_filter = NULL; /* -filter flag */
 static int annotate;       /* -annotate flag */
@@ -86,7 +85,7 @@ set_whatnowproc (struct mu_parseopt *po, struct mu_option 
*opt,
                 char const *arg)
 {
   whatnowproc = mu_strdup (arg);
-  nowhatnowproc = 0;
+  wh_env.nowhatnowproc = 0;
 }
 
 static void
@@ -165,7 +164,7 @@ static struct mu_option options[] = {
     mu_c_string, NULL, set_whatnowproc },
   { "nowhatnowproc", 0, NULL, MU_OPTION_DEFAULT,
     N_("don't run whatnowproc"),
-    mu_c_int, &nowhatnowproc, NULL, "1" },
+    mu_c_int, &wh_env.nowhatnowproc, NULL, "1" },
   { "use", 0, NULL, MU_OPTION_DEFAULT,
     N_("use draft file preserved after the last session"),
     mu_c_bool, &use_draft },
@@ -190,23 +189,11 @@ make_draft (mu_mailbox_t mbox, int disp, struct 
mh_whatnow_env *wh)
 {
   int rc;
   mu_message_t msg;
-  struct stat st;
   size_t msgno;
   
   /* First check if the draft exists */
-  if (!build_only && stat (wh->draftfile, &st) == 0)
-    {
-      if (use_draft)
-       disp = DISP_USE;
-      else 
-       {
-         printf (ngettext ("Draft \"%s\" exists (%s byte).\n",
-                           "Draft \"%s\" exists (%s bytes).\n",
-                           (unsigned long) st.st_size),
-                 wh->draftfile, mu_umaxtostr (0, st.st_size));
-         disp = mh_disposition (wh->draftfile);
-       }
-    }
+  if (!build_only)
+    disp = check_draft_disposition (wh, use_draft);
 
   switch (disp)
     {
@@ -344,7 +331,7 @@ main (int argc, char **argv)
   make_draft (mbox, DISP_REPLACE, &wh_env);
 
   /* Exit immediately if --build is given */
-  if (build_only || nowhatnowproc)
+  if (build_only || wh_env.nowhatnowproc)
     return 0;
 
   rc = mh_whatnowproc (&wh_env, initial_edit, whatnowproc);


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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