alias_t *pb = *(alias_t **) b;
int r = m_strcasecmp(pa->name, pb->name);
- return (RSORT (r));
+ return RSORT (r);
}
static int alias_SortAddress (const void *a, const void *b)
r = -1;
else
r = ascii_strcasecmp (pa->mailbox, pb->mailbox);
- return (RSORT (r));
+ return RSORT (r);
}
void mutt_alias_menu (char *buf, size_t buflen, alias_t * aliases)
if ((p = getenv ("MM_NOASK")) != NULL && *p) {
if (m_strcmp(p, "1") == 0)
- return (1);
+ return 1;
m_strcpy(tmp, sizeof(tmp), p);
p = tmp;
if ((q = strrchr (p, '/')) != NULL) {
if (*(q + 1) == '*') {
if (ascii_strncasecmp (buf, p, q - p) == 0)
- return (1);
+ return 1;
} else {
if (ascii_strcasecmp (buf, p) == 0)
- return (1);
+ return 1;
}
} else {
lng = m_strlen(p);
if (buf[lng] == '/' && m_strncasecmp(buf, p, lng) == 0)
- return (1);
+ return 1;
}
p = NULL;
}
}
- return (0);
+ return 0;
}
void mutt_check_lookup_list (BODY * b, char *type, int len)
if ((s.fpout = mutt_save_attachment_open (path, flags)) == NULL) {
mutt_perror ("fopen");
- return (-1);
+ return -1;
}
fseeko ((s.fpin = fp), m->offset, 0);
mutt_decode_attachment (m, &s);
if (m_fclose(&s.fpout) != 0) {
mutt_perror ("fclose");
- return (-1);
+ return -1;
}
}
} else {
if ((ofp = fopen (m->filename, "r")) == NULL) {
mutt_perror ("fopen");
- return (-1);
+ return -1;
}
if ((nfp = mutt_save_attachment_open (path, flags)) == NULL) {
mutt_perror ("fopen");
m_fclose(&ofp);
- return (-1);
+ return -1;
}
if (mutt_copy_stream (ofp, nfp) == -1) {
m_fclose(&ofp);
m_fclose(&nfp);
- return (-1);
+ return -1;
}
m_fclose(&ofp);
m_fclose(&nfp);
if (s.fpout == NULL) {
close(pathfd);
mutt_perror ("fopen");
- return (-1);
+ return -1;
}
if (fp == NULL) {
if (stat (m->filename, &st) == -1) {
mutt_perror ("stat");
m_fclose(&s.fpout);
- return (-1);
+ return -1;
}
if ((s.fpin = fopen (m->filename, "r")) == NULL) {
mutt_perror ("fopen");
- return (-1);
+ return -1;
}
saved_encoding = m->encoding;
m_fclose(&s.fpin);
}
- return (0);
+ return 0;
}
/* Ok, the difference between send and receive:
if ((ifp = fopen (newfile, "r")) == NULL) {
mutt_perror ("fopen");
rfc1524_entry_delete(&entry);
- return (0);
+ return 0;
}
if ((thepid = mutt_create_filter (command, &fpout, NULL, NULL)) < 0) {
unlink (newfile);
rfc1524_entry_delete(&entry);
- return (1);
+ return 1;
}
tok = mime_which_token(type, -1);
if (!hdr || !hdr->content || !((regex_t*) AttachRemindRegexp.rx) ||
(fp = safe_fopen (hdr->content->filename, "r")) == NULL)
- return (0);
+ return 0;
while (!found && fgets (buf, sizeof (buf), fp)) {
p = buf;
}
m_fclose(&fp);
- return (found);
+ return found;
}
}
if (BuffyCount > 0 && force != 2)
sidebar_draw ();
- return (BuffyCount);
+ return BuffyCount;
}
int buffy_list (void)
if (reverse)
Sort |= SORT_REVERSE;
- return (Sort != method ? 0 : -1); /* no need to resort if it's the same */
+ return Sort != method ? 0 : -1; /* no need to resort if it's the same */
}
/* invoke a command in a subshell */
mutt_set_flag (Context, h, M_TAG, 0);
mutt_set_flag (Context, h, M_APPENDED, 1);
}
- return (0);
+ return 0;
}
/* returns 0 if the copy/save was successful, or -1 on error/abort */
mutt_pretty_mailbox (buf);
if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1)
- return (-1);
+ return -1;
if (*redraw != REDRAW_FULL) {
if (!h)
}
if (!buf[0])
- return (-1);
+ return -1;
/* This is an undocumented feature of ELM pointed out to me by Felix von
* Leitner <leitner@prz.fu-berlin.de>
if (h) {
if (_mutt_save_message (h, &ctx, delete, decode, decrypt) != 0) {
mx_close_mailbox (&ctx, NULL);
- return (-1);
+ return -1;
}
} else {
for (i = 0; i < Context->vcount; i++) {
if (_mutt_save_message (Context->hdrs[Context->v2r[i]], &ctx, delete,
decode, decrypt) != 0) {
mx_close_mailbox (&ctx, NULL);
- return (-1);
+ return -1;
}
}
}
}
mutt_clear_error ();
- return (0);
+ return 0;
}
return -1;
idx[x] = idx[x + 1];
menu->max = --(*idxlen);
- return (0);
+ return 0;
}
static void update_idx (MUTTMENU * menu, ATTACHPTR ** idx, short idxlen)
case 0:
*buf = 0;
- return (src);
+ return src;
default:
*buf = 0;
if (flags & M_FORMAT_OPTIONAL)
compose_status_line(buf, buflen, menu, optional ? ifstr : elstr);
- return (src);
+ return src;
}
static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu,
p_delete(&idx);
- return (r);
+ return r;
}
}
if (!ignore && fputs (buf, out) == EOF)
- return (-1);
+ return -1;
}
return 0;
}
p_delete(&headers[x]);
p_delete(&headers);
- if (error)
- return (-1);
- return (0);
+ return error ? -1 : 0;
}
/* flags
if (mutt_copy_hdr (in, out, h->offset, h->content->offset, flags, prefix) ==
-1)
- return (-1);
+ return -1;
if (flags & CH_TXTPLAIN) {
char chsbuf[STRING];
string_list_t *listp = h->env->in_reply_to;
if (fputs ("In-Reply-To: ", out) == EOF)
- return (-1);
+ return -1;
for (; listp; listp = listp->next)
if ((fputs (listp->data, out) == EOF) || (fputc (' ', out) == EOF))
- return (-1);
+ return -1;
if (fputc ('\n', out) == EOF)
- return (-1);
+ return -1;
}
if (h->env->refs_changed && h->env->references) {
string_list_t *listp = h->env->references, *refs = NULL, *t;
if (fputs ("References: ", out) == EOF)
- return (-1);
+ return -1;
/* Mutt stores references in reverse order, thus we create
* a reordered refs list that we can put in the headers */
for (; refs; refs = refs->next)
if ((fputs (refs->data, out) == EOF) || (fputc (' ', out) == EOF))
- return (-1);
+ return -1;
/* clearing refs from memory */
for (t = refs; refs; refs = t->next, t = refs)
p_delete(&refs);
if (fputc ('\n', out) == EOF)
- return (-1);
+ return -1;
}
if (h->old || h->read) {
if (fputs ("Status: ", out) == EOF)
- return (-1);
+ return -1;
if (h->read) {
if (fputs ("RO", out) == EOF)
- return (-1);
+ return -1;
}
else if (h->old) {
if (fputc ('O', out) == EOF)
- return (-1);
+ return -1;
}
if (fputc ('\n', out) == EOF)
- return (-1);
+ return -1;
}
if (h->flagged || h->replied) {
if (fputs ("X-Status: ", out) == EOF)
- return (-1);
+ return -1;
if (h->replied) {
if (fputc ('A', out) == EOF)
- return (-1);
+ return -1;
}
if (h->flagged) {
if (fputc ('F', out) == EOF)
- return (-1);
+ return -1;
}
if (fputc ('\n', out) == EOF)
- return (-1);
+ return -1;
}
}
}
if (flags & CH_PREFIX)
fputs (prefix, out);
if (fputc ('\n', out) == EOF) /* add header terminator */
- return (-1);
+ return -1;
}
if (ferror (out) || feof (out))
return -1;
- return (0);
+ return 0;
}
/* Count the number of lines and bytes to be deleted in this body*/
if ((flags & M_CM_DECODE_PGP) && (hdr->security & APPLICATION_PGP) &&
hdr->content->type == TYPEMULTIPART) {
if (crypt_pgp_decrypt_mime (fpin, &fp, hdr->content, &cur))
- return (-1);
+ return -1;
fputs ("MIME-Version: 1.0\n", fpout);
}
if ((flags & M_CM_DECODE_SMIME) && (hdr->security & APPLICATION_SMIME)
&& hdr->content->type == TYPEAPPLICATION) {
if (crypt_smime_decrypt_mime (fpin, &fp, hdr->content, &cur))
- return (-1);
+ return -1;
}
mutt_write_mime_header (cur, fpout);
if (mutt_copy_bytes (fp, fpout, cur->length) == -1) {
m_fclose(&fp);
body_list_wipe(&cur);
- return (-1);
+ return -1;
}
body_list_wipe(&cur);
m_fclose(&fp);
fseeko(fpin, hdr->offset, 0);
if (fgets (buf, sizeof (buf), fpin) == NULL)
- return (-1);
+ return -1;
if ((msg = mx_open_new_message (dest, hdr, is_from (buf, NULL, 0, NULL) ? 0 : M_ADD_FROM)) == NULL)
- return (-1);
+ return -1;
if (dest->magic == M_MBOX)
chflags |= CH_FROM | CH_FORCE_FROM;
chflags |= (dest->magic == M_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
if (needpass == -1) {
state_attach_puts (_("[-- Error: could not find beginning"
" of PGP message! --]\n\n"), s);
- return (-1);
+ return -1;
}
- return (err);
+ return err;
}
/* MIME handler for pgp/mime encrypted messages. */
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: malformed PGP/MIME message! --]\n\n"),
s);
- return (-1);
+ return -1;
}
/* Move forward to the application/pgp-encrypted body. */
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: could not create temporary file! "
"--]\n"), s);
- return (-1);
+ return -1;
}
tattach = decrypt_part (a, s, fpout, 0, &is_signed);
m_fclose(&fpout);
mutt_unlink (tempfile);
- return (rc);
+ return rc;
}
/* Support for application/smime */
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: could not create temporary file! "
"--]\n"), s);
- return (-1);
+ return -1;
}
tattach = decrypt_part (a, s, fpout, 1, &is_signed);
m_fclose(&fpout);
mutt_unlink (tempfile);
- return (rc);
+ return rc;
}
static int crypt_compare_address (const void *a, const void *b)
{
- return ((PgpSortKeys & SORT_REVERSE) ? !_crypt_compare_address (a, b)
- : _crypt_compare_address (a, b));
+ return !(PgpSortKeys & SORT_REVERSE) == _crypt_compare_address(a, b);
}
static int crypt_compare_keyid (const void *a, const void *b)
{
- return ((PgpSortKeys & SORT_REVERSE) ? !_crypt_compare_keyid (a, b)
- : _crypt_compare_keyid (a, b));
+ return !(PgpSortKeys & SORT_REVERSE) == _crypt_compare_keyid(a, b);
}
/* Compare 2 creation dates and the addresses. For sorting. */
static int crypt_compare_date (const void *a, const void *b)
{
- return ((PgpSortKeys & SORT_REVERSE) ? !_crypt_compare_date (a, b)
- : _crypt_compare_date (a, b));
+ return !(PgpSortKeys & SORT_REVERSE) == _crypt_compare_date(a, b);
}
/* Compare two trust values, the key length, the creation dates. the
if ((r = m_strcasecmp((*s)->uid, (*t)->uid)))
return r > 0;
- return (m_strcasecmp(crypt_keyid ((*s)), crypt_keyid ((*t)))) > 0;
+ return m_strcasecmp(crypt_keyid(*s), crypt_keyid(*t)) > 0;
}
static int crypt_compare_trust (const void *a, const void *b)
{
- return ((PgpSortKeys & SORT_REVERSE) ? !_crypt_compare_trust (a, b)
- : _crypt_compare_trust (a, b));
+ return !(PgpSortKeys & SORT_REVERSE) == _crypt_compare_trust(a, b);
}
/* Print the X.500 Distinguished Name part KEY from the array of parts
if (!(tmp_pbody = crypt_smime_build_smime_entity (tmp_smime_pbody,
keylist))) {
/* signed ? free it! */
- return (-1);
+ return -1;
}
/* free tmp_body if messages was signed AND encrypted ... */
if (tmp_smime_pbody != msg->content && tmp_smime_pbody != tmp_pbody) {
body_list_wipe(&tmp_pgp_pbody->next);
}
- return (-1);
+ return -1;
}
/* destroy temporary signature envelope when doing retainable
if (s->flags & M_DISPLAY && sigcnt)
state_attach_puts (_("\n[-- End of signed data --]\n"), s);
- return (rc);
+ return rc;
}
static int _mutt_check_traditional_pgp (HEADER * h, int *redraw)
if ((Sort & SORT_MASK) != SORT_THREADS) {
mutt_error _("Threading is not enabled.");
- return (-1);
+ return -1;
}
if (!subthread)
mutt_set_flag (Context, cur->message, flag, bf);
if ((cur = cur->child) == NULL)
- return (0);
+ return 0;
for (;;) {
if (cur->message)
while (!cur->next) {
cur = cur->parent;
if (cur == start)
- return (0);
+ return 0;
}
cur = cur->next;
}
p_delete(&(stte.line));
p_delete(&(stte.param));
- return (0);
+ return 0;
}
#define TXTHTML 1
if (mustfree)
body_list_wipe(&a);
- return (rc);
+ return rc;
}
/* handles message/rfc822 body parts */
a->encoding == ENCUUENCODED)
body_list_wipe(&b);
- return (rc);
+ return rc;
}
/* returns 1 if decoding the attachment will produce output */
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
if (mutt_is_autoview (a, type))
- return (rfc1524_mailcap_lookup (a, type, NULL, M_AUTOVIEW));
+ return rfc1524_mailcap_lookup (a, type, NULL, M_AUTOVIEW);
else if (a->type == TYPETEXT)
- return (1);
+ return 1;
else if (a->type == TYPEMESSAGE)
- return (1);
+ return 1;
else if (a->type == TYPEMULTIPART) {
BODY *p;
int tok = mime_which_token(a->subtype, -1);
for (p = a->parts; p; p = p->next) {
if (mutt_can_decode (p))
- return (1);
+ return 1;
}
}
else if (a->type == TYPEAPPLICATION) {
if (mutt_is_application_pgp(a))
- return (1);
+ return 1;
if (mutt_is_application_smime (a))
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
static int multipart_handler (BODY * a, STATE * s)
a->encoding == ENCUUENCODED)
body_list_wipe(&b);
- return (rc);
+ return rc;
}
static int autoview_handler (BODY * a, STATE * s)
if ((fpin = safe_fopen (tempfile, "w+")) == NULL) {
mutt_perror ("fopen");
rfc1524_entry_delete(&entry);
- return (-1);
+ return -1;
}
mutt_copy_bytes (s->fpin, fpin, a->length);
mutt_clear_error ();
}
rfc1524_entry_delete(&entry);
- return (rc);
+ return rc;
}
static int external_body_handler (BODY * b, STATE * s)
state_mark_attach (s);
state_puts (_("[-- Error: message/external-body has no access-type parameter --]\n"), s);
}
- return (-1);
+ return -1;
}
expiration = parameter_getval(b->parameter, "expiration");
CH_DECODE, NULL);
}
}
- return (0);
+ return 0;
}
static void mutt_decode_base64(STATE *s, long len, int istext, iconv_t cd)
bail:
s->flags = oflags;
- return (rc);
+ return rc;
}
/* first look in the generic map for the function */
for (i = 0; OpGeneric[i].name; i++)
if (OpGeneric[i].op == op)
- return (&OpGeneric[i]);
+ return &OpGeneric[i];
}
if ((map = km_get_table (menu))) {
for (i = 0; map[i].name; i++)
if (map[i].op == op)
- return (&map[i]);
+ return &map[i];
}
- return (NULL);
+ return NULL;
}
static int print_macro (FILE * f, int maxwidth, const char **macro)
fprintf (f, "?");
}
}
- return (maxwidth - n);
+ return maxwidth - n;
}
static int pad (FILE * f, int col, int i)
if (col < i) {
snprintf (fmt, sizeof (fmt), "%%-%ds", i - col);
fprintf (f, fmt, "");
- return (i);
+ return i;
}
fputc (' ', f);
- return (col + 1);
+ return col + 1;
}
static void help_format_line (FILE * f, int ismacro,
if (!(idata = imap_conn_find (&(mx.account), 0))) {
p_delete(&mx.mbox);
- return (-1);
+ return -1;
}
conn = idata->conn;
if (imap_create_mailbox (idata, mailbox) < 0)
return -1;
- return (0);
+ return 0;
}
/* imap_logout: Gracefully log out of server. */
matchlen = m_strlen(dest);
if (!Incoming.len)
- return (-1);
+ return -1;
for (i = 0; i < Incoming.len; i++) {
mailbox = Incoming.arr[i];
if (!m_strncmp(dest, mailbox->path, matchlen)) {
IMAP_DATA *imap_data;
if (!ctx)
- return (-1);
+ return -1;
imap_data = (IMAP_DATA *) ctx->data;
int imap_is_magic (const char* path, struct stat* st __attribute__ ((unused))) {
url_scheme_t s;
if (!path || !*path)
- return (-1);
+ return -1;
s = url_check_scheme (NONULL (path));
- return ((s == U_IMAP || s == U_IMAPS) ? M_IMAP : -1);
+ return (s == U_IMAP || s == U_IMAPS) ? M_IMAP : -1;
}
static int acl_check_imap (CONTEXT* ctx, int bit) {
static int _imap_check_mailbox (CONTEXT* ctx,
int* index_hint,
int lock __attribute__ ((unused))) {
- return (imap_check_mailbox (ctx, index_hint, 0));
+ return imap_check_mailbox (ctx, index_hint, 0);
}
static int imap_commit_message (MESSAGE* msg, CONTEXT* ctx) {
if ((r = m_fclose(&msg->fp)) == 0)
r = imap_append_message (ctx, msg);
- return (r);
+ return r;
}
mx_t const imap_mx = {
char *pn;
if (!(pc = strchr (buf, '{')))
- return (-1);
+ return -1;
pc++;
pn = pc;
while (isdigit ((unsigned char) *pc))
pc++;
*pc = 0;
*bytes = atoi (pn);
- return (0);
+ return 0;
}
/* imap_get_qualifier: in a tagged response, skip tag and status for
int flag = -1;
if (!dst)
- return (0);
+ return 0;
if (ascii_strncasecmp (val, "yes", 3) == 0)
flag = 1;
else if (ascii_strncasecmp (val, "no", 2) == 0)
flag = 0;
if (flag < 0)
- return (0);
+ return 0;
if (flag)
set_option (dst->data);
else
unset_option (dst->data);
- return (1);
+ return 1;
}
static void num_to_string (char* dst, ssize_t dstlen,
char* t = NULL;
if (!dst)
- return (0);
+ return 0;
num = strtol (val, &t, 0);
snprintf (errbuf, errlen, _("'%s' is invalid for $%s"),
val, dst->option);
}
- return (0);
+ return 0;
}
/* just temporarily accept new val so that check_special for
if (!check_special (dst->option, (unsigned long) num, errbuf, errlen)) {
*((short*) dst->data) = old;
- return (0);
+ return 0;
}
- return (1);
+ return 1;
}
static void str_to_string (char* dst, ssize_t dstlen,
char path[_POSIX_PATH_MAX];
if (!dst)
- return (0);
+ return 0;
if (m_strisempty(val)) {
p_delete((char**) dst->data);
- return (1);
+ return 1;
}
path[0] = '\0';
m_strcpy(path, sizeof(path), val);
mutt_expand_path (path, sizeof(path));
m_strreplace((char **) dst->data, path);
- return (1);
+ return 1;
}
static int str_from_string (struct option_t* dst, const char* val,
char* errbuf, ssize_t errlen) {
if (!dst)
- return (0);
+ return 0;
if (!check_special (dst->option, (unsigned long) val, errbuf, errlen))
- return (0);
+ return 0;
m_strreplace((char**) dst->data, val);
- return (1);
+ return 1;
}
static void quad_to_string (char* dst, ssize_t dstlen,
int flag = -1;
if (!dst)
- return (0);
+ return 0;
if (ascii_strncasecmp (val, "yes", 3) == 0)
flag = M_YES;
else if (ascii_strncasecmp (val, "no", 2) == 0)
flag = M_ASKNO;
if (flag < 0)
- return (0);
+ return 0;
set_quadoption (dst->data, flag);
- return (1);
+ return 1;
}
static void sort_to_string (char* dst, ssize_t dstlen,
if (errbuf)
snprintf (errbuf, errlen, _("%s: Unknown type."),
dst->option);
- return (0);
+ return 0;
}
if (parse_sort (dst, val, map, errbuf, errlen) == -1)
- return (0);
- return (1);
+ return 0;
+ return 1;
}
static void rx_to_string (char* dst, ssize_t dstlen,
char* s = NULL;
if (!dst)
- return (0);
+ return 0;
if (option (OPTATTACHMSG) && !m_strcmp(dst->option, "reply_regexp")) {
if (errbuf)
snprintf (errbuf, errlen,
"Operation not permitted when in attach-message mode.");
- return (0);
+ return 0;
}
if (!((rx_t*) dst->data))
/* something to do? */
if (m_strisempty(val) || (p->pattern && m_strcmp(p->pattern, val) == 0))
- return (1);
+ return 1;
if (m_strcmp(dst->option, "mask") != 0)
flags |= mutt_which_case (val);
regerror (e, rx, errbuf, errlen);
regfree (rx);
p_delete(&rx);
- return (0);
+ return 0;
}
if (p->rx) {
if (m_strcmp(dst->option, "reply_regexp") == 0)
mutt_adjust_all_subjects ();
- return (1);
+ return 1;
}
static int magic_from_string (struct option_t* dst, const char* val,
int flag = -1;
if (!dst || m_strisempty(val))
- return (0);
+ return 0;
if (ascii_strncasecmp (val, "mbox", 4) == 0)
flag = M_MBOX;
else if (ascii_strncasecmp (val, "mh", 2) == 0)
flag = M_MAILDIR;
if (flag < 0)
- return (0);
+ return 0;
*((short*) dst->data) = flag;
- return (1);
+ return 1;
}
if (!(option = hash_find (ConfigOptions, val))) {
*dst = '\0';
- return (0);
+ return 0;
}
tmp = p_new(char, dstlen+1);
FuncTable[DTYPE(option->type)].opt_tostr (tmp, dstlen, option);
memcpy (dst, t, l+1);
p_delete(&tmp);
- return (1);
+ return 1;
}
static void toggle_quadoption (int opt)
switch (v) {
case M_YES:
case M_NO:
- return (v);
+ return v;
default:
return mutt_yesorno(prompt, (v == M_ASKYES));
switch (v) {
case M_YES:
case M_NO:
- return (v);
+ return v;
default:
return mutt_yesorno(prompt, (v == M_ASKYES));
if (!MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("alias: no address"));
- return (-1);
+ return -1;
}
mutt_extract_token (buf, s, 0);
mutt_extract_token (buf, s, M_TOKEN_SPACE | M_TOKEN_QUOTE);
if ((p = strpbrk (buf->data, ": \t")) == NULL || *p != ':') {
m_strcpy(err->data, err->dsize, _("invalid header field"));
- return (-1);
+ return -1;
}
keylen = p - buf->data + 1;
if ((i = mutt_getvaluebyname (s, map)) == -1) {
if (errbuf)
snprintf (errbuf, errlen, _("'%s' is invalid for $%s"), s, dst->option);
- return (-1);
+ return -1;
}
*((short*) dst->data) = i | flags;
} else
/* for non-string: take value as is */
*dst = m_strdup(src->init);
- return (1);
+ return 1;
}
/* if additional data more == 1, we want to resolve synonyms */
if ((int) p < 0) {
if (errbuf)
snprintf (errbuf, errlen, _("'%d' is invalid for $%s"), (int) p, option);
- return (0);
+ return 0;
}
- return (1);
+ return 1;
}
static int check_history (const char* option __attribute__ ((unused)), unsigned long p,
char* errbuf, ssize_t errlen) {
if (!check_num ("history", p, errbuf, errlen))
- return (0);
+ return 0;
mutt_init_history ();
- return (1);
+ return 1;
}
static int check_special (const char* name, unsigned long val,
val, errbuf, errlen));
}
}
- return (1);
+ return 1;
}
static const struct mapping_t* get_sortmap (struct option_t* option) {
map = SortMethods;
break;
}
- return (map);
+ return map;
}
static int parse_set (BUFFER * tmp, BUFFER * s, unsigned long data,
option = hash_find(ConfigOptions, tmp->data);
if (!option && !(reset && m_strcmp("all", tmp->data) == 0)) {
snprintf (err->data, err->dsize, _("%s: unknown variable"), tmp->data);
- return (-1);
+ return -1;
}
s->dptr = vskipspaces(s->dptr);
if (reset) {
if (query || unset || inv) {
snprintf (err->data, err->dsize, _("prefix is illegal with reset"));
- return (-1);
+ return -1;
}
if (s && *s->dptr == '=') {
snprintf (err->data, err->dsize, _("value is illegal with reset"));
- return (-1);
+ return -1;
}
if (!m_strcmp("all", tmp->data)) {
if (CurrentMenu == MENU_PAGER) {
snprintf (err->data, err->dsize, _("Not available in this menu."));
- return (-1);
+ return -1;
}
hash_map (ConfigOptions, mutt_restore_default, 1);
set_option (OPTFORCEREDRAWINDEX);
set_option (OPTNEEDRESORT);
set_option (OPTRESORTINIT);
set_option (OPTREDRAWTREE);
- return (0);
+ return 0;
} else {
mutt_restore_default (NULL, option, 1);
}
if (s && *s->dptr == '=') {
if (unset || inv || query) {
snprintf (err->data, err->dsize, "Usage: set variable=yes|no");
- return (-1);
+ return -1;
}
s->dptr++;
unset = 1;
else {
snprintf (err->data, err->dsize, "Usage: set variable=yes|no");
- return (-1);
+ return -1;
}
}
set_option (OPTRESORTINIT);
set_option (OPTREDRAWTREE);
}
- return (r);
+ return r;
}
#define MAXERRS 128
if ((f = mutt_open_read (rcfile, &pid)) == NULL) {
snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno));
- return (-1);
+ return -1;
}
p_clear(&token, 1);
rcfile);
rc = -1;
}
- return (rc);
+ return rc;
}
#undef MAXERRS
do {
if (mutt_extract_token (tmp, s, 0) != 0) {
snprintf (err->data, err->dsize, _("source: error at %s"), s->dptr);
- return (-1);
+ return -1;
}
m_strcpy(path, sizeof(path), tmp->data);
}
while (MoreArgs (s));
- return ((rc < 0) ? -1 : 0);
+ return (rc < 0) ? -1 : 0;
}
/* line command to execute
finish:
if (expn.destroy)
p_delete(&expn.data);
- return (r);
+ return r;
}
if (mutt_parse_rc_line (p->data, &token, &err) != 0) {
fprintf (stderr, _("Error in command line: %s\n"), err.data);
p_delete(&token.data);
- return (-1);
+ return -1;
}
}
p_delete(&token.data);
len--;
}
- return (max - len);
+ return max - len;
}
/* insert a key sequence into the specified map. the map is sorted by ASCII
mutt_ungetch (lastkey, 0);
for (; keyslen; keyslen--)
mutt_ungetch (keys[keyslen - 1], 0);
- return (km_dokey (MENU_GENERIC));
+ return km_dokey (MENU_GENERIC);
}
if (menu != MENU_EDITOR) {
/* probably a good idea to flush input here so we can abort macros */
if (!map)
- return (retry_generic (menu, NULL, 0, 0));
+ return retry_generic (menu, NULL, 0, 0);
for (;;) {
/* ncurses doesn't return on resized screen when timeout is set to zero */
/* Nope. Business as usual */
while (LastKey > map->keys[pos]) {
if (pos > map->eq || !map->next)
- return (retry_generic (menu, map->keys, pos, LastKey));
+ return retry_generic (menu, map->keys, pos, LastKey);
map = map->next;
}
if (LastKey != map->keys[pos])
- return (retry_generic (menu, map->keys, pos, LastKey));
+ return retry_generic (menu, map->keys, pos, LastKey);
if (++pos == map->len) {
snprintf (buf, sizeof (buf), "%c", (unsigned char) c);
else
snprintf (buf, sizeof (buf), "\\x%hx", (unsigned short) c);
- return (buf);
+ return buf;
}
int km_expand_key (char *s, size_t len, struct keymap_t *map)
int p = 0;
if (!map)
- return (0);
+ return 0;
for (;;) {
m_strcpy(s, len, km_keyname(map->keys[p]));
len -= (l = m_strlen(s));
if (++p >= map->len || !len)
- return (1);
+ return 1;
s += l;
}
for (; map; map = map->next)
if (map->op == func)
break;
- return (map);
+ return map;
}
void km_init (void)
}
else
push_string (buf->data);
- return (r);
+ return r;
}
/* expects to see: <menu-string>,<menu-string>,... <key-string> */
m_strcpy(err->data, err->dsize, _("null key sequence"));
}
else if (MoreArgs (s))
- return (buf.data);
+ return buf.data;
}
else {
m_strcpy(err->data, err->dsize, _("too few arguments"));
}
error:
p_delete(&buf.data);
- return (NULL);
+ return NULL;
}
static int
for (i = 0; bindings[i].name; i++)
if (m_strcmp(func, bindings[i].name) == 0) {
km_bindkey (key, menu, bindings[i].op);
- return (0);
+ return 0;
}
- return (-1);
+ return -1;
}
struct binding_t *km_get_table (int menu)
}
}
p_delete(&key);
- return (r);
+ return r;
}
/* macro <menu> <key> <macro> <description> */
if ((key =
parse_keymap (menu, s, sizeof (menu) / sizeof (menu[0]), &nummenus,
err)) == NULL)
- return (-1);
+ return -1;
mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
/* make sure the macro sequence is not an empty string */
}
}
p_delete(&key);
- return (r);
+ return r;
}
/* exec function-name */
if (!MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("exec: no arguments"));
- return (-1);
+ return -1;
}
do {
if (ops[nops] == OP_NULL) {
mutt_flushinp ();
mutt_error (_("%s: no such function"), function);
- return (-1);
+ return -1;
}
nops++;
}
return -1;
}
- return (fd);
+ return fd;
}
flags |= (mode[1] == '+' ? O_RDWR : O_WRONLY);
if ((fd = safe_open(path, flags)) < 0)
- return (NULL);
+ return NULL;
return fdopen (fd, mode);
}
if (r == 0) {
p_delete(&ptr);
- return (-1);
+ return -1;
}
if (r > 0)
break;
for (ptr = table->table[hash]; ptr; ptr = ptr->next) {
if (m_strcmp(key, ptr->key) == 0)
- return (ptr->data);
+ return ptr->data;
}
return NULL;
}
for (i = 0; map[i].name; i++)
if (map[i].value == val)
- return (map[i].name);
+ return map[i].name;
return NULL;
}
for (i = 0; map[i].name; i++)
if (ascii_strcasecmp (map[i].name, name) == 0)
- return (map[i].value);
+ return map[i].value;
return -1;
}
case 'm': case 'M':
/* Not sure if this is the correct thing to do, but
it's required for compatibility with Outlook */
- return (SMIMESIGN | SMIMEOPAQUE);
+ return SMIMESIGN | SMIMEOPAQUE;
case 's': case 'S':
- return (SMIMESIGN | SMIMEOPAQUE);
+ return SMIMESIGN | SMIMEOPAQUE;
}
}
}
}
p_delete(&curline);
- return (0);
+ return 0;
}
/* sets mtime of 'to' to mtime of 'from' */
}
p_delete(&line);
- return (body);
+ return body;
}
void mutt_parse_part(FILE *fp, BODY *b)
mutt_parse_part(fp, b);
}
- return (head);
+ return head;
}
/* parses a date string in RFC822 format:
static int is_new (const char *path)
{
- return (access (path, W_OK) && errno == ENOENT);
+ return access (path, W_OK) && errno == ENOENT;
}
static const char *find_compress_hook (int type, const char *path)
int magic;
if (is_new (path))
- return (find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0);
+ return find_compress_hook (M_CLOSEHOOK, path) ? 1 : 0;
magic = mx_get_magic (path);
char path[_POSIX_PATH_MAX];
if (!db)
- return -1;
+ return;
snprintf(path, sizeof(path), "%s%s", db->folder, filename);
return 0;
}
- return (r);
+ return r;
}
static void mbox_unlock_mailbox (CONTEXT * ctx)
/* Save information about the folder at the time we opened it. */
if (stat (ctx->path, &sb) == -1) {
mutt_perror (ctx->path);
- return (-1);
+ return -1;
}
ctx->size = sb.st_size;
mx_update_context (ctx, count);
}
- return (0);
+ return 0;
}
#undef PREV
if (stat (ctx->path, &st) == 0) {
if (st.st_mtime == ctx->mtime && st.st_size == ctx->size)
- return (0);
+ return 0;
if (st.st_size == ctx->size) {
/* the file was touched, but it is still the same length, so just exit */
ctx->mtime = st.st_mtime;
- return (0);
+ return 0;
}
if (st.st_size > ctx->size) {
* probably the new mail arrived: no reason to wait till we can
* parse it: we'll get it on the next pass
*/
- return (M_LOCKED);
+ return M_LOCKED;
}
unlock = 1;
}
mutt_unblock_signals ();
}
- return (M_NEW_MAIL); /* signal that new mail arrived */
+ return M_NEW_MAIL; /* signal that new mail arrived */
}
else
modified = 1;
mbox_unlock_mailbox (ctx);
mutt_unblock_signals ();
}
- return (M_REOPENED);
+ return M_REOPENED;
}
}
mutt_unblock_signals ();
mutt_error _("Mailbox was corrupted!");
- return (-1);
+ return -1;
}
static int mbox_check_mailbox(CONTEXT *ctx, int *index_hint, int lock)
mx_fastclose_mailbox (ctx);
mutt_error _("Fatal error! Could not reopen mailbox!");
- return (-1);
+ return -1;
}
mutt_block_signals ();
}
else if (i < 0)
/* fatal error */
- return (-1);
+ return -1;
/* Create a temporary file to write the new version of the mailbox in. */
fp = m_tempfile(tempfile, _POSIX_PATH_MAX, NONULL(mod_core.tmpdir), NULL);
mx_fastclose_mailbox (ctx);
mutt_perror (_("Can't create temporary file"));
mutt_sleep (5);
- return (-1);
+ return -1;
}
if (fseeko (ctx->fp, offset, SEEK_SET) != 0 /* seek the append location */
mutt_pretty_mailbox (savefile);
mutt_error (_("Write failed! Saved partial mailbox to %s"), savefile);
mutt_sleep (5);
- return (-1);
+ return -1;
}
/* Restore the previous access/modification times */
mutt_unblock_signals ();
mx_fastclose_mailbox (ctx);
mutt_error _("Fatal error! Could not reopen mailbox!");
- return (-1);
+ return -1;
}
/* update the offsets of the rewritten messages */
unlink (tempfile); /* remove partial copy of the mailbox */
mutt_unblock_signals ();
- return (0); /* signal success */
+ return 0; /* signal success */
bail: /* Come here in case of disaster */
mutt_error _("Could not reopen mailbox!");
mx_fastclose_mailbox (ctx);
- return (-1);
+ return -1;
}
if (need_sort)
p_delete(&old_hdrs);
ctx->quiet = 0;
- return (-1);
+ return -1;
}
/* now try to recover the old flags */
ctx->quiet = 0;
- return ((ctx->changed || msg_mod) ? M_REOPENED : M_NEW_MAIL);
+ return (ctx->changed || msg_mod) ? M_REOPENED : M_NEW_MAIL;
}
/*
if (stat (path, &st) == -1)
return -1;
- return ((st.st_size == 0));
+ return st.st_size == 0;
}
int mbox_is_magic (const char* path, struct stat* st)
char tmp[_POSIX_PATH_MAX];
if (S_ISDIR(st->st_mode))
- return (-1);
+ return -1;
if (st->st_size == 0) {
return M_MBOX;
utime (path, ×);
} else {
mutt_perror (path);
- return (-1); /* fopen failed */
+ return -1; /* fopen failed */
}
if (magic == -1 && mutt_can_read_compressed (path))
- return (M_COMPRESSED);
- return (magic);
+ return M_COMPRESSED;
+ return magic;
}
static int mbox_commit_message (MESSAGE* msg, CONTEXT* ctx) {
p_delete(tgt);
close (fd);
unlink (path);
- return (-1);
+ return -1;
}
return 0;
}
static int mh_read_dir (CONTEXT* ctx) {
- return (_mh_read_dir (ctx, NULL));
+ return _mh_read_dir (ctx, NULL);
}
/* read a maildir style mailbox */
* of the main folder path from which to read messages
*/
if (_mh_read_dir (ctx, "new") == -1 || _mh_read_dir (ctx, "cur") == -1)
- return (-1);
+ return -1;
return 0;
}
p_delete(&msg->path);
close (fd);
unlink (path);
- return (-1);
+ return -1;
}
return 0;
if ((dirp = opendir (ctx->path)) == NULL) {
mutt_perror (ctx->path);
- return (-1);
+ return -1;
}
/* figure out what the next message number is */
(h->env && (h->env->refs_changed || h->env->irt_changed))) {
/* when doing attachment deletion/rethreading, fall back to the MH case. */
if (mh_rewrite_message (ctx, msgno) != 0)
- return (-1);
+ return -1;
}
else {
/* we just have to rename the file. */
char *p;
if ((p = strrchr (h->path, '/')) == NULL) {
- return (-1);
+ return -1;
}
p++;
m_strcpy(newpath, sizeof(newpath), p);
if (rename (oldpath, fullpath) != 0) {
mutt_perror ("rename");
- return (-1);
+ return -1;
}
m_strreplace(&h->path, partpath);
}
- return (0);
+ return 0;
}
static int mh_sync_mailbox (CONTEXT * ctx, int unused __attribute__ ((unused)), int *index_hint)
if (!mxfmts[i]->local)
t = mxfmts[i]->mx_is_magic(path, NULL);
if (t >= 1)
- return (t-1);
+ return t-1;
}
if (stat (path, &st) == 0) {
/* if stat() succeeded, keep testing until success and
if (mxfmts[i]->local)
t = mxfmts[i]->mx_is_magic(path, &st);
if (t >= 1)
- return (t-1);
+ return t-1;
}
}
return -1;
if (m_strlen(path) == 0)
return -1;
if ((i = mx_get_idx (path)) >= 0)
- return (mxfmts[i]->type);
+ return mxfmts[i]->type;
return -1;
}
int mx_is_local (int m) {
if (!MX_IDX(m))
- return (0);
- return (mxfmts[m]->local);
+ return 0;
+ return mxfmts[m]->local;
}
/* mx_access: Wrapper for access, checks permissions on a given mailbox.
int i = 0;
if ((i = mx_get_idx (path)) >= 0 && mxfmts[i]->mx_access)
- return (mxfmts[i]->mx_access(path,flags));
- return (0);
+ return mxfmts[i]->mx_access(path,flags);
+ return 0;
}
static int mx_open_mailbox_append (CONTEXT * ctx, int flags)
mx_fastclose_mailbox (ctx);
if (!pctx)
p_delete(&ctx);
- return (NULL);
+ return NULL;
}
/* if the user has a `push' command in their .muttrc, or in a folder-hook,
}
unset_option (OPTFORCEREFRESH);
- return (ctx);
+ return ctx;
}
/* free up memory associated with the mailbox context */
int mx_close_mailbox (CONTEXT * ctx, int *index_hint) {
int ret = 0;
if (!ctx)
- return (0);
+ return 0;
ret = _mx_close_mailbox (ctx, index_hint);
sidebar_set_buffystats (ctx);
- return (ret);
+ return ret;
}
/* update a Context structure's internal tables. */
if (!ctx->changed && !ctx->deleted) {
mutt_message _("Mailbox is unchanged.");
- return (0);
+ return 0;
}
if (ctx->deleted) {
}
}
- return (rc);
+ return rc;
}
int mx_sync_mailbox (CONTEXT* ctx, int* index_hint) {
int ret = _mx_sync_mailbox (ctx, index_hint);
sidebar_set_buffystats (ctx);
- return (ret);
+ return ret;
}
/* args:
address_t *p = NULL;
if (!MX_IDX(dest->magic-1)) {
- return (NULL);
+ return NULL;
}
msg = p_new(MESSAGE, 1);
if (ctx->locked)
lock = 0;
if (MX_IDX(ctx->magic-1) && mxfmts[ctx->magic-1]->mx_check_mailbox)
- return (mxfmts[ctx->magic-1]->mx_check_mailbox(ctx, index_hint, lock));
+ return mxfmts[ctx->magic-1]->mx_check_mailbox(ctx, index_hint, lock);
}
return -1;
p_delete(&msg);
break;
}
- return (msg);
+ return msg;
}
/* commit a message to a folder */
}
if (!ctx || !MX_IDX(ctx->magic-1) || !mxfmts[ctx->magic-1]->mx_commit_message)
return -1;
- return (mxfmts[ctx->magic-1]->mx_commit_message (msg, ctx));
+ return mxfmts[ctx->magic-1]->mx_commit_message (msg, ctx);
}
/* close a pointer to a message */
}
p_delete(msg);
- return (r);
+ return r;
}
void mx_alloc_memory (CONTEXT * ctx)
{
int i = 0;
if ((i = mx_get_idx (path)) >= 0 && mxfmts[i]->mx_check_empty)
- return (mxfmts[i]->mx_check_empty(path));
+ return mxfmts[i]->mx_check_empty(path);
errno = EINVAL;
return -1;
}
if (in) {
*in = 0;
if (pipe (pin) == -1)
- return (-1);
+ return -1;
}
if (out) {
close (pin[0]);
close (pin[1]);
}
- return (-1);
+ return -1;
}
}
close (pout[0]);
close (pout[1]);
}
- return (-1);
+ return -1;
}
}
close (perr[1]);
}
- return (-1);
+ return -1;
}
if (out) {
*err = fdopen (perr[0], "r");
}
- return (thepid);
+ return thepid;
}
pid_t mutt_create_filter (const char *s, FILE ** in, FILE ** out, FILE ** err)
{
- return (mutt_create_filter_fd (s, in, out, err, -1, -1, -1));
+ return mutt_create_filter_fd (s, in, out, err, -1, -1, -1);
}
int mutt_wait_filter (pid_t pid)
*thepid = -1;
}
- return (f);
+ return f;
}
m_strcpy(s, len, _("[invalid date]"));
}
- return (s);
+ return s;
}
static int tls_check_stored_hostname (const gnutls_datum * cert,
unset_option (OPTUNBUFFEREDINPUT);
mutt_menuDestroy (&menu);
gnutls_x509_crt_deinit (cert);
- return (done == 2);
+ return done == 2;
}
/* vim:set ft=c: */
int r = strcoll(NONULL(pa->name), NONULL(pb->name));
- return ((BrowserSort & SORT_REVERSE) ? -r : r);
+ return (BrowserSort & SORT_REVERSE) ? -r : r;
}
static int browser_compare_date (const void *a, const void *b)
int r = pa->mtime - pb->mtime;
- return ((BrowserSort & SORT_REVERSE) ? -r : r);
+ return (BrowserSort & SORT_REVERSE) ? -r : r;
}
static int browser_compare_size (const void *a, const void *b)
int r = pa->size - pb->size;
- return ((BrowserSort & SORT_REVERSE) ? -r : r);
+ return (BrowserSort & SORT_REVERSE) ? -r : r;
}
static void browser_sort (struct browser_state *state)
mutt_concat_path(fullpath, sizeof(fullpath), folder, path);
if (stat (fullpath, &st) == 0)
- return (S_ISDIR (st.st_mode));
+ return S_ISDIR (st.st_mode);
else
return 0;
}
}
}
mutt_perror (d);
- return (-1);
+ return -1;
}
if (!S_ISDIR (s.st_mode)) {
mutt_error (_("%s is not a directory."), d);
- return (-1);
+ return -1;
}
buffy_check (0);
if ((dp = opendir (d)) == NULL) {
mutt_perror (d);
- return (-1);
+ return -1;
}
init_state (state, menu);
BUFFY* tmp;
if (!Incoming.len)
- return (-1);
+ return -1;
buffy_check (0);
init_state (state, menu);
p->fg = p->bg = -1;
- return (p);
+ return p;
}
static void mutt_free_color_line(COLOR_LINE ** l)
if ((*col = mutt_getvaluebyname (s, Colors)) == -1) {
snprintf (err->data, err->dsize, _("%s: no such color"), s);
- return (-1);
+ return -1;
}
return 0;
if ((object = mutt_getvaluebyname (buf->data, Fields)) == -1) {
snprintf (err->data, err->dsize, _("%s: no such object"), buf->data);
- return (-1);
+ return -1;
}
if (m_strncmp(buf->data, "index", 5) != 0) {
snprintf (err->data, err->dsize,
_("%s: command valid only for index object"), "uncolor");
- return (-1);
+ return -1;
}
if (!MoreArgs (s)) {
snprintf (err->data, err->dsize, _("%s: too few arguments"), "uncolor");
- return (-1);
+ return -1;
}
if (option(OPTNOCURSES)) {
for (i = 0; Context && i < Context->msgcount; i++)
Context->hdrs[i]->pair = 0;
}
- return (0);
+ return 0;
}
(sensitive ? mutt_which_case (s) : REG_ICASE))) != 0) {
regerror (r, &tmp->rx, err->data, err->dsize);
mutt_free_color_line(&tmp);
- return (-1);
+ return -1;
}
tmp->next = *top;
tmp->pattern = m_strdup(s);
}
else if ((*o = mutt_getvaluebyname (buf->data, Fields)) == -1) {
snprintf (err->data, err->dsize, _("%s: no such object"), buf->data);
- return (-1);
+ return -1;
}
return 0;
{
if (!MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("color: too few arguments"));
- return (-1);
+ return -1;
}
mutt_extract_token (buf, s, 0);
if (parse_color_name (buf->data, fg, attr, A_BOLD, err) != 0)
- return (-1);
+ return -1;
if (!MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("color: too few arguments"));
- return (-1);
+ return -1;
}
mutt_extract_token (buf, s, 0);
if (parse_color_name (buf->data, bg, attr, A_BLINK, err) != 0)
- return (-1);
+ return -1;
return 0;
}
if (!MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("mono: too few arguments"));
- return (-1);
+ return -1;
}
mutt_extract_token (buf, s, 0);
*attr = A_NORMAL; /* needs use = instead of |= to clear other bits */
else {
snprintf (err->data, err->dsize, _("%s: no such attribute"), buf->data);
- return (-1);
+ return -1;
}
return 0;
|| object == MT_COLOR_INDEX) {
if (!MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("too few arguments"));
- return (-1);
+ return -1;
}
mutt_extract_token (buf, s, 0);
if (MoreArgs (s)) {
m_strcpy(err->data, err->dsize, _("too many arguments"));
- return (-1);
+ return -1;
}
if (option(OPTNOCURSES))
&& use_default_colors () != OK)
{
m_strcpy(err->data, err->dsize, _("default colors not supported"));
- return (-1);
+ return -1;
}
if (object == MT_COLOR_HEADER)
if (object == MT_COLOR_NORMAL)
BKGDSET(main_w, MT_COLOR_NORMAL);
- return (r);
+ return r;
}
}
if (dirp == NULL) {
- return (-1);
+ return -1;
}
/*
else
m_strcpy(s, slen, filepart);
- return (init ? 0 : -1);
+ return init ? 0 : -1;
}
event_t err = { -1, OP_NULL }, ret;
if (!option (OPTUNBUFFEREDINPUT) && UngetCount)
- return (KeyEvent[--UngetCount]);
+ return KeyEvent[--UngetCount];
SigInt = 0;
ret.ch = ch;
ret.op = 0;
- return (ch == ctrl ('G') ? err : ret);
+ return ch == ctrl ('G') ? err : ret;
}
int mutt_get_field_unbuffered (char *msg, char *buf, ssize_t buflen, int flags)
rc = mutt_get_field (msg, buf, buflen, flags);
unset_option (OPTUNBUFFEREDINPUT);
- return (rc);
+ return rc;
}
void mutt_clear_error (void)
mutt_refresh ();
}
CLEARLINE(stdscr, LINES - 1);
- return (def);
+ return def;
}
/* this function is called when the user presses the abort key */
close (f);
fputs ("\r\n", stdout);
mutt_clear_error ();
- return (ch);
+ return ch;
}
int _mutt_enter_fname (const char *prompt, char *buf, ssize_t blen,
ch = mutt_getch ();
if (ch.ch == -1) {
CLEARLINE(stdscr, LINES - 1);
- return (-1);
+ return -1;
}
else if (ch.ch == '?') {
mutt_refresh ();
for (i = msgno + 1; i < Context->vcount; i++)
if (!Context->hdrs[Context->v2r[i]]->deleted)
- return (i);
- return (-1);
+ return i;
+ return -1;
}
static int ci_previous_undeleted (int msgno)
for (i = msgno - 1; i >= 0; i--)
if (!Context->hdrs[Context->v2r[i]]->deleted)
- return (i);
- return (-1);
+ return i;
+ return -1;
}
/* Return the index of the first new message, or failing that, the first
if (!Context->hdrs[Context->v2r[i]]->read &&
!Context->hdrs[Context->v2r[i]]->deleted) {
if (!Context->hdrs[Context->v2r[i]]->old)
- return (i);
+ return i;
else if (old == -1)
old = i;
}
}
if (old != -1)
- return (old);
+ return old;
/* If Sort is reverse and not threaded, the latest message is first.
* If Sort is threaded, the latest message is first iff exactly one
((Sort ^ SortAux) & SORT_REVERSE)))
return 0;
else
- return (Context->vcount ? Context->vcount - 1 : 0);
+ return Context->vcount ? Context->vcount - 1 : 0;
}
return 0;
}
}
mutt_menuDestroy (&menu);
- return (closed);
+ return closed;
}
void mutt_set_header_color (CONTEXT * ctx, HEADER * curhdr)
CLEARLINE(stdscr, LINES - 1);
p_delete(&es.wbuf);
- return (ret);
+ return ret;
}
/*
struct history *h = &History[hclass];
if (!HistSize)
- return (""); /* disabled */
+ return ""; /* disabled */
next = h->cur + 1;
if (next > HistSize - 1)
next = 0;
h->cur = h->hist[next] ? next : 0;
- return (h->hist[h->cur] ? h->hist[h->cur] : "");
+ return h->hist[h->cur] ? h->hist[h->cur] : "";
}
const char *mutt_history_prev (history_class_t hclass)
struct history *h = &History[hclass];
if (!HistSize)
- return (""); /* disabled */
+ return ""; /* disabled */
prev = h->cur - 1;
if (prev < 0) {
}
if (h->hist[prev])
h->cur = prev;
- return (h->hist[h->cur] ? h->hist[h->cur] : "");
+ return h->hist[h->cur] ? h->hist[h->cur] : "";
}
char buf[LONG_STRING];
menu_make_entry (buf, sizeof (buf), m, n);
- return (regexec (re, buf, 0, NULL, 0));
+ return regexec (re, buf, 0, NULL, 0);
}
MUTTMENU *mutt_new_menu (void)
p->pagelen = LINES - 3;
p->color = default_color;
p->search = menu_search_generic;
- return (p);
+ return p;
}
void mutt_menuDestroy (MUTTMENU ** p)
if (mutt_get_field ((op == OP_SEARCH) ? _("Search for: ") :
_("Reverse search for: "),
buf, sizeof (buf), M_CLEAR) != 0 || !buf[0])
- return (-1);
+ return -1;
m_strreplace(&menu->searchBuf, buf);
menu->searchDir = (op == OP_SEARCH) ? M_SEARCH_DOWN : M_SEARCH_UP;
}
if (!menu->searchBuf) {
mutt_error _("No search pattern.");
- return (-1);
+ return -1;
}
}
regerror (r, &re, buf, sizeof (buf));
regfree (&re);
mutt_error ("%s", buf);
- return (-1);
+ return -1;
}
r = menu->current + searchDir;
regfree (&re);
mutt_error _("Not found.");
- return (-1);
+ return -1;
}
static int menu_dialog_translate_op (int i)
if (menu->redraw & REDRAW_FULL) {
menu_redraw_full (menu);
/* allow the caller to do any local configuration */
- return (OP_REDRAW);
+ return OP_REDRAW;
}
if (!menu->dialog)
break;
default:
- return (i);
+ return i;
}
}
/* not reached */
rfc822_addrcat(buf, buflen, tmpa, 0);
address_list_wipe(&tmpa);
mutt_clear_error ();
- return (0);
+ return 0;
}
/* multiple results, choose from query menu */
query_menu (buf, buflen, results, 1);
}
- return (0);
+ return 0;
}
void mutt_query_menu (char *buf, ssize_t buflen)
case 0:
*buf = 0;
- return (src);
+ return src;
default:
*buf = 0;
if (flags & M_FORMAT_OPTIONAL)
menu_status_line(buf, buflen, menu, optional ? ifstr : elstr);
- return (src);
+ return src;
}
void menu_status_line(char* buf, ssize_t len, MUTTMENU* menu, const char* p)
tmp[0] = 0;
if (mutt_get_field (_("File under directory: "), tmp, sizeof (tmp),
M_FILE | M_CLEAR) != 0 || !tmp[0])
- return (-1);
+ return -1;
mutt_concat_path(fname, flen, path, tmp);
}
else
}
}
}
- return (ret);
+ return ret;
}
void mutt_sleep (short s)
while (a && b) {
if (m_strcmp(a->mailbox, b->mailbox) ||
m_strcmp(a->personal, b->personal))
- return (0);
+ return 0;
a = a->next;
b = b->next;
}
- if (a || b)
- return (0);
-
- return (1);
+ return !(a || b);
}
static int mutt_cmp_list (const string_list_t * a, const string_list_t * b)
{
while (a && b) {
if (m_strcmp(a->data, b->data))
- return (0);
+ return 0;
a = a->next;
b = b->next;
}
- if (a || b)
- return (0);
-
- return (1);
+ return !(a || b);
}
static int mutt_cmp_env (const ENVELOPE * e1, const ENVELOPE * e2)
!mutt_cmp_addr (e1->to, e2->to) ||
!mutt_cmp_addr (e1->cc, e2->cc) ||
!mutt_cmp_addr (e1->return_path, e2->return_path))
- return (0);
+ return 0;
else
- return (1);
- }
- else {
- if (e1 == NULL && e2 == NULL)
- return (1);
- else
- return (0);
+ return 1;
}
+ return e1 == NULL && e2 == NULL;
}
static int mutt_cmp_body (const BODY * b1, const BODY * b2)
m_strcmp(b1->description, b2->description) ||
!parameter_equal(b1->parameter, b2->parameter) ||
b1->length != b2->length)
- return (0);
- return (1);
+ return 0;
+ return 1;
}
int mutt_cmp_header (const HEADER * h1, const HEADER * h2) {
if (h1 && h2) {
h1->mime != h2->mime ||
!mutt_cmp_env (h1->env, h2->env) ||
!mutt_cmp_body (h1->content, h2->content))
- return (0);
- else
- return (1);
- }
- else {
- if (h1 == NULL && h2 == NULL)
- return (1);
+ return 0;
else
- return (0);
+ return 1;
}
+ return h1 == NULL && h2 == NULL;
}
}
} while (pc && *pc != '`');
if (!pc) {
- return (-1);
+ return -1;
}
cmd = p_dupstr(tok->dptr, pc - tok->dptr);
class->color = ColorQuote[0];
*QuoteList = class;
}
- return (*QuoteList);
+ return *QuoteList;
}
/* Did I mention how much I like emulating Lisp in C? */
{
while (isdigit(*buf) || *buf == ';')
buf++;
- return (*buf == 'm');
+ return *buf == 'm';
}
static int check_attachment_marker(char *p)
fseeko (f, offset, 0);
if (fgets ((char *) buf, blen - 1, f) == NULL) {
fmt[0] = 0;
- return (-1);
+ return -1;
}
*last_pos = ftello (f);
b_read = (int) (*last_pos - offset);
&buf_ready) < 0) {
if (change_last)
(*last)--;
- return (-1);
+ return -1;
}
resolve_types ((char *) fmt, (char *) buf, *lineInfo, n, *last,
&buf_ready) < 0) {
if (change_last)
(*last)--;
- return (-1);
+ return -1;
}
regexec ((regex_t *) QuoteRegexp.rx, (char *) fmt, 1, pmatch, 0);
(*lineInfo)[n].quote = classify_quote (QuoteList,
&buf_ready) < 0) {
if (change_last)
(*last)--;
- return (-1);
+ return -1;
}
offset = 0;
if (!(flags & M_SHOW) && (*lineInfo)[n + 1].offset > 0) {
/* we've already scanned this line, so just exit */
- return (0);
+ return 0;
}
if ((flags & M_SHOWCOLOR) && *force_redraw && (*lineInfo)[n + 1].offset > 0) {
/* no need to try to display this line... */
- return (1); /* fake display */
+ return 1; /* fake display */
}
if ((b_read = fill_buffer (f, last_pos, (*lineInfo)[n].offset, buf, fmt,
sizeof (buf), &buf_ready)) < 0) {
if (change_last)
(*last)--;
- return (-1);
+ return -1;
}
/* now chose a good place to break the line */
if (!(flags & M_SHOW))
flags = 0;
- return (flags);
+ return flags;
}
static int upNLines (int nlines, struct line_t *info, int cur, int hiding)
if ((fp = fopen (fname, "r")) == NULL) {
mutt_perror (fname);
- return (-1);
+ return -1;
}
if (stat (fname, &sb) != 0) {
mutt_perror (fname);
m_fclose(&fp);
- return (-1);
+ return -1;
}
unlink (fname);
p_delete(&lineInfo);
if (pager_index)
mutt_menuDestroy (&pager_index);
- return (rc != -1 ? rc : 0);
+ return rc != -1 ? rc : 0;
}
#undef CHECK_ATTACH
s.fpout = m_tempfile(tempfile, sizeof(tempfile), NONULL(mod_core.tmpdir), NULL);
if (!s.fpout) {
mutt_error(_("Could not create temporary file"));
- return (0);
+ return 0;
}
if (pat->op != M_BODY)
if (mutt_extract_token (&buf, s, M_TOKEN_PATTERN | M_TOKEN_COMMENT) != 0 ||
!buf.data) {
snprintf (err->data, err->dsize, _("Error in expression: %s"), s->dptr);
- return (-1);
+ return -1;
}
if (!*buf.data) {
snprintf (err->data, err->dsize, _("Empty expression"));
- return (-1);
+ return -1;
}
if (pat->stringmatch) {
regerror (r, pat->rx, err->data, err->dsize);
regfree (pat->rx);
p_delete(&pat->rx);
- return (-1);
+ return -1;
}
}
return 0;
if ((flag & M_PDR_ERROR) && !(flag & M_PDR_ABSOLUTE)) { /* getDate has its own error message, don't overwrite it here */
snprintf (err->data, err->dsize, _("Invalid relative date: %s"), pc - 1);
}
- return ((flag & M_PDR_ERROR) ? NULL : pc);
+ return (flag & M_PDR_ERROR) ? NULL : pc;
}
static int eat_date (pattern_t * pat, BUFFER * s, BUFFER * err)
if (mutt_extract_token (&buffer, s, M_TOKEN_COMMENT | M_TOKEN_PATTERN) != 0
|| !buffer.data) {
m_strcpy(err->data, err->dsize, _("error in expression"));
- return (-1);
+ return -1;
}
p_clear(&min, 1);
/* mininum date specified */
if ((pc = getDate (pc, &min, err)) == NULL) {
p_delete(&buffer.data);
- return (-1);
+ return -1;
}
haveMin = TRUE;
pc = vskipspaces(pc);
if (!parse_date_range (pc, &min, &max, haveMin, &baseMin, err)) { /* bail out on any parsing error */
p_delete(&buffer.data);
- return (-1);
+ return -1;
}
}
}
for (i = 0; Flags[i].tag; i++)
if (Flags[i].tag == tag)
- return (&Flags[i]);
+ return &Flags[i];
return NULL;
}
tmp->child = curlist;
curlist = tmp;
}
- return (curlist);
+ return curlist;
}
static int
(match_personal && a->personal &&
patmatch (pat, a->personal) == 0))) {
va_end (ap);
- return (!pat->alladdr); /* Found match, or non-match if alladdr */
+ return !pat->alladdr; /* Found match, or non-match if alladdr */
}
}
}
{
for (; a1; a1 = a1->next)
if (alladdr ^ mutt_is_subscribed_list (a1))
- return (!alladdr);
+ return !alladdr;
for (; a2; a2 = a2->next)
if (alladdr ^ mutt_is_subscribed_list (a2))
- return (!alladdr);
+ return !alladdr;
return alladdr;
}
{
for (; a1; a1 = a1->next)
if (alladdr ^ mutt_is_mail_list (a1))
- return (!alladdr);
+ return !alladdr;
for (; a2; a2 = a2->next)
if (alladdr ^ mutt_is_mail_list (a2))
- return (!alladdr);
+ return !alladdr;
return alladdr;
}
{
for (; a1; a1 = a1->next)
if (alladdr ^ mutt_addr_is_user (a1))
- return (!alladdr);
+ return !alladdr;
for (; a2; a2 = a2->next)
if (alladdr ^ mutt_addr_is_user (a2))
- return (!alladdr);
+ return !alladdr;
return alladdr;
}
ret--;
p++;
}
- return (ret >= 1);
+ return ret >= 1;
}
/* flags
{
switch (pat->op) {
case M_AND:
- return (pat->not ^ (perform_and (pat->child, flags, ctx, h) > 0));
+ return pat->not ^ (perform_and (pat->child, flags, ctx, h) > 0);
case M_OR:
- return (pat->not ^ (perform_or (pat->child, flags, ctx, h) > 0));
+ return pat->not ^ (perform_or (pat->child, flags, ctx, h) > 0);
case M_ALL:
- return (!pat->not);
+ return !pat->not;
case M_EXPIRED:
- return (pat->not ^ h->expired);
+ return pat->not ^ h->expired;
case M_SUPERSEDED:
- return (pat->not ^ h->superseded);
+ return pat->not ^ h->superseded;
case M_FLAG:
- return (pat->not ^ h->flagged);
+ return pat->not ^ h->flagged;
case M_TAG:
- return (pat->not ^ h->tagged);
+ return pat->not ^ h->tagged;
case M_NEW:
- return (pat->not ? h->old || h->read : !(h->old || h->read));
+ return pat->not ? h->old || h->read : !(h->old || h->read);
case M_UNREAD:
- return (pat->not ? h->read : !h->read);
+ return pat->not ? h->read : !h->read;
case M_REPLIED:
- return (pat->not ^ h->replied);
+ return pat->not ^ h->replied;
case M_OLD:
- return (pat->not ? (!h->old || h->read) : (h->old && !h->read));
+ return pat->not ? (!h->old || h->read) : (h->old && !h->read);
case M_READ:
- return (pat->not ^ h->read);
+ return pat->not ^ h->read;
case M_DELETED:
- return (pat->not ^ h->deleted);
+ return pat->not ^ h->deleted;
case M_MESSAGE:
return (pat->not ^ (h->msgno >= pat->min - 1 && (pat->max == M_MAXRANGE ||
h->msgno <=
return (pat->
not ^ (h->date_sent >= pat->min && h->date_sent <= pat->max));
case M_DATE_RECEIVED:
- return (pat->not ^ (h->received >= pat->min && h->received <= pat->max));
+ return pat->not ^ (h->received >= pat->min && h->received <= pat->max);
case M_BODY:
case M_HEADER:
case M_WHOLE_MSG:
/* IMAP search sets h->matched at search compile time */
if (ctx->magic == M_IMAP && pat->stringmatch)
- return (h->matched);
- return (pat->not ^ msg_search (ctx, pat, h->msgno));
+ return h->matched;
+ return pat->not ^ msg_search (ctx, pat, h->msgno);
case M_SENDER:
return (pat->not ^ match_adrlist (pat, flags & M_MATCH_FULL_ADDRESS,
pat->alladdr, 1, h->env->sender));
&& (pat->max == M_MAXRANGE
|| h->content->length <= pat->max)));
case M_REFERENCE:
- return (pat->not ^ match_reference (pat, h->env->references));
+ return pat->not ^ match_reference (pat, h->env->references);
case M_ADDRESS:
return (pat->
not ^ (h->env
return (pat->
not ^ (h->env && match_user (pat->alladdr, h->env->from, NULL)));
case M_COLLAPSED:
- return (pat->not ^ (h->collapsed && h->num_hidden > 1));
+ return pat->not ^ (h->collapsed && h->num_hidden > 1);
case M_CRYPT_SIGN:
- return (pat->not ^ ((h->security & SIGN) ? 1 : 0));
+ return pat->not ^ ((h->security & SIGN) ? 1 : 0);
case M_CRYPT_VERIFIED:
- return (pat->not ^ ((h->security & GOODSIGN) ? 1 : 0));
+ return pat->not ^ ((h->security & GOODSIGN) ? 1 : 0);
case M_CRYPT_ENCRYPT:
- return (pat->not ^ ((h->security & ENCRYPT) ? 1 : 0));
+ return pat->not ^ ((h->security & ENCRYPT) ? 1 : 0);
case M_PGP_KEY:
return (pat->not ^ ((h->security & APPLICATION_PGP)
&& (h->security & PGPKEY)));
not ^ (h->env->spam && h->env->spam->data
&& patmatch (pat, h->env->spam->data) == 0));
case M_DUPLICATED:
- return (pat->not ^ (h->thread && h->thread->duplicate_thread));
+ return pat->not ^ (h->thread && h->thread->duplicate_thread);
case M_MIMEATTACH:
{
}
case M_UNREFERENCED:
- return (pat->not ^ (h->thread && !h->thread->child));
+ return pat->not ^ (h->thread && !h->thread->child);
case M_MULTIPART:
- return (pat->not ^ (h->content && h->content->type == TYPEMULTIPART));
+ return pat->not ^ (h->content && h->content->type == TYPEMULTIPART);
case M_REALNAME:
/* realname filter:
* we have a match if
)) ^ pat->not;
}
mutt_error (_("error: unknown op %d (report this error)."), pat->op);
- return (-1);
+ return -1;
}
static void quote_simple (char *tmp, ssize_t len, const char *p)
m_strcpy(buf, sizeof(buf), NONULL(Context->pattern));
if (prompt || op != M_LIMIT)
if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 || !buf[0])
- return (-1);
+ return -1;
mutt_message _("Compiling search pattern...");
if ((pat = mutt_pattern_comp (buf, M_FULL_MSG, &err)) == NULL) {
p_delete(&simple);
mutt_error ("%s", err.data);
- return (-1);
+ return -1;
}
if (Context->magic == M_IMAP && imap_search (Context, pat) < 0)
if (mutt_get_field ((op == OP_SEARCH) ? _("Search for: ") :
_("Reverse search for: "), buf, sizeof (buf),
M_CLEAR | M_PATTERN) != 0 || !buf[0])
- return (-1);
+ return -1;
if (op == OP_SEARCH)
unset_option (OPTSEARCHREVERSE);
if ((SearchPattern =
mutt_pattern_comp (temp, M_FULL_MSG, &err)) == NULL) {
mutt_error ("%s", error);
- return (-1);
+ return -1;
}
mutt_clear_error ();
}
else if (!SearchPattern) {
mutt_error _("No search pattern.");
- return (-1);
+ return -1;
}
if (option (OPTSEARCHINVALID)) {
else {
mutt_message _("Search hit bottom without finding match");
- return (-1);
+ return -1;
}
}
else if (i < 0) {
else {
mutt_message _("Search hit top without finding match");
- return (-1);
+ return -1;
}
}
mutt_error _("Search interrupted.");
SigInt = 0;
- return (-1);
+ return -1;
}
i += incr;
mutt_error _("Not found.");
- return (-1);
+ return -1;
}
}
mutt_clear_error ();
- return (new_count - old_count);
+ return new_count - old_count;
}
/* delete all cached messages */
if (stat (Postponed, &st) == -1) {
PostCount = 0;
LastModify = 0;
- return (0);
+ return 0;
}
if (S_ISDIR (st.st_mode)) {
LastModify = st.st_mtime;
if (access (Postponed, R_OK | F_OK) != 0)
- return (PostCount = 0);
+ return PostCount = 0;
if (mx_open_mailbox (Postponed, M_NOSORT | M_QUIET, &ctx) == NULL)
PostCount = 0;
else
mx_fastclose_mailbox (&ctx);
}
- return (PostCount);
+ return PostCount;
}
void mutt_update_num_postponed (void)
Sort = orig_sort;
mutt_menuDestroy (&menu);
- return (r > -1 ? PostContext->hdrs[r] : NULL);
+ return r > -1 ? PostContext->hdrs[r] : NULL;
}
/* args:
int opt_delete;
if (!Postponed)
- return (-1);
+ return -1;
if ((PostContext = mx_open_mailbox (Postponed, M_NOSORT, NULL)) == NULL) {
PostCount = 0;
mutt_error _("No postponed messages.");
- return (-1);
+ return -1;
}
if (!PostContext->msgcount) {
p_delete(&PostContext);
mutt_error _("No postponed messages.");
- return (-1);
+ return -1;
}
if (PostContext->msgcount == 1) {
else if ((h = select_msg ()) == NULL) {
mx_close_mailbox (PostContext, NULL);
p_delete(&PostContext);
- return (-1);
+ return -1;
}
if (mutt_prepare_template (NULL, PostContext, hdr, h, 0) < 0) {
mx_fastclose_mailbox (PostContext);
p_delete(&PostContext);
- return (-1);
+ return -1;
}
/* finished with this message, so delete it. */
tmp = tmp->next;
}
}
- return (code);
+ return code;
}
int mutt_parse_crypt_hdr (char *p, int set_signas)
p_clear(&s, 1);
if (!fp && (msg = mx_open_message (ctx, hdr->msgno)) == NULL)
- return (-1);
+ return -1;
if (!fp)
fp = msg->fp;
if (level == 0)
mutt_update_tree (idx, *idxlen);
- return (idx);
+ return idx;
}
/* %c = character set: convert?
}
}
else if (top->parts)
- return (can_print(top->parts, tag));
+ return can_print(top->parts, tag);
if (!tag)
break;
}
if ((flags & SENDLISTREPLY) && !env->to) {
mutt_error _("No mailing lists found!");
- return (-1);
+ return -1;
}
mutt_fix_reply_recipients (env);
{
for (; lst; lst = lst->next) {
if (mutt_addrcmp (a, lst))
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
/* removes addresses from "b" which are contained in "a" */
mutt_addrlist_to_local (*a);
rfc822_addrcat(buf, sizeof(buf), *a, 0);
if (mutt_get_field (field, buf, sizeof (buf), M_ALIAS) != 0)
- return (-1);
+ return -1;
address_list_wipe(a);
*a = mutt_expand_aliases (mutt_parse_adrlist (NULL, buf));
if ((idna_ok = mutt_addrlist_to_idna (*a, &err)) != 0) {
regmatch_t pat_match[1];
if (edit_address (&en->to, "To: ") == -1 || en->to == NULL)
- return (-1);
+ return -1;
if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1)
- return (-1);
+ return -1;
if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
- return (-1);
+ return -1;
if (en->subject) {
if (option (OPTFASTREPLY))
- return (0);
+ return 0;
else
m_strcpy(buf, sizeof(buf), en->subject);
}
!= M_NO)) {
mutt_message _("No subject, aborting.");
- return (-1);
+ return -1;
}
m_strreplace(&en->subject, buf);
break;
default:
- return (-1); /* abort */
+ return -1; /* abort */
}
}
else
else
address_list_append(to, address_list_dup(env->from));
- return (0);
+ return 0;
}
int mutt_fetch_recips (ENVELOPE * out, ENVELOPE * in, int flags)
if (in->mail_followup_to && hmfupto == M_YES &&
default_to (&out->cc, in, flags & SENDLISTREPLY, hmfupto) == -1)
- return (-1); /* abort */
+ return -1; /* abort */
}
else {
if (default_to (&out->to, in, flags & SENDGROUPREPLY, hmfupto) == -1)
- return (-1); /* abort */
+ return -1; /* abort */
if ((flags & SENDGROUPREPLY)
&& (!in->mail_followup_to || hmfupto != M_YES))
*/
mutt_error _("No tagged messages are visible!");
- return (-1);
+ return -1;
}
}
else
if ((flags & SENDLISTREPLY) && !env->to) {
mutt_error _("No mailing lists found!");
- return (-1);
+ return -1;
}
mutt_make_misc_reply_headers (env, ctx, cur, curenv);
else if (flags & SENDFORWARD)
mutt_make_forward_subject (env, ctx, cur);
- return (0);
+ return 0;
}
static int generate_body (FILE * tempfp, /* stream for outgoing message */
if ((i =
query_quadoption (OPT_INCLUDE,
_("Include message in reply?"))) == -1)
- return (-1);
+ return -1;
if (i == M_YES) {
mutt_message _("Including quoted message...");
if (include_reply (ctx, h, tempfp) == -1) {
mutt_error _("Could not include all requested messages!");
- return (-1);
+ return -1;
}
fputc ('\n', tempfp);
}
mutt_clear_error ();
- return (0);
+ return 0;
}
void mutt_set_followup_to (ENVELOPE * e)
adr->mailbox = m_strdup(NONULL(mod_core.username));
}
- return (adr);
+ return adr;
}
static int send_message (HEADER * msg)
if ((mutt_write_mime_body (msg->content, tempfp) == -1)) {
m_fclose(&tempfp);
unlink (tempfile);
- return (-1);
+ return -1;
}
if (m_fclose(&tempfp) != 0) {
mutt_perror (_("Can't create temporary file"));
unlink (tempfile);
- return (-1);
+ return -1;
}
i = mutt_invoke_mta (msg->env->from, msg->env->to, msg->env->cc,
msg->env->bcc, tempfile,
(msg->content->encoding == ENC8BIT));
- return (i);
+ return i;
}
/* rfc2047 encode the content-descriptions */
fprintf (f, "Content-Transfer-Encoding: %s\n", ENCODING (a->encoding));
/* Do NOT add the terminator here!!! */
- return (ferror (f) ? -1 : 0);
+ return ferror (f) ? -1 : 0;
}
int mutt_write_mime_body (BODY * a, FILE * f)
if (!(p = parameter_getval(a->parameter, "boundary"))) {
mutt_error _("No boundary parameter found! [report this error]");
- return (-1);
+ return -1;
}
m_strcpy(boundary, sizeof(boundary), p);
return -1;
}
fprintf (f, "\n--%s--\n", boundary);
- return (ferror (f) ? -1 : 0);
+ return ferror (f) ? -1 : 0;
}
/* This is pretty gross, but it's the best solution for now... */
fgetconv_close (&fc);
m_fclose(&fpin);
- return (ferror (f) ? -1 : 0);
+ return ferror (f) ? -1 : 0;
}
typedef struct {
}
if ((fp = fopen (fname, "r")) == NULL) {
- return (NULL);
+ return NULL;
}
info = p_new(CONTENT, 1);
m_strreplace(&att->xtype, xtype);
}
- return (type);
+ return type;
}
void mutt_message_to_7bit (BODY * a, FILE * fp)
m_fclose(&fp);
- return (body);
+ return body;
}
BODY *mutt_make_file_attach (const char *path)
}
}
- return (ferror (fp) == 0 ? 0 : -1);
+ return ferror (fp) == 0 ? 0 : -1;
}
static void encode_headers (string_list_t * h)
mutt_unblock_signals_system (1);
- return (st);
+ return st;
}
static const char **
args[(*argslen)++] = addr->mailbox;
}
}
- return (args);
+ return args;
}
static const char **
p_realloc(&args, *argsmax += 5);
}
args[(*argslen)++] = s;
- return (args);
+ return args;
}
int mutt_invoke_mta(address_t *from, address_t *to, address_t *cc,
i = 1;
else
i = -1;
- return (i);
+ return i;
}
/* For postponing (!final) do the necessary encodings only */
set_noconv_flags (hdr->content, 1);
if (mx_open_mailbox (path, M_APPEND | M_QUIET, &f) == NULL) {
- return (-1);
+ return -1;
}
/* We need to add a Content-Length field to avoid problems where a line in
hdr->read = !post; /* make sure to put it in the `cur' directory (maildir) */
if ((msg = mx_open_new_message (&f, hdr, M_ADD_FROM)) == NULL) {
mx_close_mailbox (&f, NULL);
- return (-1);
+ return -1;
}
/* post == 1 => postpone message. Set mode = -1 in mutt_write_rfc822_header()
int result = (*pb)->score - (*pa)->score; /* note that this is reverse */
AUXSORT (result, a, b);
- return (SORTCODE (result));
+ return SORTCODE (result);
}
static int compare_size (const void *a, const void *b)
int result = (*pa)->content->length - (*pb)->content->length;
AUXSORT (result, a, b);
- return (SORTCODE (result));
+ return SORTCODE (result);
}
static int compare_date_sent (const void *a, const void *b)
int result = (*pa)->date_sent - (*pb)->date_sent;
AUXSORT (result, a, b);
- return (SORTCODE (result));
+ return SORTCODE (result);
}
static int compare_subject (const void *a, const void *b)
else
rc = m_strcasecmp((*pa)->env->real_subj, (*pb)->env->real_subj);
AUXSORT (rc, a, b);
- return (SORTCODE (rc));
+ return SORTCODE (rc);
}
const char *mutt_get_name (address_t * a)
result = m_strcasecmp(fa, fb);
AUXSORT (result, a, b);
- return (SORTCODE (result));
+ return SORTCODE (result);
}
static int compare_from (const void *a, const void *b)
result = m_strcasecmp(fa, fb);
AUXSORT (result, a, b);
- return (SORTCODE (result));
+ return SORTCODE (result);
}
static int compare_date_received (const void *a, const void *b)
int result = (*pa)->received - (*pb)->received;
AUXSORT (result, a, b);
- return (SORTCODE (result));
+ return SORTCODE (result);
}
static int compare_order (const void *a, const void *b)
HEADER **ha = (HEADER **) a;
HEADER **hb = (HEADER **) b;
/* no need to auxsort because you will never have equality here */
- return (SORTCODE ((*ha)->index - (*hb)->index));
+ return SORTCODE ((*ha)->index - (*hb)->index);
}
static int compare_spam (const void *a, const void *b)
/* If one msg has spam attr but other does not, sort the one with first. */
if (ahas && !bhas)
- return (SORTCODE (1));
+ return SORTCODE (1);
if (!ahas && bhas)
- return (SORTCODE (-1));
+ return SORTCODE (-1);
/* Else, if neither has a spam attr, presume equality. Fall back on aux. */
if (!ahas && !bhas) {
AUXSORT (result, a, b);
- return (SORTCODE (result));
+ return SORTCODE (result);
}
/* If either aptr or bptr is equal to data, there is no numeric */
/* value for that spam attribute. In this case, compare lexically. */
if ((aptr == (*ppa)->env->spam->data) || (bptr == (*ppb)->env->spam->data))
- return (SORTCODE (m_strcmp(aptr, bptr)));
+ return SORTCODE (m_strcmp(aptr, bptr));
/* Otherwise, we have numeric value for both attrs. If these values */
/* are equal, then we first fall back upon string comparison, then */
AUXSORT (result, a, b);
}
- return (SORTCODE (result));
+ return SORTCODE (result);
}
sort_t *mutt_get_sort_func (int method)
{
switch (method & SORT_MASK) {
case SORT_RECEIVED:
- return (compare_date_received);
+ return compare_date_received;
case SORT_ORDER:
- return (compare_order);
+ return compare_order;
case SORT_DATE:
- return (compare_date_sent);
+ return compare_date_sent;
case SORT_SUBJECT:
- return (compare_subject);
+ return compare_subject;
case SORT_FROM:
- return (compare_from);
+ return compare_from;
case SORT_SIZE:
- return (compare_size);
+ return compare_size;
case SORT_TO:
- return (compare_to);
+ return compare_to;
case SORT_SCORE:
- return (compare_score);
+ return compare_score;
case SORT_SPAM:
- return (compare_spam);
+ return compare_spam;
default:
- return (NULL);
+ return NULL;
}
/* not reached */
}
{
while (a) {
if (a == b)
- return (1);
+ return 1;
a = a->parent;
}
- return (0);
+ return 0;
}
/* Determines whether to display a message's subject. */
/* if the user disabled subject hiding, display it */
if (!option (OPTHIDETHREADSUBJECT))
- return (1);
+ return 1;
/* if our subject is different from our parent's, display it */
if (hdr->subject_changed)
- return (1);
+ return 1;
/* if our subject is different from that of our closest previously displayed
* sibling, display the subject */
hdr = tmp->message;
if (hdr && VISIBLE (hdr, ctx)) {
if (hdr->subject_changed)
- return (1);
+ return 1;
else
break;
}
hdr = tmp->message;
if (hdr) {
if (VISIBLE (hdr, ctx))
- return (0);
+ return 0;
else if (hdr->subject_changed)
- return (1);
+ return 1;
}
}
/* if we have no visible parent or previous sibling, display the subject */
- return (1);
+ return 1;
}
static void linearize_tree (CONTEXT * ctx)
cur = cur->next;
}
- return (subjects);
+ return subjects;
}
/* find the best possible match for a parent mesage based upon subject.
subjects = subjects->next;
p_delete(&oldlist);
}
- return (last);
+ return last;
}
/* remove cur and its descendants from their current location.
else {
sort_func = NULL;
sort_func = mutt_get_sort_func (Sort);
- return (sort_func ? 1 : 0);
+ return sort_func ? 1 : 0;
}
}
*/
Sort ^= SORT_REVERSE;
if (!compare_threads (NULL, NULL))
- return (thread);
+ return thread;
top = thread;
else {
Sort ^= SORT_REVERSE;
p_delete(&array);
- return (top);
+ return top;
}
}
THREAD *top;
if (cur->message && cur->message->virtual >= 0)
- return (cur->message);
+ return cur->message;
top = cur;
if ((cur = cur->child) == NULL)
- return (NULL);
+ return NULL;
while (reverse && cur->next)
cur = cur->next;
for (;;) {
if (cur->message && cur->message->virtual >= 0)
- return (cur->message);
+ return cur->message;
if (cur->child) {
cur = cur->child;
while (!(reverse ? cur->prev : cur->next)) {
cur = cur->parent;
if (cur == top)
- return (NULL);
+ return NULL;
}
cur = reverse ? cur->prev : cur->next;
}
if ((Sort & SORT_MASK) != SORT_THREADS) {
mutt_error _("Threading is not enabled.");
- return (hdr->virtual);
+ return hdr->virtual;
}
cur = hdr->thread;
do {
cur = cur->next;
if (!cur)
- return (-1);
+ return -1;
tmp = find_virtual (cur, 0);
} while (!tmp);
}
do {
cur = cur->prev;
if (!cur)
- return (-1);
+ return -1;
tmp = find_virtual (cur, 1);
} while (!tmp);
}
- return (tmp->virtual);
+ return tmp->virtual;
}
int mutt_parent_message (CONTEXT * ctx, HEADER * hdr)
if ((Sort & SORT_MASK) != SORT_THREADS) {
mutt_error _("Threading is not enabled.");
- return (hdr->virtual);
+ return hdr->virtual;
}
for (thread = hdr->thread->parent; thread; thread = thread->parent) {
if ((hdr = thread->message) != NULL) {
if (VISIBLE (hdr, ctx))
- return (hdr->virtual);
+ return hdr->virtual;
else {
mutt_error _("Parent message is not visible in this limited view.");
- return (-1);
+ return -1;
}
}
}
mutt_error _("Parent message is not available.");
- return (-1);
+ return -1;
}
void mutt_set_virtual (CONTEXT * ctx)
if ((Sort & SORT_MASK) != SORT_THREADS && !(flag & M_THREAD_GET_HIDDEN)) {
mutt_error (_("Threading is not enabled."));
- return (cur->virtual);
+ return cur->virtual;
}
final = cur->virtual;
if (thread == top && (thread = thread->child) == NULL) {
/* return value depends on action requested */
if (flag & (M_THREAD_COLLAPSE | M_THREAD_UNCOLLAPSE))
- return (final);
+ return final;
else if (flag & M_THREAD_UNREAD)
- return ((old && new) ? new : (old ? old : new));
+ return (old && new) ? new : (old ? old : new);
else if (flag & M_THREAD_GET_HIDDEN)
- return (num_hidden);
+ return num_hidden;
else if (flag & M_THREAD_NEXT_UNREAD)
- return (min_unread);
+ return min_unread;
}
for (;;) {
/* return value depends on action requested */
if (flag & (M_THREAD_COLLAPSE | M_THREAD_UNCOLLAPSE))
- return (final);
+ return final;
else if (flag & M_THREAD_UNREAD)
- return ((old && new) ? new : (old ? old : new));
+ return (old && new) ? new : (old ? old : new);
else if (flag & M_THREAD_GET_HIDDEN)
- return (num_hidden + 1);
+ return num_hidden + 1;
else if (flag & M_THREAD_NEXT_UNREAD)
- return (min_unread);
+ return min_unread;
- return (0);
+ return 0;
#undef CHECK_LIMIT
}
int i, rc;
if ((Sort & SORT_MASK) != SORT_THREADS || !hdr->thread)
- return (1);
+ return 1;
threads[0] = hdr->thread;
while (threads[0]->parent)
if (flag)
rc += 1;
- return (rc);
+ return rc;
}