* please see the file GPL in the top level source directory.
*/
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <lib-lib/mem.h>
-#include <lib-lib/str.h>
-#include <lib-lib/macros.h>
-#include <lib-lib/mapping.h>
+#include <lib-lib/lib-lib.h>
#include <lib-ui/curses.h>
#include <lib-ui/menu.h>
+#include <lib-mx/mx.h>
#include "mutt.h"
#include "sort.h"
-#include "mx.h"
#include "buffy.h"
-
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-
#define SW (option(OPTMBOXPANE)?SidebarWidth:0)
static char *get_sort_str (char *buf, ssize_t buflen, int method)
* %t = # of tagged messages [option]
* %v = Madmutt version
* %V = currently active limit pattern [option] */
-static const char *status_format_str (char *buf, ssize_t buflen, char op,
- const char *src, const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+static const char *
+status_format_str(char *buf, ssize_t buflen, char op, const char *src,
+ const char *prefix, const char *ifstr, const char *elstr,
+ anytype data, format_flag flags)
{
- char fmt[SHORT_STRING], tmp[SHORT_STRING];
+ char fmt[STRING], tmp[STRING];
const char *cp, *p;
int count, optional = (flags & M_FORMAT_OPTIONAL);
- MUTTMENU *menu = (MUTTMENU *) data;
+ MUTTMENU *menu = data.ptr;
*buf = 0;
switch (op) {
case 'B':
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
- if (Context && Context->compressinfo && Context->realpath) {
+ if (Context && Context->cinfo && Context->realpath) {
if ((p = strrchr (Context->realpath, '/')))
m_strcpy(tmp, sizeof(tmp), p + 1);
else
case 'h':
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
- snprintf (buf, buflen, fmt, NONULL (Hostname));
+ snprintf (buf, buflen, fmt, NONULL (MCore.shorthost));
break;
case 'f':
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
- if (Context && Context->compressinfo && Context->realpath) {
+ if (Context && Context->cinfo && Context->realpath) {
m_strcpy(tmp, sizeof(tmp), Context->realpath);
mutt_pretty_mailbox (tmp);
- }
- else
+ } else
if (Context && Context->path) {
m_strcpy(tmp, sizeof(tmp), Context->path);
mutt_pretty_mailbox (tmp);
- }
- else
+ } else {
m_strcpy(tmp, sizeof(tmp), _("(no mailbox)"));
+ }
snprintf (buf, buflen, fmt, tmp);
break;
break;
case 'v':
- m_strcpy(buf, buflen, mutt_make_version(0));
+ m_strcpy(buf, buflen, mutt_make_version());
break;
case 'V':
return (src);
default:
- snprintf (buf, buflen, "%%%s%c", prefix, op);
+ *buf = 0;
break;
}
- if (optional)
- menu_status_line (buf, buflen, menu, ifstring);
- else if (flags & M_FORMAT_OPTIONAL)
- menu_status_line (buf, buflen, menu, elsestring);
+ if (flags & M_FORMAT_OPTIONAL)
+ menu_status_line(buf, buflen, menu, optional ? ifstr : elstr);
return (src);
}
-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;
- mutt_FormatString (buf, (width >= len ? len : (width + 1)),
- p, status_format_str,
- (unsigned long) menu, 0);
+void menu_status_line(char* buf, ssize_t len, MUTTMENU* menu, const char* p)
+{
+ m_strformat(buf, len, COLS - SW, p, status_format_str, menu, 0);
}