bool dry_run, bool color)
{
int object = 0, attr = 0, fg = 0, bg = 0, q_level = 0, match = 0;
- enum CommandResult r = MUTT_CMD_SUCCESS;
+ enum CommandResult rc = MUTT_CMD_SUCCESS;
if (parse_object(buf, s, &object, &q_level, err) == -1)
return MUTT_CMD_ERROR;
#endif
if (object == MT_COLOR_HEADER)
- r = add_pattern(&ColorHdrList, buf->data, false, fg, bg, attr, err, false, match);
+ rc = add_pattern(&ColorHdrList, buf->data, false, fg, bg, attr, err, false, match);
else if (object == MT_COLOR_BODY)
- r = add_pattern(&ColorBodyList, buf->data, true, fg, bg, attr, err, false, match);
+ rc = add_pattern(&ColorBodyList, buf->data, true, fg, bg, attr, err, false, match);
else if (object == MT_COLOR_ATTACH_HEADERS)
- r = add_pattern(&ColorAttachList, buf->data, true, fg, bg, attr, err, false, match);
+ rc = add_pattern(&ColorAttachList, buf->data, true, fg, bg, attr, err, false, match);
else if ((object == MT_COLOR_STATUS) && MoreArgs(s))
{
/* 'color status fg bg' can have up to 2 arguments:
return MUTT_CMD_WARNING;
}
- r = add_pattern(&ColorStatusList, buf->data, true, fg, bg, attr, err, false, match);
+ rc = add_pattern(&ColorStatusList, buf->data, true, fg, bg, attr, err, false, match);
}
else if (object == MT_COLOR_INDEX)
{
- r = add_pattern(&ColorIndexList, buf->data, true, fg, bg, attr, err, true, match);
+ rc = add_pattern(&ColorIndexList, buf->data, true, fg, bg, attr, err, true, match);
mutt_menu_set_redraw_full(MENU_MAIN);
}
else if (object == MT_COLOR_INDEX_AUTHOR)
{
- r = add_pattern(&ColorIndexAuthorList, buf->data, true, fg, bg, attr, err, true, match);
+ rc = add_pattern(&ColorIndexAuthorList, buf->data, true, fg, bg, attr, err, true, match);
mutt_menu_set_redraw_full(MENU_MAIN);
}
else if (object == MT_COLOR_INDEX_FLAGS)
{
- r = add_pattern(&ColorIndexFlagsList, buf->data, true, fg, bg, attr, err, true, match);
+ rc = add_pattern(&ColorIndexFlagsList, buf->data, true, fg, bg, attr, err, true, match);
mutt_menu_set_redraw_full(MENU_MAIN);
}
else if (object == MT_COLOR_INDEX_SUBJECT)
{
- r = add_pattern(&ColorIndexSubjectList, buf->data, true, fg, bg, attr, err, true, match);
+ rc = add_pattern(&ColorIndexSubjectList, buf->data, true, fg, bg, attr, err, true, match);
mutt_menu_set_redraw_full(MENU_MAIN);
}
else if (object == MT_COLOR_INDEX_TAG)
{
- r = add_pattern(&ColorIndexTagList, buf->data, true, fg, bg, attr, err, true, match);
+ rc = add_pattern(&ColorIndexTagList, buf->data, true, fg, bg, attr, err, true, match);
mutt_menu_set_redraw_full(MENU_MAIN);
}
else if (object == MT_COLOR_QUOTED)
mutt_menu_set_redraw_full(MENU_MAIN);
}
- return r;
+ return rc;
}
#ifdef HAVE_COLOR
return -1;
if (!e->content)
return -1;
- int r = mutt_copy_message_fp(fp_out, msg->fp, e, cmflags, chflags);
- if ((r == 0) && (ferror(fp_out) || feof(fp_out)))
+ int rc = mutt_copy_message_fp(fp_out, msg->fp, e, cmflags, chflags);
+ if ((rc == 0) && (ferror(fp_out) || feof(fp_out)))
{
mutt_debug(LL_DEBUG1, "failed to detect EOF!\n");
- r = -1;
+ rc = -1;
}
mx_msg_close(src, &msg);
- return r;
+ return rc;
}
/**
{
char buf[256];
struct Message *msg = NULL;
- int r;
+ int rc;
if (fseeko(fp_in, e->offset, SEEK_SET) < 0)
return -1;
if (dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF)
chflags |= CH_FROM | CH_FORCE_FROM;
chflags |= (dest->magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
- r = mutt_copy_message_fp(msg->fp, fp_in, e, cmflags, chflags);
+ rc = mutt_copy_message_fp(msg->fp, fp_in, e, cmflags, chflags);
if (mx_msg_commit(dest, msg) != 0)
- r = -1;
+ rc = -1;
#ifdef USE_NOTMUCH
if (msg->committed_path && dest->magic == MUTT_MAILDIR && src->magic == MUTT_NOTMUCH)
#endif
mx_msg_close(dest, &msg);
- return r;
+ return rc;
}
/**
struct Message *msg = mx_msg_open(src, e->msgno);
if (!msg)
return -1;
- int r = append_message(dest, msg->fp, src, e, cmflags, chflags);
+ int rc = append_message(dest, msg->fp, src, e, cmflags, chflags);
mx_msg_close(src, &msg);
- return r;
+ return rc;
}
/**
*/
int imap_authenticate(struct ImapAccountData *adata)
{
- int r = IMAP_AUTH_FAILURE;
+ int rc = IMAP_AUTH_FAILURE;
if (C_ImapAuthenticators && *C_ImapAuthenticators)
{
const struct ImapAuth *auth = &imap_authenticators[i];
if (!auth->method || (mutt_str_strcasecmp(auth->method, method) == 0))
{
- r = auth->authenticate(adata, method);
- if (r == IMAP_AUTH_SUCCESS)
+ rc = auth->authenticate(adata, method);
+ if (rc == IMAP_AUTH_SUCCESS)
{
FREE(&methods);
- return r;
+ return rc;
}
}
}
for (size_t i = 0; i < mutt_array_size(imap_authenticators); ++i)
{
- r = imap_authenticators[i].authenticate(adata, NULL);
- if (r == IMAP_AUTH_SUCCESS)
- return r;
+ rc = imap_authenticators[i].authenticate(adata, NULL);
+ if (rc == IMAP_AUTH_SUCCESS)
+ return rc;
}
}
mutt_error(_("No authenticators available or wrong credentials"));
- return r;
+ return rc;
}
*/
int imap_msg_commit(struct Mailbox *m, struct Message *msg)
{
- int r = mutt_file_fclose(&msg->fp);
- if (r != 0)
- return r;
+ int rc = mutt_file_fclose(&msg->fp);
+ if (rc != 0)
+ return rc;
return imap_append_message(m, msg);
}
struct Buffer *token, struct Buffer *err)
{
int i;
- enum CommandResult r = MUTT_CMD_SUCCESS;
+ enum CommandResult rc = MUTT_CMD_SUCCESS;
struct Buffer expn;
if (!line || !*line)
{
if (mutt_str_strcmp(token->data, Commands[i].name) == 0)
{
- r = Commands[i].func(token, &expn, Commands[i].data, err);
- if (r != MUTT_CMD_SUCCESS)
+ rc = Commands[i].func(token, &expn, Commands[i].data, err);
+ if (rc != MUTT_CMD_SUCCESS)
{ /* -1 Error, +1 Finish */
goto finish; /* Propagate return code */
}
if (!Commands[i].name)
{
mutt_buffer_printf(err, _("%s: unknown command"), NONULL(token->data));
- r = MUTT_CMD_ERROR;
+ rc = MUTT_CMD_ERROR;
break; /* Ignore the rest of the line */
}
}
finish:
if (expn.destroy)
FREE(&expn.data);
- return r;
+ return rc;
}
/**
{
const struct Binding *bindings = NULL;
int menu[sizeof(Menus) / sizeof(struct Mapping) - 1], nummenus;
- enum CommandResult r = MUTT_CMD_SUCCESS;
+ enum CommandResult rc = MUTT_CMD_SUCCESS;
char *key = parse_keymap(menu, s, mutt_array_size(menu), &nummenus, err, true);
if (!key)
if (MoreArgs(s))
{
mutt_buffer_printf(err, _("%s: too many arguments"), "bind");
- r = MUTT_CMD_ERROR;
+ rc = MUTT_CMD_ERROR;
}
else if (mutt_str_strcasecmp("noop", buf->data) == 0)
{
* however for other menus try generic first. */
if ((menu[i] != MENU_PAGER) && (menu[i] != MENU_EDITOR) && (menu[i] != MENU_GENERIC))
{
- r = try_bind(key, menu[i], buf->data, OpGeneric, err);
- if (r == 0)
+ rc = try_bind(key, menu[i], buf->data, OpGeneric, err);
+ if (rc == 0)
continue;
- if (r == -2)
+ if (rc == -2)
break;
}
bindings = km_get_table(menu[i]);
if (bindings)
{
- r = try_bind(key, menu[i], buf->data, bindings, err);
+ rc = try_bind(key, menu[i], buf->data, bindings, err);
}
}
}
FREE(&key);
- return r;
+ return rc;
}
/**
unsigned long data, struct Buffer *err)
{
int menu[sizeof(Menus) / sizeof(struct Mapping) - 1], nummenus;
- enum CommandResult r = MUTT_CMD_ERROR;
+ enum CommandResult rc = MUTT_CMD_ERROR;
char *seq = NULL;
char *key = parse_keymap(menu, s, mutt_array_size(menu), &nummenus, err, false);
{
for (int i = 0; i < nummenus; ++i)
{
- r = km_bind(key, menu[i], OP_MACRO, seq, buf->data);
+ rc = km_bind(key, menu[i], OP_MACRO, seq, buf->data);
}
}
{
for (int i = 0; i < nummenus; ++i)
{
- r = km_bind(key, menu[i], OP_MACRO, buf->data, NULL);
+ rc = km_bind(key, menu[i], OP_MACRO, buf->data, NULL);
}
}
}
FREE(&key);
- return r;
+ return rc;
}
/**
*/
int maildir_move_to_context(struct Mailbox *m, struct Maildir **md)
{
- int r = maildir_add_to_context(m, *md);
+ int num = maildir_add_to_context(m, *md);
maildir_free_maildir(md);
- return r;
+ return num;
}
#ifdef USE_HCACHE
{
DIR *dp = NULL;
struct dirent *de = NULL;
- int r = 1; /* assume empty until we find a message */
+ int rc = 1; /* assume empty until we find a message */
char realpath[PATH_MAX];
int iter = 0;
{
if (*de->d_name != '.')
{
- r = 0;
+ rc = 0;
break;
}
}
closedir(dp);
iter++;
- } while (r && iter < 2);
+ } while (rc && iter < 2);
- return r;
+ return rc;
}
/**
int mh_check_empty(const char *path)
{
struct dirent *de = NULL;
- int r = 1; /* assume empty until we find a message */
+ int rc = 1; /* assume empty until we find a message */
DIR *dp = opendir(path);
if (!dp)
{
if (mh_valid_message(de->d_name))
{
- r = 0;
+ rc = 0;
break;
}
}
closedir(dp);
- return r;
+ return rc;
}
/**
if (!adata)
return -1;
- int r = mutt_file_lock(fileno(adata->fp), excl, retry);
- if (r == 0)
+ int rc = mutt_file_lock(fileno(adata->fp), excl, retry);
+ if (rc == 0)
adata->locked = true;
else if (retry && !excl)
{
return 0;
}
- return r;
+ return rc;
}
/**
if (!fp || !*fp)
return 0;
- int r = fclose(*fp);
+ int rc = fclose(*fp);
*fp = NULL;
- return r;
+ return rc;
}
/**
if (!fp || !*fp)
return 0;
- int r = 0;
+ int rc = 0;
if (fflush(*fp) || fsync(fileno(*fp)))
{
int save_errno = errno;
- r = -1;
+ rc = -1;
mutt_file_fclose(fp);
errno = save_errno;
}
else
- r = mutt_file_fclose(fp);
+ rc = mutt_file_fclose(fp);
- return r;
+ return rc;
}
/**
*/
struct Regex *mutt_regex_compile(const char *str, int flags)
{
- struct Regex *r = mutt_mem_calloc(1, sizeof(struct Regex));
- r->pattern = mutt_str_strdup(str);
- r->regex = mutt_mem_calloc(1, sizeof(regex_t));
- if (REGCOMP(r->regex, NONULL(str), flags) != 0)
- mutt_regex_free(&r);
+ struct Regex *rx = mutt_mem_calloc(1, sizeof(struct Regex));
+ rx->pattern = mutt_str_strdup(str);
+ rx->regex = mutt_mem_calloc(1, sizeof(regex_t));
+ if (REGCOMP(rx->regex, NONULL(str), flags) != 0)
+ mutt_regex_free(&rx);
- return r;
+ return rx;
}
/**
char buf[8192];
struct Message *msg = NULL;
CopyHeaderFlags chflags = CH_NO_FLAGS;
- int r = -1;
+ int rc = -1;
struct Email *en = m->email;
en->msgno = e->msgno; /* required for MH/maildir */
if ((mutt_copy_message_fp(msg->fp, fp, en, 0, chflags) == 0) &&
(mx_msg_commit(ctx->mailbox, msg) == 0))
{
- r = 0;
+ rc = 0;
}
else
{
- r = -1;
+ rc = -1;
}
mx_msg_close(ctx->mailbox, &msg);
mx_mbox_close(&ctx);
- return r;
+ return rc;
}
else
{
if (!m || !msg || !*msg)
return 0;
- int r = 0;
+ int rc = 0;
if (m->mx_ops && m->mx_ops->msg_close)
- r = m->mx_ops->msg_close(m, *msg);
+ rc = m->mx_ops->msg_close(m, *msg);
if ((*msg)->path)
{
FREE(&(*msg)->committed_path);
FREE(msg);
- return r;
+ return rc;
}
/**
static int smtp_rcpt_to(struct Connection *conn, const struct Address *a)
{
char buf[1024];
- int r;
+ int rc;
while (a)
{
snprintf(buf, sizeof(buf), "RCPT TO:<%s>\r\n", a->mailbox);
if (mutt_socket_send(conn, buf) == -1)
return SMTP_ERR_WRITE;
- r = smtp_get_resp(conn);
- if (r != 0)
- return r;
+ rc = smtp_get_resp(conn);
+ if (rc != 0)
+ return rc;
a = a->next;
}
char buf[1024];
struct Progress progress;
struct stat st;
- int r, term = 0;
+ int rc, term = 0;
size_t buflen = 0;
FILE *fp = fopen(msgfile, "r");
mutt_file_fclose(&fp);
return SMTP_ERR_WRITE;
}
- r = smtp_get_resp(conn);
- if (r != 0)
+ rc = smtp_get_resp(conn);
+ if (rc != 0)
{
mutt_file_fclose(&fp);
- return r;
+ return rc;
}
while (fgets(buf, sizeof(buf) - 1, fp))
if (mutt_socket_send(conn, ".\r\n") == -1)
return SMTP_ERR_WRITE;
- r = smtp_get_resp(conn);
- if (r != 0)
- return r;
+ rc = smtp_get_resp(conn);
+ if (rc != 0)
+ return rc;
return 0;
}