From 12be46a5f66c34129cae2819c634e9a98e31113c Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Tue, 20 Dec 2016 21:55:35 -0700 Subject: * Bug fix: The index format would be chopped at the position of an unrecognized token, instead of skipping the token as intended. --- pith/mailindx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pith/mailindx.c') diff --git a/pith/mailindx.c b/pith/mailindx.c index f6a2ba5b..efa6854d 100644 --- a/pith/mailindx.c +++ b/pith/mailindx.c @@ -655,17 +655,20 @@ parse_index_format(char *format_str, INDEX_COL_S **answer) /* ignore unrecognized word */ if(!pt){ + char c; for(q = p; *p && !isspace((unsigned char)*p); p++) ; - if(*p) - *p++ = '\0'; + if((c = *p) != '\0') + *p++ = '\0'; dprint((1, "parse_index_format: unrecognized token: %s\n", q ? q : "?")); q_status_message1(SM_ORDER | SM_DING, 0, 3, _("Unrecognized word in index-format: %s"), q); + if(c != '\0') + *(p-1) = c; continue; } @@ -4990,8 +4993,11 @@ date_str(char *datesrc, IndexColType type, int v, char *str, size_t str_len, ? month_abbrev_locale(d.month) : "???", sizeof(monabb)); monabb[sizeof(monabb)-1] = '\0'; - if(d.day >= 1 && d.day <= 31) - snprintf(dayzero, sizeof(dayzero), "%02d", d.day); + if(d.day >= 1 && d.day <= 31){ + snprintf(dayzero, sizeof(dayzero), "%*d", 2, d.day); +// if(d.day < 10) +// dayzero[0] = ' '; + } else{ strncpy(dayzero, "??", sizeof(dayzero)); dayzero[sizeof(dayzero)-1] = '\0'; -- cgit v1.2.3-54-g00ecf