static void alias_entry (char *s, ssize_t slen, MUTTMENU *m, int num)
{
- m_strformat(s, slen, NONULL (AliasFmt), alias_format_str,
- ((alias_t **)m->data)[num],
+ m_strformat(s, slen, AliasFmt, alias_format_str, ((alias_t **)m->data)[num],
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
break;
}
- if (optional)
- m_strformat (dest, destlen, ifstr, folder_format_str, data, 0);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elstr, folder_format_str, data, 0);
- return (src);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, optional ? ifstr : elstr, folder_format_str,
+ data, 0);
+
+ return src;
}
#ifdef USE_NNTP
#ifdef USE_NNTP
if (option (OPTNEWS))
- m_strformat(s, slen, NONULL (GroupFormat), newsgroup_format_str,
- (void*)&folder,
+ m_strformat(s, slen, GroupFormat, newsgroup_format_str, &folder,
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
else
#endif
- m_strformat(s, slen, NONULL (FolderFormat), folder_format_str,
- (void *)&folder,
+ m_strformat(s, slen, FolderFormat, folder_format_str, &folder,
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
static void snd_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) {
- int w=(COLS-SW)>blen?blen:COLS-SW;
- m_strformat (b, w, NONULL (AttachFormat), mutt_attach_fmt,
- ((ATTACHPTR **)menu->data)[num],
- M_FORMAT_STAT_FILE | (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0));
+ int w = MIN(COLS-SW, blen);
+
+ m_strformat(b, w, AttachFormat, mutt_attach_fmt,
+ ((ATTACHPTR **)menu->data)[num],
+ M_FORMAT_STAT_FILE | (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0));
}
static void redraw_crypt_lines (HEADER * msg)
static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu,
const char *p)
{
- int w=(COLS-SW)>buflen?buflen:(COLS-SW);
- m_strformat(buf, w, p, compose_format_str, menu, 0);
+ int w = MIN(COLS - SW, buflen);
+ m_strformat(buf, w, p, compose_format_str, menu, 0);
}
/* return values:
*dest = '\0';
}
- if (optional)
- m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
- return (src);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, optional ? ifstr: elstr,
+ mutt_attach_fmt, data, 0);
+ return src;
}
/* Used by the display fucntion to format a line. */
entry.key = key_table[num];
entry.num = num + 1;
- m_strformat(s, l, NONULL (PgpEntryFormat), crypt_entry_fmt,
- (void*)&entry,
+ m_strformat(s, l, PgpEntryFormat, crypt_entry_fmt, &entry,
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
}
}
- if (optional)
- m_strformat(dest, destlen, ifstr, _mutt_fmt_pgp_command, data, 0);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat(dest, destlen, elstr, _mutt_fmt_pgp_command, data, 0);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, optional ? ifstr : elstr,
+ _mutt_fmt_pgp_command, data, 0);
- return (src);
+ return src;
}
static void
mutt_pgp_command(char *d, ssize_t dlen, struct pgp_command_context *cctx,
const char *fmt)
{
- m_strformat(d, dlen, NONULL (fmt), _mutt_fmt_pgp_command, cctx, 0);
+ m_strformat(d, dlen, fmt, _mutt_fmt_pgp_command, cctx, 0);
}
/*
*dest = '\0';
}
- if (optional)
- m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
- return (src);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, optional ? ifstr : elstr,
+ mutt_attach_fmt, data, 0);
+ return src;
}
static void pgp_entry (char *s, ssize_t l, MUTTMENU * menu, int num)
entry.uid = KeyTable[num];
entry.num = num + 1;
- m_strformat(s, l, NONULL (PgpEntryFormat), pgp_entry_fmt,
- (void*)&entry,
+ m_strformat(s, l, PgpEntryFormat, pgp_entry_fmt, &entry,
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
break;
}
- if (optional)
- m_strformat(dest, destlen, ifstr, _mutt_fmt_smime_command, data, 0);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat(dest, destlen, elstr, _mutt_fmt_smime_command, data, 0);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, optional ? ifstr : elstr,
+ _mutt_fmt_smime_command, data, 0);
- return (src);
+ return src;
}
struct smime_command_context *cctx,
const char *fmt)
{
- m_strformat(d, dlen, NONULL (fmt), _mutt_fmt_smime_command, cctx, 0);
+ m_strformat(d, dlen, fmt, _mutt_fmt_smime_command, cctx, 0);
}
static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
return (strstr (cmd, "%f") && strstr (cmd, "%t")) ? 0 : -1;
}
-static char *get_compression_cmd (const char *cmd, const CONTEXT * ctx)
+static char *get_compression_cmd(const char *cmd, const CONTEXT * ctx)
{
- char expanded[_POSIX_PATH_MAX];
-
- m_strformat(expanded, sizeof (expanded), cmd, compresshook_format_str,
- (void *)ctx, 0);
- return m_strdup(expanded);
+ char buf[_POSIX_PATH_MAX];
+ m_strformat(buf, sizeof(buf), cmd, compresshook_format_str, ctx, 0);
+ return m_strdup(buf);
}
int mutt_check_mailbox_compressed (CONTEXT * ctx)
break;
}
- if (optional)
- m_strformat(dest, destlen, ifstr, hdr_format_str, data, flags);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat(dest, destlen, elstr, hdr_format_str, data, flags);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, optional ? ifstr: elstr,
+ hdr_format_str, data, flags);
- return (src);
+ return src;
#undef THREAD_NEW
#undef THREAD_OLD
}
* (i.e. always display the currently opened) */
return 0;
- m_strformat(no, len, NONULL(SidebarNumberFormat), sidebar_number_format,
- idx, 0);
+ m_strformat(no, len, SidebarNumberFormat, sidebar_number_format, idx, 0);
lencnt = m_strlen(no);
if (l > 0 && m_strncmp(sbox, ImapHomeNamespace, l) == 0 &&
}
void menu_status_line (char* buf, ssize_t len, MUTTMENU* menu, const char* p) {
- /*
- * if we have enough space for buffer, format lines to $COLS-$SidebarWidth
- * only to not wrap past end of screen
- */
- int width = COLS - SW;
- m_strformat(buf, (width >= len ? len : (width + 1)), p, status_format_str,
- menu, 0);
+ /*
+ * if we have enough space for buffer, format lines to $COLS-$SidebarWidth
+ * only to not wrap past end of screen
+ */
+ int width = MIN(COLS - SW + 1, len);
+ m_strformat(buf, width, p, status_format_str, menu, 0);
}
{
ssize_t pos = flags & M_FORMAT_ARROWCURSOR ? 3 : 0;
- if (dlen >= 0)
- *dst = '\0';
+ m_strpad(dst, dlen, '\0', pos + 1);
+ if (!fmt)
+ return;
while (*fmt) {
int ch;
if (!conn)
return NULL;
- m_strformat(file, sizeof(file), NONULL(NewsRc), nntp_format_str, NULL, 0);
- mutt_expand_path (file, sizeof (file));
+ m_strformat(file, sizeof(file), NewsRc, nntp_format_str, NULL, 0);
+ mutt_expand_path(file, sizeof(file));
serv = (NNTP_SERVER *) conn->data;
if (serv) {
*dest = 0;
}
- if (optional)
- m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
- return (src);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat(dest, destlen, optional ? ifstr : elstr,
+ mutt_attach_fmt, data, 0);
+ return src;
}
-static void attach_entry (char *b, ssize_t blen, MUTTMENU * menu, int num)
+static void attach_entry(char *b, ssize_t blen, MUTTMENU * menu, int num)
{
- int w=(COLS-SW)>blen?blen:(COLS-SW);
- m_strformat (b, w, NONULL (AttachFormat), mutt_attach_fmt,
- ((ATTACHPTR **) menu->data)[num],
- option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
+ int w = MIN(COLS - SW, blen);
+
+ m_strformat(b, w, AttachFormat, mutt_attach_fmt,
+ ((ATTACHPTR **) menu->data)[num],
+ option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
int mutt_tag_attach (MUTTMENU * menu, int n, int m)
*dest = '\0';
}
- if (optional)
- m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
- else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
+ if (flags & M_FORMAT_OPTIONAL)
+ m_strformat (dest, destlen, optional ? ifstr : elstr,
+ mutt_attach_fmt, data, 0);
return (src);
}
static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num)
{
remailer_t **type2_list = (remailer_t **) menu->data;
- int w = (COLS-SW) > blen ? blen : (COLS-SW);
- m_strformat(b, w, NONULL (MixEntryFormat), mix_entry_fmt,
- type2_list[num],
+ int w = MIN(COLS - SW, blen);
+ m_strformat(b, w, MixEntryFormat, mix_entry_fmt, type2_list[num],
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
if (option (OPTNEWSSEND)) {
char cmd[LONG_STRING];
- m_strformat(cmd, sizeof (cmd), NONULL (Inews), nntp_format_str, 0, 0);
+ m_strformat(cmd, sizeof(cmd), Inews, nntp_format_str, 0, 0);
if (m_strisempty(cmd)) {
i = nntp_post (msg);
unlink (msg);