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-117-g96e4473


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-117-g96e4473
Date: Sun, 03 Oct 2010 22:28:20 +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=96e44735dce29f8cdf0f8512bd3bfccc4b350055

The branch, master has been updated
       via  96e44735dce29f8cdf0f8512bd3bfccc4b350055 (commit)
      from  e32c2d801b1f05fc423b597e6b44c66d4213bbc2 (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 96e44735dce29f8cdf0f8512bd3bfccc4b350055
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Oct 4 00:00:25 2010 +0300

    Improve path parsing in mu_cfg_find_node.
    
    * libmailutils/cfg_parser.y (split_cfg_path): New static.
    (mu_cfg_find_node): Use the same parsing algorithm as
    mu_cfg_create_subtree.  This complements 68b7dc9dac.
    (mu_cfg_create_subtree): Use split_cfg_path.  Handle
    escaped '=' as a regular character.
    * mu/mu.c (args_doc): Remove spurious word.
    (main): Disable --version option in action handlers.
    * mu/query.c (query_args_doc): Use `path' instead of `keyword'.

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

Summary of changes:
 libmailutils/cfg_parser.y |  108 +++++++++++++++++++++++++++------------------
 mu/mu.c                   |   10 +++-
 mu/query.c                |    2 +-
 3 files changed, 73 insertions(+), 47 deletions(-)

diff --git a/libmailutils/cfg_parser.y b/libmailutils/cfg_parser.y
index 8b13ae1..f6a5397 100644
--- a/libmailutils/cfg_parser.y
+++ b/libmailutils/cfg_parser.y
@@ -1576,6 +1576,49 @@ mu_cfg_value_eq (mu_config_value_t *a, mu_config_value_t 
*b)
 }
 
 
+static int
+split_cfg_path (const char *path, int *pargc, char ***pargv)
+{
+  int rc;
+  int argc;
+  char **argv;
+  char *delim = MU_CFG_PATH_DELIM_STR;
+  char static_delim[2] = { 0, 0 };
+  
+  if (path[0] == '\\')
+    {
+      argv = calloc (2, sizeof (*argv));
+      if (!argv)
+       return ENOMEM;
+      argv[0] = strdup (path + 1);
+      if (!argv[0])
+       {
+         free (argv);
+         return ENOMEM;
+       }
+      argv[1] = NULL;
+      argc = 1;
+      rc = 0;
+    }
+  else
+    {
+      if (mu_ispunct (path[0]))
+       {
+         delim = static_delim;
+         delim[0] = path[0];
+         path++;
+       }
+      rc = mu_argcv_get_np (path, strlen (path), delim, NULL, 0,
+                           &argc, &argv, NULL);
+    }
+  if (rc == 0)
+    {
+      *pargc = argc;
+      *pargv = argv;
+    }
+  return rc;
+}
+
 struct find_data
 {
   int argc;
@@ -1714,9 +1757,7 @@ mu_cfg_find_node (mu_cfg_tree_t *tree, const char *path, 
mu_cfg_node_t **pval)
   struct find_data data;
   struct mu_cfg_iter_closure clos;
 
-  rc = mu_argcv_get_np (path, strlen (path),
-                       MU_CFG_PATH_DELIM_STR, NULL,
-                       0, &data.argc, &data.argv, NULL);
+  rc = split_cfg_path (path, &data.argc, &data.argv);
   if (rc)
     return rc;
   data.tag = 0;
@@ -1742,44 +1783,15 @@ mu_cfg_create_subtree (const char *path, mu_cfg_node_t 
**pnode)
 {
   int rc;
   int argc, i;
-  char *p;
   char **argv;
-  mu_cfg_locus_t locus;
   enum mu_cfg_node_type type;
   mu_cfg_node_t *node = NULL;
-  char *delim = MU_CFG_PATH_DELIM_STR;
-  char static_delim[2] = { 0, 0 };
-  
+  mu_cfg_locus_t locus;
+
   locus.file = "<int>";
   locus.line = 0;
 
-  if (path[0] == '\\')
-    {
-      argv = calloc (2, sizeof (*argv));
-      if (!argv)
-       return ENOMEM;
-      argv[0] = strdup (path + 1);
-      if (!argv[0])
-       {
-         free (argv);
-         return ENOMEM;
-       }
-      argv[1] = NULL;
-      argc = 1;
-      rc = 0;
-    }
-  else
-    {
-      if (mu_ispunct (path[0]))
-       {
-         delim = static_delim;
-         delim[0] = path[0];
-         path++;
-       }
-      rc = mu_argcv_get_np (path, strlen (path), delim, NULL, 0,
-                           &argc, &argv, NULL);
-    }
-  
+  rc = split_cfg_path (path, &argc, &argv);
   if (rc)
     return rc;
 
@@ -1787,17 +1799,27 @@ mu_cfg_create_subtree (const char *path, mu_cfg_node_t 
**pnode)
     {
       mu_list_t nodelist = NULL;
       mu_config_value_t *label = NULL;
-
-      p = strrchr (argv[i], '=');
+      char *q = argv[i], *p;
+      
       type = mu_cfg_node_statement;
-      if (p)
+      do
        {
-         *p++ = 0;
-         label = parse_label (p);
-         if (i == argc - 1)
-           type = mu_cfg_node_param;
+         p = strchr (q, '=');
+         if (p && p > argv[i] && p[-1] != '\\')
+           {
+             *p++ = 0;
+             label = parse_label (p);
+             if (i == argc - 1)
+               type = mu_cfg_node_param;
+             break;
+           }
+         else if (p)
+           q = p + 1;
+         else
+           break;
        }
-
+      while (*q);
+      
       if (node)
        {
          mu_cfg_create_node_list (&nodelist);
diff --git a/mu/mu.c b/mu/mu.c
index cff6a12..9af9e0a 100644
--- a/mu/mu.c
+++ b/mu/mu.c
@@ -24,8 +24,8 @@
 #include "mailutils/libargp.h"
 #include "mu.h"
 
-static char args_doc[] = N_("[OPTIONS] COMMAND [CMDOPTS]");
-static char doc[] = N_("mu -- GNU Mailutils test tool.\n\
+static char args_doc[] = N_("COMMAND [CMDOPTS]");
+static char doc[] = N_("mu -- GNU Mailutils multi-purpose tool.\n\
 Commands are:\n\
     mu info   - show Mailutils configuration\n\
     mu query  - query configuration values\n\
@@ -33,7 +33,7 @@ Commands are:\n\
     mu filter - filter program\n\
     mu 2047   - decode/encode message headers as per RFC 2047\n\
 \n\
-Try `mu COMMAND --help' to get help on a particular COMMAND\n\
+Try `mu COMMAND --help' to get help on a particular COMMAND.\n\
 \n\
 Options are:\n");
 /* FIXME: add
@@ -143,6 +143,10 @@ main (int argc, char **argv)
       exit (1);
     }
 
+  /* Disable --version option in action. */
+  argp_program_version = NULL;
+  argp_program_version_hook = NULL;
+  /* Run the action. */
   exit (action (argc, argv));
 }
 
diff --git a/mu/query.c b/mu/query.c
index f338a3a..fd951c2 100644
--- a/mu/query.c
+++ b/mu/query.c
@@ -25,7 +25,7 @@
 #include "mu.h"
 
 static char query_doc[] = N_("mu query - query configuration values.");
-static char query_args_doc[] = N_("keyword [keyword...]");
+static char query_args_doc[] = N_("path [path...]");
 
 char *file_name;
 int verbose_option;


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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