return 0;
}
-static const format_t *alias_format_str (char *dest, size_t destlen, char op,
- const format_t *src, const char *fmt,
- const char *ifstring __attribute__ ((unused)),
- const char *elsestring __attribute__ ((unused)),
- unsigned long data, format_flag flags __attribute__ ((unused)))
+static const char *
+alias_format_str(char *dest, ssize_t destlen, char op, const char *src,
+ const char *fmt, const char *ifstr __attribute__ ((unused)),
+ const char *elstr __attribute__ ((unused)),
+ anytype data, format_flag flags __attribute__ ((unused)))
{
char tmp[STRING], adr[STRING];
- alias_t *alias = (alias_t *) data;
+ alias_t *alias = data.ptr;
switch (op) {
case 'f':
break;
}
- return (src);
+ return src;
}
-static void alias_entry (char *s, ssize_t slen, MUTTMENU * m, int num)
+static void alias_entry (char *s, ssize_t slen, MUTTMENU *m, int num)
{
- m_strformat (s, slen, NONULL (AliasFmt), (format_t *)alias_format_str,
- (unsigned long)((alias_t **)m->data)[num],
- option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
+ m_strformat(s, slen, NONULL (AliasFmt), alias_format_str,
+ ((alias_t **)m->data)[num],
+ option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
static int alias_tag (MUTTMENU * menu, int n, int m)
static const char *folder_format_str (char *dest, ssize_t destlen, char op,
const char *src, const char *fmt,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+ const char *ifstr,
+ const char *elstr,
+ anytype data, format_flag flags)
{
char fn[STRING], tmp[STRING], permission[11], date[16];
const char *t_fmt;
time_t tnow;
- FOLDER *folder = (FOLDER *) data;
+ FOLDER *folder = data.ptr;
struct passwd *pw;
struct group *gr;
int optional = (flags & M_FORMAT_OPTIONAL);
}
if (optional)
- m_strformat (dest, destlen, ifstring, folder_format_str, data, 0);
+ m_strformat (dest, destlen, ifstr, folder_format_str, data, 0);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elsestring, folder_format_str, data, 0);
+ m_strformat (dest, destlen, elstr, folder_format_str, data, 0);
return (src);
}
#ifdef USE_NNTP
static const char *newsgroup_format_str (char *dest, ssize_t destlen, char op,
const char *src, const char *fmt,
- const char *ifstring,
- const char *elsestring,
- unsigned long data,
- format_flag flags)
+ const char *ifstr,
+ const char *elstr,
+ anytype data, format_flag flags)
{
char fn[STRING], tmp[STRING];
- FOLDER *folder = (FOLDER *) data;
+ FOLDER *folder = data.ptr;
switch (op) {
case 'C':
case 's':
if (flags & M_FORMAT_OPTIONAL) {
if (folder->ff->nd->unread != 0)
- m_strformat (dest, destlen, ifstring, newsgroup_format_str,
+ m_strformat (dest, destlen, ifstr, newsgroup_format_str,
data, flags);
else
- m_strformat (dest, destlen, elsestring, newsgroup_format_str,
+ m_strformat (dest, destlen, elstr, newsgroup_format_str,
data, flags);
}
else if (Context && Context->data == folder->ff->nd) {
#ifdef USE_NNTP
if (option (OPTNEWS))
m_strformat(s, slen, NONULL (GroupFormat), newsgroup_format_str,
- (unsigned long)&folder,
+ (void*)&folder,
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
else
#endif
m_strformat(s, slen, NONULL (FolderFormat), folder_format_str,
- (unsigned long)&folder,
+ (void *)&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,
- (unsigned long) (((ATTACHPTR **) menu->data)[num]),
+ ((ATTACHPTR **)menu->data)[num],
M_FORMAT_STAT_FILE | (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0));
}
static const char *compose_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)
+ const char *ifstr,
+ const char *elstr,
+ anytype data, format_flag flags)
{
char fmt[STRING], tmp[STRING];
int optional = (flags & M_FORMAT_OPTIONAL);
- MUTTMENU *menu = (MUTTMENU *) data;
+ MUTTMENU *menu = data.ptr;
*buf = 0;
switch (op) {
}
if (optional)
- compose_status_line (buf, buflen, menu, ifstring);
+ compose_status_line (buf, buflen, menu, ifstr);
else if (flags & M_FORMAT_OPTIONAL)
- compose_status_line (buf, buflen, menu, elsestring);
+ compose_status_line (buf, buflen, menu, elstr);
return (src);
}
const char *p)
{
int w=(COLS-SW)>buflen?buflen:(COLS-SW);
- m_strformat(buf, w, p, compose_format_str, (unsigned long)menu, 0);
+ m_strformat(buf, w, p, compose_format_str, menu, 0);
}
/* return values:
static const char *
crypt_entry_fmt (char *dest, ssize_t destlen, char op,
const char *src, const char *prefix,
- const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ const char *ifstr, const char *elstr,
+ anytype data, format_flag flags)
{
char fmt[16];
crypt_entry_t *entry;
const char *s = NULL;
unsigned long val;
- entry = (crypt_entry_t *) data;
+ entry = data.ptr;
key = entry->key;
/* if (isupper ((unsigned char) op)) */
}
if (optional)
- m_strformat (dest, destlen, ifstring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elsestring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
return (src);
}
entry.num = num + 1;
m_strformat(s, l, NONULL (PgpEntryFormat), crypt_entry_fmt,
- (unsigned long) &entry,
+ (void*)&entry,
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
static const char *
_mutt_fmt_pgp_command(char *dest, ssize_t destlen,
char op, const char *src, const char *prefix,
- const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ const char *ifstr, const char *elstr,
+ anytype data, format_flag flags)
{
char fmt[16];
- struct pgp_command_context *cctx = (struct pgp_command_context *) data;
+ struct pgp_command_context *cctx = data.ptr;
int optional = (flags & M_FORMAT_OPTIONAL);
switch (op) {
}
if (optional)
- m_strformat(dest, destlen, ifstring, _mutt_fmt_pgp_command, data, 0);
+ m_strformat(dest, destlen, ifstr, _mutt_fmt_pgp_command, data, 0);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat(dest, destlen, elsestring, _mutt_fmt_pgp_command, data, 0);
+ m_strformat(dest, destlen, elstr, _mutt_fmt_pgp_command, data, 0);
return (src);
}
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,
- (unsigned long) cctx, 0);
+ m_strformat(d, dlen, NONULL (fmt), _mutt_fmt_pgp_command, cctx, 0);
}
/*
static const char *
pgp_entry_fmt (char *dest, ssize_t destlen, char op,
const char *src, const char *prefix,
- const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ const char *ifstr, const char *elstr,
+ anytype data, format_flag flags)
{
char fmt[16];
pgp_entry_t *entry;
int kflags = 0;
int optional = (flags & M_FORMAT_OPTIONAL);
- entry = (pgp_entry_t *) data;
+ entry = data.ptr;
uid = entry->uid;
key = uid->parent;
pkey = pgp_principal_key (key);
}
if (optional)
- m_strformat (dest, destlen, ifstring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elsestring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
return (src);
}
entry.num = num + 1;
m_strformat(s, l, NONULL (PgpEntryFormat), pgp_entry_fmt,
- (unsigned long)&entry,
+ (void*)&entry,
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
static const char *
_mutt_fmt_smime_command (char *dest, ssize_t destlen, char op,
const char *src, const char *prefix,
- const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+ const char *ifstr, const char *elstr,
+ anytype data, format_flag flags)
{
char fmt[16];
- struct smime_command_context *cctx = (struct smime_command_context *) data;
+ struct smime_command_context *cctx = data.ptr;
int optional = (flags & M_FORMAT_OPTIONAL);
switch (op) {
}
if (optional)
- m_strformat(dest, destlen, ifstring, _mutt_fmt_smime_command, data, 0);
+ m_strformat(dest, destlen, ifstr, _mutt_fmt_smime_command, data, 0);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat(dest, destlen, elsestring, _mutt_fmt_smime_command, data, 0);
+ m_strformat(dest, destlen, elstr, _mutt_fmt_smime_command, data, 0);
return (src);
}
struct smime_command_context *cctx,
const char *fmt)
{
- m_strformat(d, dlen, NONULL (fmt), _mutt_fmt_smime_command,
- (unsigned long)cctx, 0);
+ m_strformat(d, dlen, NONULL (fmt), _mutt_fmt_smime_command, cctx, 0);
}
static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
#include "rx.h"
#include "url.h"
+typedef union __attribute__((transparent_union)) anytype {
+ void *ptr;
+ long li;
+ int i;
+ short si;
+} anytype;
+
#endif
static const char *compresshook_format_str (char *dest, ssize_t destlen,
char op, const char *src,
const char *fmt,
- const char *ifstring __attribute__ ((unused)),
- const char *elsestring __attribute__ ((unused)),
- unsigned long data,
+ const char *ifstr __attribute__ ((unused)),
+ const char *elstr __attribute__ ((unused)),
+ anytype data,
format_flag flags __attribute__ ((unused)))
{
char tmp[STRING];
- CONTEXT *ctx = (CONTEXT *) data;
+ CONTEXT *ctx = data.ptr;
switch (op) {
case 'f':
char expanded[_POSIX_PATH_MAX];
m_strformat(expanded, sizeof (expanded), cmd, compresshook_format_str,
- (unsigned long)ctx, 0);
+ (void *)ctx, 0);
return m_strdup(expanded);
}
char op,
const char *src,
const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+ const char *ifstr,
+ const char *elstr,
+ anytype data, format_flag flags)
{
- struct hdr_format_info *hfi = (struct hdr_format_info *) data;
+ struct hdr_format_info *hfi = data.ptr;
HEADER *hdr, *htmp;
CONTEXT *ctx;
char fmt[STRING], buf2[STRING], ch, *p;
}
if (optional)
- m_strformat(dest, destlen, ifstring, hdr_format_str,
- (unsigned long)hfi, flags);
+ m_strformat(dest, destlen, ifstr, hdr_format_str, data, flags);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat(dest, destlen, elsestring, hdr_format_str,
- (unsigned long)hfi, flags);
+ m_strformat(dest, destlen, elstr, hdr_format_str, data, flags);
return (src);
#undef THREAD_NEW
hfi.hdr = hdr;
hfi.ctx = ctx;
- m_strformat(dest, destlen, s, hdr_format_str, (unsigned long) &hfi, flags);
+ m_strformat(dest, destlen, s, hdr_format_str, &hfi, flags);
}
static const char* sidebar_number_format (char* dest, ssize_t destlen, char op,
const char* src, const char* fmt,
const char* ifstr, const char* elstr,
- unsigned long data, format_flag flags) {
+ anytype data, format_flag flags) {
char tmp[STRING];
- BUFFY* b = Incoming.arr[data];
+ BUFFY* b = Incoming.arr[data.i];
int opt = flags & M_FORMAT_OPTIONAL;
int c = Context && !m_strcmp(Context->path, b->path);
* %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)
+ const char *ifstr,
+ const char *elstr,
+ anytype data, format_flag flags)
{
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) {
}
if (optional)
- menu_status_line (buf, buflen, menu, ifstring);
+ menu_status_line (buf, buflen, menu, ifstr);
else if (flags & M_FORMAT_OPTIONAL)
- menu_status_line (buf, buflen, menu, elsestring);
+ menu_status_line (buf, buflen, menu, elstr);
return (src);
}
* only to not wrap past end of screen
*/
int width = COLS - SW;
- m_strformat (buf, (width >= len ? len : (width + 1)),
- p, status_format_str,
- (unsigned long) menu, 0);
+ m_strformat(buf, (width >= len ? len : (width + 1)), p, status_format_str,
+ menu, 0);
}
}
ssize_t m_strformat(char *dst, ssize_t dlen, const char *fmt,
- format_t *callback, unsigned long data, format_flag flags)
+ format_t *callback, anytype cdata, format_flag flags)
{
ssize_t pos = flags & M_FORMAT_ARROWCURSOR ? 3 : 0;
int ch;
if (*fmt == '%') {
- char ifstring[STRING], elsestring[STRING], prefix[STRING];
+ char ifstr[STRING], elstr[STRING], prefix[STRING];
- *ifstring = *elsestring = *prefix = '\0';
+ *ifstr = *elstr = *prefix = '\0';
if (*++fmt == '%') {
pos += m_strputc(dst + pos, dlen - pos, *fmt++);
/* eat the `if' part of the string */
iflen = strcspn(fmt, "?&");
- m_strncpy(ifstring, ssizeof(ifstring), fmt, iflen);
+ m_strncpy(ifstr, ssizeof(ifstr), fmt, iflen);
fmt += iflen;
/* eat the `else' part of the string (optional) */
fmt++; /* skip the & */
p = m_strchrnul(fmt, '?');
- m_strncpy(elsestring, ssizeof(elsestring), fmt, p - fmt);
+ m_strncpy(elstr, ssizeof(elstr), fmt, p - fmt);
fmt = p;
if (!*fmt++) /* move past the trailing `?' */
ch = *fmt++; /* pad char */
if (COLS - SW > col) {
- m_strformat(buf, sizeof(buf), fmt, callback, data, flags);
+ m_strformat(buf, sizeof(buf), fmt, callback, cdata, flags);
pos += m_strpad(dst + pos, dlen - pos, ch,
COLS - SW - col - mutt_strwidth(buf));
pos += m_strcpy(dst + pos, dlen - pos, buf);
/* use callback function to handle this case */
fmt = callback(buf, sizeof (buf), ch, fmt, prefix,
- ifstring, elsestring, data, flags);
+ ifstr, elstr, cdata, flags);
if (lower)
m_strtolower(buf);
return 0;
}
-const char *nntp_format_str (char *dest, ssize_t destlen, char op,
- const char *src, const char *fmt,
- const char *ifstring, const char *elsestring,
- unsigned long data, format_flag flags)
+const char *nntp_format_str(char *dest, ssize_t destlen, char op,
+ const char *src, const char *fmt,
+ const char *ifstr __attribute__((unused)),
+ const char *elstr __attribute__((unused)),
+ anytype data __attribute__((unused)),
+ format_flag flags __attribute__((unused)))
{
char fn[STRING], tmp[STRING];
if (!conn)
return NULL;
- m_strformat (file, sizeof (file), NONULL (NewsRc), nntp_format_str, 0,
- 0);
+ m_strformat(file, sizeof(file), NONULL(NewsRc), nntp_format_str, NULL, 0);
mutt_expand_path (file, sizeof (file));
serv = (NNTP_SERVER *) conn->data;
void nntp_buffy (char* dst, ssize_t dstlen);
void nntp_expand_path (char *, ssize_t, ACCOUNT *);
void nntp_logout_all(void);
-const char *nntp_format_str (char *, ssize_t, char, const char *, const char *,
- const char *, const char *, unsigned long,
- format_flag);
+const char *nntp_format_str(char *, ssize_t, char, const char *, const char *,
+ const char *, const char *, anytype, format_flag);
void nntp_sync_sidebar (NNTP_DATA*);
WHERE NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);
typedef const char *format_t (char *, ssize_t, char, const char *,
const char *, const char *, const char *,
- unsigned long, format_flag);
+ anytype, format_flag);
ssize_t m_strformat(char *, ssize_t, const char *, format_t *,
- unsigned long, format_flag);
+ anytype, format_flag);
void set_quadoption (int, int);
int query_quadoption (int, const char *);
* %s = size
* %u = unlink
*/
-const char *mutt_attach_fmt (char *dest,
- ssize_t destlen,
+const char *mutt_attach_fmt (char *dest, ssize_t destlen,
char op,
const char *src,
const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+ const char *ifstr,
+ const char *elstr,
+ anytype data, format_flag flags)
{
char fmt[16];
char tmp[STRING];
char charset[STRING];
- ATTACHPTR *aptr = (ATTACHPTR *) data;
+ ATTACHPTR *aptr = data.ptr;
int optional = (flags & M_FORMAT_OPTIONAL);
ssize_t l;
}
if (optional)
- m_strformat (dest, destlen, ifstring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elsestring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
return (src);
}
{
int w=(COLS-SW)>blen?blen:(COLS-SW);
m_strformat (b, w, NONULL (AttachFormat), mutt_attach_fmt,
- (unsigned long) (((ATTACHPTR **) menu->data)[num]),
+ ((ATTACHPTR **) menu->data)[num],
option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
}
char op,
const char *src,
const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags);
+ const char *ifstr,
+ const char *elstr,
+ anytype data, format_flag flags);
int mutt_tag_attach (MUTTMENU * menu, int n, int m);
* %a address
*
*/
-static const char *mix_entry_fmt (char *dest,
- ssize_t destlen,
- char op,
- const char *src,
- const char *prefix,
- const char *ifstring,
- const char *elsestring,
- unsigned long data, format_flag flags)
+static const char *
+mix_entry_fmt (char *dest, ssize_t destlen, char op, const char *src,
+ const char *prefix, const char *ifstr,
+ const char *elstr, anytype data, format_flag flags)
{
char fmt[16];
- remailer_t *remailer = (remailer_t *) data;
+ remailer_t *remailer = data.ptr;
int optional = (flags & M_FORMAT_OPTIONAL);
switch (op) {
}
if (optional)
- m_strformat (dest, destlen, ifstring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, ifstr, mutt_attach_fmt, data, 0);
else if (flags & M_FORMAT_OPTIONAL)
- m_strformat (dest, destlen, elsestring, mutt_attach_fmt, data, 0);
+ m_strformat (dest, destlen, elstr, mutt_attach_fmt, data, 0);
return (src);
}
int w = (COLS-SW) > blen ? blen : (COLS-SW);
m_strformat(b, w, NONULL (MixEntryFormat), mix_entry_fmt,
- (unsigned long) type2_list[num],
+ 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), NONULL (Inews), nntp_format_str, 0, 0);
if (m_strisempty(cmd)) {
i = nntp_post (msg);
unlink (msg);