[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Mailutils branch, master, updated. mu-1-2-90-separate-argp-cfg
From: |
Sergey Poznyakoff |
Subject: |
[SCM] GNU Mailutils branch, master, updated. mu-1-2-90-separate-argp-cfg-242-gc09870d |
Date: |
Thu, 19 Mar 2009 21:45:26 +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=c09870d821d43dadfc6ebc9de143172fce358243
The branch, master has been updated
via c09870d821d43dadfc6ebc9de143172fce358243 (commit)
from 17751e6bf80cd75c278145222f414f4cd434fe9e (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 c09870d821d43dadfc6ebc9de143172fce358243
Author: Sergey Poznyakoff <address@hidden>
Date: Thu Mar 19 23:42:03 2009 +0200
Mail: fix parsing of arguments containing =.
* mail/util.c (util_do_command): Do not use = as a delimiter.
* mail/set.c (mail_set): = is no longer returned as a token.
* mail/setenv.c (mail_setenv): Likewise.
-----------------------------------------------------------------------
Summary of changes:
mail/set.c | 19 +++++++++----------
mail/setenv.c | 19 +++++--------------
mail/util.c | 7 +++----
3 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/mail/set.c b/mail/set.c
index 5c5c256..78c0b48 100644
--- a/mail/set.c
+++ b/mail/set.c
@@ -40,25 +40,24 @@ mail_set (int argc, char **argv)
for (i = 1; i < argc; i++)
{
- if (!strncmp ("no", argv[i], 2))
+ char *value = strchr (argv[i], '=');
+ if (value)
+ *value++ = 0;
+
+ if (!strncmp ("no", argv[i], 2) && !value)
{
util_setenv (&argv[i][2], NULL, Mail_env_boolean, 1);
}
- else if (i+1 < argc && argv[i+1][0] == '=')
+ else if (value)
{
int nval;
- char *name = argv[i];
char *p;
- i += 2;
- if (i >= argc)
- break;
-
- nval = strtoul (argv[i], &p, 0);
+ nval = strtoul (value, &p, 0);
if (*p == 0)
- util_setenv (name, &nval, Mail_env_number, 1);
+ util_setenv (argv[i], &nval, Mail_env_number, 1);
else
- util_setenv (name, argv[i], Mail_env_string, 1);
+ util_setenv (argv[i], value, Mail_env_string, 1);
}
else
{
diff --git a/mail/setenv.c b/mail/setenv.c
index d3ac45d..624fb13 100644
--- a/mail/setenv.c
+++ b/mail/setenv.c
@@ -39,21 +39,12 @@ mail_setenv (int argc, char **argv)
/* Note: POSIX requires that the argument to putenv become part
of the environment itself, hence the memory allocation. */
- for (i = 1; i < argc;)
+ for (i = 1; i < argc; i++)
{
- char *p;
-
- if (i+1 < argc && argv[i+1][0] == '=')
- {
- asprintf (&p, "%s=%s", argv[i], argv[i+2]);
- i += 3;
- }
- else
- {
- p = argv[i];
- i++;
- }
- putenv (p);
+ char *value = strchr (argv[i], '=');
+ if (value)
+ *value++ = 0;
+ setenv (argv[i], value ? value : "", 1);
}
}
return 0;
diff --git a/mail/util.c b/mail/util.c
index 108b6b1..5a5b8ca 100644
--- a/mail/util.c
+++ b/mail/util.c
@@ -52,7 +52,6 @@ util_do_command (const char *c, ...)
const struct mail_command_entry *entry = NULL;
char *cmd = NULL;
va_list ap;
- static const char *delim = "=";
va_start (ap, c);
status = vasprintf (&cmd, c, ap);
@@ -82,7 +81,7 @@ util_do_command (const char *c, ...)
return 0;
}
- if (mu_argcv_get (cmd, delim, NULL, &argc, &argv) == 0 && argc > 0)
+ if (mu_argcv_get (cmd, NULL, NULL, &argc, &argv) == 0 && argc > 0)
{
char *p;
@@ -93,7 +92,7 @@ util_do_command (const char *c, ...)
{
asprintf (&p, "print %s", argv[0]);
mu_argcv_free (argc, argv);
- mu_argcv_get (p, delim, NULL, &argc, &argv);
+ mu_argcv_get (p, NULL, NULL, &argc, &argv);
free (p);
}
@@ -690,7 +689,7 @@ util_setenv (const char *variable, void *value,
mail_env_data_t type,
abort();
}
}
-
+
/* Special handling for some variables */
if (strcmp (variable, "replyregex") == 0)
{
hooks/post-receive
--
GNU Mailutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Mailutils branch, master, updated. mu-1-2-90-separate-argp-cfg-242-gc09870d,
Sergey Poznyakoff <=