Commit 68f81619 68f8161910688e280d736d7c187cbf86afd7c826 by Sergey Poznyakoff

imap-related bugfixes.

* imap4d/search.c (imap4d_search0): Use parsebuf.err_mesg if defined,
otherwise fall back to the general "parse error" message.
* include/mailutils/datetime.h (MU_DATETIME_INTERNALDATE): Use %e for
day. Day can be one-digit decimal.
* libmailutils/datetime/scantime.c (mu_scan_datetime): Skip initial
ws for %e.
* mu/imap.c (com_search): Print newline after the "no matches" message.
1 parent 836d8ad1
......@@ -313,8 +313,8 @@ imap4d_search0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
parsebuf.tree = parse_search_key_list (&parsebuf);
if (!parsebuf.tree)
{
*err_text = parsebuf.err_mesg ? parsebuf.err_mesg : "Parse error";
parse_free_mem (&parsebuf);
*err_text = "Parse error";
return RESP_BAD;
}
......
......@@ -79,7 +79,7 @@ int mu_scan_datetime (const char *input, const char *fmt, struct tm *tm,
#define MU_DATETIME_FROM_LENGTH 24
#define MU_DATETIME_IMAP "%d-%b-%Y %H:%M:%S %z"
#define MU_DATETIME_INTERNALDATE "%d-%b-%Y%$ %H:%M:%S %z"
#define MU_DATETIME_INTERNALDATE "%e-%b-%Y%$ %H:%M:%S %z"
/* RFC2822 date. Scan format contains considerable allowances which would
stun formatting functions, therefore two distinct formats are provided:
......
......@@ -425,6 +425,8 @@ mu_scan_datetime (const char *input, const char *fmt,
{
int ndig;
if (*input == ' ')
++input;
n = get_num (input, &p, 2, 1, 31, &ndig);
if (n == -1)
rc = MU_ERR_PARSE;
......
......@@ -1138,7 +1138,7 @@ com_search (int argc, char **argv)
rc = mu_msgset_count (mset, &count);
if (rc == EINVAL || count == 0)
{
mu_printf (_("no matches"));
mu_printf ("%s\n", _("no matches"));
return 0;
}
mu_printf ("%lu matches:", (unsigned long) count);
......