summaryrefslogtreecommitdiff
path: root/pith/mailindx.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-12-20 21:55:35 -0700
committerEduardo Chappa <chappa@washington.edu>2016-12-20 21:55:35 -0700
commit12be46a5f66c34129cae2819c634e9a98e31113c (patch)
tree1d3190c6b9a4c0ee3f84f638aabadd3d40c38357 /pith/mailindx.c
parentbf8ca49bc1199f1a08c4d05969e8cc6b6965455a (diff)
downloadalpine-12be46a5f66c34129cae2819c634e9a98e31113c.tar.xz
* Bug fix: The index format would be chopped at the position of an
unrecognized token, instead of skipping the token as intended.
Diffstat (limited to 'pith/mailindx.c')
-rw-r--r--pith/mailindx.c14
1 files changed, 10 insertions, 4 deletions
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';