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) ...@@ -313,8 +313,8 @@ imap4d_search0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
313 parsebuf.tree = parse_search_key_list (&parsebuf); 313 parsebuf.tree = parse_search_key_list (&parsebuf);
314 if (!parsebuf.tree) 314 if (!parsebuf.tree)
315 { 315 {
316 *err_text = parsebuf.err_mesg ? parsebuf.err_mesg : "Parse error";
316 parse_free_mem (&parsebuf); 317 parse_free_mem (&parsebuf);
317 *err_text = "Parse error";
318 return RESP_BAD; 318 return RESP_BAD;
319 } 319 }
320 320
......
...@@ -79,7 +79,7 @@ int mu_scan_datetime (const char *input, const char *fmt, struct tm *tm, ...@@ -79,7 +79,7 @@ int mu_scan_datetime (const char *input, const char *fmt, struct tm *tm,
79 #define MU_DATETIME_FROM_LENGTH 24 79 #define MU_DATETIME_FROM_LENGTH 24
80 80
81 #define MU_DATETIME_IMAP "%d-%b-%Y %H:%M:%S %z" 81 #define MU_DATETIME_IMAP "%d-%b-%Y %H:%M:%S %z"
82 #define MU_DATETIME_INTERNALDATE "%d-%b-%Y%$ %H:%M:%S %z" 82 #define MU_DATETIME_INTERNALDATE "%e-%b-%Y%$ %H:%M:%S %z"
83 83
84 /* RFC2822 date. Scan format contains considerable allowances which would 84 /* RFC2822 date. Scan format contains considerable allowances which would
85 stun formatting functions, therefore two distinct formats are provided: 85 stun formatting functions, therefore two distinct formats are provided:
......
...@@ -425,6 +425,8 @@ mu_scan_datetime (const char *input, const char *fmt, ...@@ -425,6 +425,8 @@ mu_scan_datetime (const char *input, const char *fmt,
425 { 425 {
426 int ndig; 426 int ndig;
427 427
428 if (*input == ' ')
429 ++input;
428 n = get_num (input, &p, 2, 1, 31, &ndig); 430 n = get_num (input, &p, 2, 1, 31, &ndig);
429 if (n == -1) 431 if (n == -1)
430 rc = MU_ERR_PARSE; 432 rc = MU_ERR_PARSE;
......
...@@ -1138,7 +1138,7 @@ com_search (int argc, char **argv) ...@@ -1138,7 +1138,7 @@ com_search (int argc, char **argv)
1138 rc = mu_msgset_count (mset, &count); 1138 rc = mu_msgset_count (mset, &count);
1139 if (rc == EINVAL || count == 0) 1139 if (rc == EINVAL || count == 0)
1140 { 1140 {
1141 mu_printf (_("no matches")); 1141 mu_printf ("%s\n", _("no matches"));
1142 return 0; 1142 return 0;
1143 } 1143 }
1144 mu_printf ("%lu matches:", (unsigned long) count); 1144 mu_printf ("%lu matches:", (unsigned long) count);
......