Commit 426df179 426df179766b4b144cf746dfc56f4b4a9f80b3ac by Sergey Poznyakoff

Bugfixes.

* libmailutils/url/create.c (_mu_url_create_internal): Fix
parsing of the '|' shortcuts.
* libmailutils/tests/url.at: Fix '|' test. Add 'prog://' test.

* movemail/movemail.c (set_program_id): Call mu_stdstream_strerr_setup
to flush changes.
* frm/common.c: Minor changes
1 parent 43508b45
......@@ -388,19 +388,15 @@ get_personal (mu_header_t hdr, const char *field, char **personal)
if (status == 0)
{
mu_address_t address = NULL;
char *s = NULL;
const char *s = NULL;
mu_address_create (&address, hfield);
mu_address_aget_personal (address, 1, &s);
mu_address_destroy (&address);
mu_address_sget_personal (address, 1, &s);
if (s == NULL)
s = hfield;
else
free (hfield);
*personal = rfc2047_decode_wrapper (s, strlen (s));
free (s);
mu_address_destroy (&address);
}
return status;
}
......@@ -581,7 +577,7 @@ frm_scan (char *mailbox_name, frm_select_t fun, size_t *total)
status = mu_mailbox_scan (mbox, 1, total);
if (status != 0)
{
mu_error (_("could not scan mailbox `%s': %s."),
mu_error (_("could not scan mailbox `%s': %s"),
mu_url_to_string (url), mu_strerror (status));
frm_abort (&mbox);
}
......
......@@ -804,9 +804,21 @@ auth <>
host <>
port 0
path </bin/mailman>
query[0] </bin/mailman>
query[1] <request>
query[2] <list%40dom>
query[0] <request>
query[1] <list%40dom>
]])
TESTURL([],[],
[prog:///bin/mailman?request&list%40dom],
[[scheme <prog>
user <>
passwd <>
auth <>
host <>
port 0
path </bin/mailman>
query[0] <request>
query[1] <list@dom>
]])
m4_popdef([TESTURL])
......
......@@ -378,6 +378,7 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint)
if ((ctx->flags & MU_URL_PARSE_PIPE) && ctx->input[0] == '|')
{
struct mu_wordsplit ws;
size_t i;
rc = str_assign (&url->scheme, "prog");
if (rc)
......@@ -386,15 +387,21 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint)
ctx->flags &= ~MU_URL_PARSE_HEXCODE;
if (mu_wordsplit (ctx->input + 1, &ws, MU_WRDSF_DEFFLAGS))
return errno;
url->qargc = ws.ws_wordc;
url->qargv = ws.ws_wordv;
url->path = ws.ws_wordv[0];
url->flags |= MU_URL_PATH;
url->qargc = ws.ws_wordc - 1;
url->qargv = calloc (url->qargc + 1, sizeof (url->qargv[0]));
if (!url->qargv)
{
mu_wordsplit_free (&ws);
return ENOMEM;
}
for (i = 0; i < url->qargc; i++)
url->qargv[i] = ws.ws_wordv[i+1];
ws.ws_wordc = 0;
ws.ws_wordv = NULL;
mu_wordsplit_free (&ws);
url->flags |= MU_URL_QUERY;
rc = str_assign (&url->path, url->qargv[0]);
if (rc == 0)
url->flags |= MU_URL_PATH;
}
else if ((ctx->flags & MU_URL_PARSE_SLASH) && ctx->input[0] == '/')
{
......
......@@ -828,6 +828,7 @@ set_program_id (const char *source_name, const char *dest_name)
ws.ws_wordv[0] = NULL;
ws.ws_wordc = 0;
mu_wordsplit_free (&ws);
mu_stdstream_strerr_setup (MU_STRERR_STDERR);
}
......