summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mailbox/url.c35
-rw-r--r--movemail/movemail.c8
2 files changed, 28 insertions, 15 deletions
diff --git a/mailbox/url.c b/mailbox/url.c
index 1b833bf3f..f46fbc14f 100644
--- a/mailbox/url.c
+++ b/mailbox/url.c
@@ -37,13 +37,13 @@
#include <mailutils/cstr.h>
#include <url0.h>
#define AC2(a,b) a ## b
#define AC4(a,b,c,d) a ## b ## c ## d
-static int url_parse0 (mu_url_t, char *, size_t *poff);
+static int url_parse0 (mu_url_t, char *, size_t *poff, int *decode);
static int
parse_query (const char *query,
char *delim,
int *pargc, char ***pargv, const char **pend)
{
@@ -283,13 +283,14 @@ mu_url_parse (mu_url_t url)
{
int err = 0;
char *n = NULL;
struct _mu_url u;
size_t pstart;
mu_secret_t newsec;
-
+ int want_decode;
+
if (!url || !url->name)
return EINVAL;
memset (&u, 0, sizeof u);
/* can't have been parsed already */
if (url->scheme || url->user || url->secret || url->auth ||
@@ -298,13 +299,13 @@ mu_url_parse (mu_url_t url)
n = strdup (url->name);
if (!n)
return ENOMEM;
- err = url_parse0 (&u, n, &pstart);
+ err = url_parse0 (&u, n, &pstart, &want_decode);
if (!err)
{
if (u.secret)
{
/* Obfuscate the password */
@@ -328,23 +329,24 @@ mu_url_parse (mu_url_t url)
/* Dup the strings we found. We wouldn't have to do this
if we did a single alloc of the source url name, and
kept it around. It's also a good time to do hex decoding,
though.
*/
-#define UALLOC(X) \
- if (u.X && u.X[0] && (url->X = mu_url_decode(u.X)) == 0) \
- { \
- err = ENOMEM; \
- goto CLEANUP; \
- } \
- else \
- { \
- /* Set zero-length strings to NULL. */ \
- u.X = NULL; \
- }
+#define UALLOC(X) \
+ if (u.X && u.X[0] && \
+ !(url->X = (want_decode ? mu_url_decode (u.X) : strdup (u.X)))) \
+ { \
+ err = ENOMEM; \
+ goto CLEANUP; \
+ } \
+ else \
+ { \
+ /* Set zero-length strings to NULL. */ \
+ u.X = NULL; \
+ }
UALLOC (scheme);
UALLOC (user);
if (u.secret)
{
@@ -417,40 +419,43 @@ the person the mail is from:
Is this required to be % quoted, though? I hope so!
*/
static int
-url_parse0 (mu_url_t u, char *name, size_t *poff)
+url_parse0 (mu_url_t u, char *name, size_t *poff, int *decode)
{
char *start = name;
char *p; /* pointer into name */
/* reject the obvious */
if (name == NULL)
return EINVAL;
if (name[0] == '/')
{
u->scheme = "file";
+ *decode = 0;
}
else if (name[0] == '|')
{
int rc;
u->scheme = "prog";
+ *decode = 0;
rc = mu_argcv_get (name + 1, NULL, NULL, &u->qargc, &u->qargv);
if (rc == 0)
{
u->path = strdup (u->qargv[0]);
if (!u->path)
rc = ENOMEM;
}
return rc;
}
else
{
+ *decode = 1;
/* Parse out the SCHEME. */
p = strchr (name, ':');
if (p == NULL)
return MU_ERR_PARSE;
*p++ = 0;
diff --git a/movemail/movemail.c b/movemail/movemail.c
index afb83e8ae..4e7bdb986 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -757,12 +757,20 @@ main (int argc, char **argv)
if (argc < 2 || argc > 3)
{
mu_error (_("wrong number of arguments"));
return 1;
}
+ if (emacs_mode)
+ {
+ /* Undo the effect of configuration options that may affect
+ the interaction with Emacs. */
+ mu_registrar_set_default_record (mu_mbox_record);
+ mu_debug_default_printer = mu_debug_stderr_printer;
+ }
+
atexit (close_mailboxes);
source_name = argv[0];
dest_name = argv[1];
flags = preserve_mail ? MU_STREAM_READ : MU_STREAM_RDWR;

Return to:

Send suggestions and report system problems to the System administrator.