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-2.2-670-g9555444


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-670-g9555444
Date: Thu, 06 Feb 2014 14:12:33 +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=9555444d92c7b9c5e523b848beedd3fa787b184d

The branch, master has been updated
       via  9555444d92c7b9c5e523b848beedd3fa787b184d (commit)
      from  8b573cdca1f2d71184531a2bbeb1263b116d1dac (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 9555444d92c7b9c5e523b848beedd3fa787b184d
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Feb 6 16:10:37 2014 +0200

    Accept single-dash notify option to inc
    
    * mh/mh_getopt.c (mh_getopt): Correctly handle traditional options
    that begin with "no" (e.g. "notify").
    * mh/inc.c (mh_option): Accept -notify (single-dash).

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

Summary of changes:
 mh/inc.c       |    1 +
 mh/mh_getopt.c |   25 ++++++++++++++-----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/mh/inc.c b/mh/inc.c
index f9a19c7..bf0f1d2 100644
--- a/mh/inc.c
+++ b/mh/inc.c
@@ -65,6 +65,7 @@ struct mh_option mh_option[] = {
   { "truncate",  MH_OPT_BOOL },
   { "moveto",    MH_OPT_ARG, "folder" },
   { "width",     MH_OPT_ARG, "number" },
+  { "notify",    MH_OPT_BOOL },
   { "quiet" },
   { NULL }
 };
diff --git a/mh/mh_getopt.c b/mh/mh_getopt.c
index 641a477..5d9ec86 100644
--- a/mh/mh_getopt.c
+++ b/mh/mh_getopt.c
@@ -60,17 +60,23 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt, 
const char *doc)
     mu_asprintf (&argv[mh_optind], "--version");
   else
     {
+      int negation = 0;
+      
       optlen = strlen (mh_optptr+1);
       for (p = mh_opt; p->opt; p++)
        {
-         if ((p->match_len <= optlen
-              && memcmp (mh_optptr+1, p->opt, optlen) == 0)
-             || (p->flags == MH_OPT_BOOL
-                 && optlen > 2
-                 && memcmp (mh_optptr+1, "no", 2) == 0
-                 && strlen (p->opt) >= optlen-2
-                 && memcmp (mh_optptr+3, p->opt, optlen-2) == 0))
+         if (p->match_len <= optlen
+             && memcmp (mh_optptr+1, p->opt, optlen) == 0)
            break;
+         if (p->flags == MH_OPT_BOOL
+             && optlen > 2
+             && memcmp (mh_optptr+1, "no", 2) == 0
+             && strlen (p->opt) >= optlen-2
+             && memcmp (mh_optptr+3, p->opt, optlen-2) == 0)
+           {
+             negation = 1;
+             break;
+           }
        }
       
       if (p->opt)
@@ -79,10 +85,7 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt, 
const char *doc)
          switch (p->flags)
            {
            case MH_OPT_BOOL:
-             if (memcmp (mh_optptr+1, "no", 2) == 0)
-               mh_optarg = "no";
-             else
-               mh_optarg = "yes";
+             mh_optarg = negation ? "no" : "yes";
              mu_asprintf (&argv[mh_optind], "--%s=%s", longopt, mh_optarg);
              break;
              


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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