break;
}
- if (opt)
- m_strformat (dest, destlen, ifstr, sidebar_number_format,
- data, M_FORMAT_OPTIONAL);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elstr, sidebar_number_format,
- data, M_FORMAT_OPTIONAL);
- return (src);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, opt ? ifstr : elstr, sidebar_number_format,
+ data, flags);
+ return src;
}
int sidebar_need_count (void) {
/* if $sidebar_newmail_only is set, don't display the
* box only if it's not the currently opened
* (i.e. always display the currently opened) */
- return (0);
+ return 0;
- m_strformat (no, len, NONULL (SidebarNumberFormat),
- sidebar_number_format, idx, M_FORMAT_OPTIONAL);
+ m_strformat(no, len, NONULL(SidebarNumberFormat), sidebar_number_format,
+ idx, 0);
lencnt = m_strlen(no);
- memset(&entry, ' ', sizeof(entry));
if (l > 0 && m_strncmp(sbox, ImapHomeNamespace, l) == 0 &&
m_strlen(sbox) > l)
} else
sbox = basename (sbox);
- if (option (OPTSHORTENHIERARCHY) && m_strlen(sbox) > len-lencnt-1) {
+ if (option(OPTSHORTENHIERARCHY) && m_strlen(sbox) > len-lencnt-1) {
sbox = shortened_hierarchy (sbox, len-lencnt-1);
shortened = 1;
}
- m_strcpy(entry, len - lencnt, sbox);
- entry[m_strlen(entry)] = ' ';
- memcpy(entry + (len - lencnt), no, lencnt);
-
- addnstr (entry, len);
+ snprintf(entry, sizeof(entry), "%*s", (int)len, no);
+ memcpy(entry, sbox, MIN(len - 1, m_strlen(sbox)));
+ addnstr(entry, len);
if (shortened)
p_delete(&sbox);
- return (1);
+ return 1;
}
/* returns folder name of currently
{
ssize_t pos = flags & M_FORMAT_ARROWCURSOR ? 3 : 0;
+ if (dlen >= 0)
+ *dst = '\0';
+
while (*fmt) {
- char ifstring[STRING], elsestring[STRING], prefix[STRING] = "";
int ch;
if (*fmt == '%') {
+ char ifstring[STRING], elsestring[STRING], prefix[STRING];
+
+ *ifstring = *elsestring = *prefix = '\0';
+
if (*++fmt == '%') {
pos += m_strputc(dst + pos, dlen - pos, *fmt++);
continue;
if (!*fmt++) /* move past the trailing `?' */
break; /* bad format */
- } else {
- *ifstring = *elsestring = '\0';
}
switch (ch) {