wchar_t wc;
mbstate_t mb;
size_t l;
- int rv = 0, bad = 0, dry = !dest || !destlen;
+ int rc = 0, bad = 0, dry = !dest || !destlen;
memset(&mb, 0, sizeof(mbstate_t));
if (l == (size_t)(-1))
memset(&mb, 0, sizeof(mbstate_t));
*dest++ = '_';
- rv = -1;
+ rc = -1;
}
else if (!dry)
{
}
if (!dry)
*dest = '\0';
- return rv;
+ return rc;
}
void mutt_create_alias(struct Envelope *cur, struct Address *iadr)
{
pid_t thepid;
int out = -1;
- int rv = 0;
+ int rc = 0;
if (outfile && *outfile)
{
mutt_file_fclose(&ifp);
}
- rv = 1;
+ rc = 1;
bail:
* check for error exit from child process
*/
if (mutt_wait_filter(thepid) != 0)
- rv = 0;
+ rc = 0;
- if (rv == 0 || option(OPT_WAIT_KEY))
+ if (rc == 0 || option(OPT_WAIT_KEY))
mutt_any_key_to_continue(NULL);
- return rv;
+ return rc;
}
static FILE *save_attachment_open(char *path, int flags)
static int check_traditional_pgp(struct Header *h, int *redraw)
{
struct Message *msg = NULL;
- int rv = 0;
+ int rc = 0;
h->security |= PGP_TRADITIONAL_CHECKED;
{
h->security = crypt_query(h->content);
*redraw |= REDRAW_FULL;
- rv = 1;
+ rc = 1;
}
h->security |= PGP_TRADITIONAL_CHECKED;
mx_close_message(Context, &msg);
- return rv;
+ return rc;
}
int mutt_check_traditional_pgp(struct Header *h, int *redraw)
{
- int rv = 0;
+ int rc = 0;
if (h && !(h->security & PGP_TRADITIONAL_CHECKED))
- rv = check_traditional_pgp(h, redraw);
+ rc = check_traditional_pgp(h, redraw);
else
{
for (int i = 0; i < Context->msgcount; i++)
{
if (message_is_tagged(Context, i) && !(Context->hdrs[i]->security & PGP_TRADITIONAL_CHECKED))
{
- rv = check_traditional_pgp(Context->hdrs[i], redraw) || rv;
+ rc = check_traditional_pgp(Context->hdrs[i], redraw) || rc;
}
}
}
- return rv;
+ return rc;
}
fd_set rfds;
unsigned long wait_millis, post_t_millis;
struct timeval tv, pre_t, post_t;
- int rv;
+ int rc;
if (conn->fd < 0)
return -1;
FD_SET(conn->fd, &rfds);
gettimeofday(&pre_t, NULL);
- rv = select(conn->fd + 1, &rfds, NULL, NULL, &tv);
+ rc = select(conn->fd + 1, &rfds, NULL, NULL, &tv);
gettimeofday(&post_t, NULL);
- if (rv > 0 || (rv < 0 && errno != EINTR))
- return rv;
+ if (rc > 0 || (rc < 0 && errno != EINTR))
+ return rc;
if (SigInt)
mutt_query_exit();
FILE *fp = NULL;
X509 *cert = NULL;
X509_STORE *store = NULL;
- int rv = 1;
+ int rc = 1;
#ifdef DEBUG
char buf[STRING];
#endif
}
/* PEM_read_X509 sets the error NO_START_LINE on eof */
if (ERR_GET_REASON(ERR_peek_last_error()) != PEM_R_NO_START_LINE)
- rv = 0;
+ rc = 0;
ERR_clear_error();
X509_free(cert);
mutt_file_fclose(&fp);
- return rv;
+ return rc;
}
/**
*/
static int ssl_set_verify_partial(SSL_CTX *ctx)
{
- int rv = 0;
+ int rc = 0;
#ifdef HAVE_SSL_PARTIAL_CHAIN
X509_VERIFY_PARAM *param = NULL;
if (0 == SSL_CTX_set1_param(ctx, param))
{
mutt_debug(2, "ssl_set_verify_partial: SSL_CTX_set1_param() failed.\n");
- rv = -1;
+ rc = -1;
}
X509_VERIFY_PARAM_free(param);
}
{
mutt_debug(2,
"ssl_set_verify_partial: X509_VERIFY_PARAM_new() failed.\n");
- rv = -1;
+ rc = -1;
}
}
#endif
- return rv;
+ return rc;
}
/**
int mutt_window_mvprintw(struct MuttWindow *win, int row, int col, const char *fmt, ...)
{
va_list ap;
- int rv;
+ int rc;
- rv = mutt_window_move(win, row, col);
- if (rv != ERR)
+ rc = mutt_window_move(win, row, col);
+ if (rc != ERR)
{
va_start(ap, fmt);
- rv = vw_printw(stdscr, fmt, ap);
+ rc = vw_printw(stdscr, fmt, ap);
va_end(ap);
}
- return rv;
+ return rc;
}
/**
*/
int mutt_enter_string(char *buf, size_t buflen, int col, int flags)
{
- int rv;
+ int rc;
struct EnterState *es = mutt_new_enter_state();
do
{
clearok(stdscr, TRUE);
}
#endif
- rv = mutt_enter_string_full(buf, buflen, col, flags, 0, NULL, NULL, es);
- } while (rv == 1);
+ rc = mutt_enter_string_full(buf, buflen, col, flags, 0, NULL, NULL, es);
+ } while (rc == 1);
mutt_free_enter_state(&es);
- return rv;
+ return rc;
}
/**
wchar_t wc;
mbstate_t mbstate;
- int rv = 0;
+ int rc = 0;
memset(&mbstate, 0, sizeof(mbstate));
if (state->wbuf)
ch = km_dokey(MENU_EDITOR);
if (ch < 0)
{
- rv = (SigWinch && ch == -2) ? 1 : -1;
+ rc = (SigWinch && ch == -2) ? 1 : -1;
goto bye;
}
(flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0, NULL, NULL);
if (*buf)
replace_part(state, i, buf);
- rv = 1;
+ rc = 1;
goto bye;
}
if (!mutt_complete(buf, buflen))
replace_part(state, i, buf);
if (!r)
{
- rv = 1;
+ rc = 1;
goto bye;
}
break;
replace_part(state, i, buf);
if (!r)
{
- rv = 1;
+ rc = 1;
goto bye;
}
break;
replace_part(state, i, buf);
if (!r)
{
- rv = 1;
+ rc = 1;
goto bye;
}
}
mutt_query_complete(buf, buflen);
replace_part(state, i, buf);
- rv = 1;
+ rc = 1;
goto bye;
}
else if (flags & MUTT_COMMAND)
mutt_pretty_mailbox(buf, buflen);
if (!pass)
mutt_history_add(hclass, buf, true);
- rv = 0;
+ rc = 0;
goto bye;
}
/* file selection cancelled */
- rv = 1;
+ rc = 1;
goto bye;
}
tfiles[0] = mutt_str_strdup(buf);
*files = tfiles;
}
- rv = 0;
+ rc = 0;
goto bye;
}
else if (wc && (wc < ' ' || IsWPrint(wc))) /* why? */
mutt_reset_history_state(hclass);
FREE(&tempbuf);
- return rv;
+ return rc;
}
void mutt_free_enter_state(struct EnterState **esp)
int mutt_group_context_remove_adrlist(struct GroupContext *ctx, struct Address *a)
{
- int rv = 0;
+ int rc = 0;
- for (; (!rv) && ctx; ctx = ctx->next)
+ for (; (!rc) && ctx; ctx = ctx->next)
{
- rv = group_remove_adrlist(ctx->g, a);
+ rc = group_remove_adrlist(ctx->g, a);
if (empty_group(ctx->g))
group_remove(ctx->g);
}
- return rv;
+ return rc;
}
int mutt_group_context_add_regex(struct GroupContext *ctx, const char *s,
int flags, struct Buffer *err)
{
- int rv = 0;
+ int rc = 0;
- for (; (!rv) && ctx; ctx = ctx->next)
- rv = group_add_regex(ctx->g, s, flags, err);
+ for (; (!rc) && ctx; ctx = ctx->next)
+ rc = group_add_regex(ctx->g, s, flags, err);
- return rv;
+ return rc;
}
int mutt_group_context_remove_regex(struct GroupContext *ctx, const char *s)
{
- int rv = 0;
+ int rc = 0;
- for (; (!rv) && ctx; ctx = ctx->next)
+ for (; (!rc) && ctx; ctx = ctx->next)
{
- rv = group_remove_regex(ctx->g, s);
+ rc = group_remove_regex(ctx->g, s);
if (empty_group(ctx->g))
group_remove(ctx->g);
}
- return rv;
+ return rc;
}
bool mutt_group_match(struct Group *g, const char *s)
if (!STAILQ_EMPTY(&alias_queries))
{
- int rv = 0;
+ int rc = 0;
struct Address *a = NULL;
for (; optind < argc; optind++)
mutt_list_insert_tail(&alias_queries, mutt_str_strdup(argv[optind]));
}
else
{
- rv = 1;
+ rc = 1;
printf("%s\n", np->data);
}
}
mutt_list_free(&alias_queries);
- return rv;
+ return rc;
}
if (!option(OPT_NO_CURSES))
*/
static int put_file_in_place(const char *path, const char *safe_file, const char *safe_dir)
{
- int rv;
+ int rc;
- rv = mutt_file_safe_rename(safe_file, path);
+ rc = mutt_file_safe_rename(safe_file, path);
unlink(safe_file);
rmdir(safe_dir);
- return rv;
+ return rc;
}
/**
{
char *user = NULL, *domain = NULL;
char *intl_mailbox = NULL;
- int rv = 0;
+ int rc = 0;
if (err)
*err = NULL;
intl_mailbox = local_to_intl(user, domain);
if (!intl_mailbox)
{
- rv = -1;
+ rc = -1;
if (err && !*err)
*err = mutt_str_strdup(a->mailbox);
continue;
set_intl_mailbox(a, intl_mailbox);
}
- return rv;
+ return rc;
}
int mutt_addrlist_to_local(struct Address *a)
struct Buffer token, expn, err;
char buffer[LONG_STRING] = "";
const struct Command *command = NULL;
- int rv = 0;
+ int rc = 0;
mutt_buffer_init(&token);
mutt_buffer_init(&expn);
if (command->func(&token, &expn, command->data, &err))
{
luaL_error(l, "NeoMutt error: %s", err.data);
- rv = -1;
+ rc = -1;
}
else
{
if (lua_pushstring(l, err.data) == NULL)
handle_error(l);
else
- rv++;
+ rc++;
}
FREE(&err.data);
- return rv;
+ return rc;
}
static int lua_mutt_set(lua_State *l)
{
- int rv = -1;
+ int rc = -1;
const char *param = lua_tostring(l, -2);
mutt_debug(2, " * lua_mutt_set(%s)\n", param);
struct Option opt;
return -1;
}
- rv = 0;
+ rc = 0;
switch (DTYPE(opt.type))
{
case DT_ADDRESS:
case DT_SORT:
case DT_STRING:
opt.data = (long) mutt_str_strdup(lua_tostring(l, -1));
- rv = mutt_option_set(&opt, &err);
+ rc = mutt_option_set(&opt, &err);
FREE(&opt.data);
break;
case DT_QUAD:
"mutt.QUAD_YES, mutt.QUAD_NO, mutt.QUAD_ASKYES, "
"mutt.QUAD_ASKNO",
param);
- rv = -1;
+ rc = -1;
}
else
- rv = mutt_option_set(&opt, &err);
+ rc = mutt_option_set(&opt, &err);
break;
case DT_MAGIC:
if (mx_set_magic(lua_tostring(l, -1)))
{
luaL_error(l, "Invalid mailbox type: %s", opt.data);
- rv = -1;
+ rc = -1;
}
break;
case DT_NUMBER:
if ((i > SHRT_MIN) && (i < SHRT_MAX))
{
opt.data = lua_tointeger(l, -1);
- rv = mutt_option_set(&opt, &err);
+ rc = mutt_option_set(&opt, &err);
}
else
{
luaL_error(l, "Integer overflow of %d, not in %d-%d", i, SHRT_MIN, SHRT_MAX);
- rv = -1;
+ rc = -1;
}
break;
}
case DT_BOOL:
opt.data = (long) lua_toboolean(l, -1);
- rv = mutt_option_set(&opt, &err);
+ rc = mutt_option_set(&opt, &err);
break;
default:
luaL_error(l, "Unsupported NeoMutt parameter type %d for %s", opt.type, param);
- rv = -1;
+ rc = -1;
break;
}
- return rv;
+ return rc;
}
static int lua_mutt_get(lua_State *l)
mutt_debug(2, " * lua_mutt_enter()\n");
struct Buffer token, err;
char *buffer = mutt_str_strdup(lua_tostring(l, -1));
- int rv = 0;
+ int rc = 0;
mutt_buffer_init(&err);
mutt_buffer_init(&token);
if (mutt_parse_rc_line(buffer, &token, &err))
{
luaL_error(l, "NeoMutt error: %s", err.data);
- rv = -1;
+ rc = -1;
}
else
{
if (lua_pushstring(l, err.data) == NULL)
handle_error(l);
else
- rv++;
+ rc++;
}
FREE(&buffer);
FREE(&err.data);
- return rv;
+ return rc;
}
static int lua_mutt_message(lua_State *l)
int mutt_remove_from_regex_list(struct RegexList **l, const char *str)
{
struct RegexList *p = NULL, *last = NULL;
- int rv = -1;
+ int rc = -1;
if (mutt_str_strcmp("*", str) == 0)
{
mutt_free_regex_list(l); /* ``unCMD *'' means delete all current entries */
- rv = 0;
+ rc = 0;
}
else
{
else
(*l) = p->next;
FREE(&p);
- rv = 0;
+ rc = 0;
}
else
{
}
}
}
- return rv;
+ return rc;
}
/**
static int crypt_id_matches_addr(struct Address *addr, struct Address *u_addr,
struct CryptKeyInfo *key)
{
- int rv = 0;
+ int rc = 0;
if (crypt_id_is_valid(key))
- rv |= CRYPT_KV_VALID;
+ rc |= CRYPT_KV_VALID;
if (crypt_id_is_strong(key))
- rv |= CRYPT_KV_STRONGID;
+ rc |= CRYPT_KV_STRONGID;
if (addr && u_addr)
{
if (addr->mailbox && u_addr->mailbox &&
(mutt_str_strcasecmp(addr->mailbox, u_addr->mailbox) == 0))
{
- rv |= CRYPT_KV_ADDR;
+ rc |= CRYPT_KV_ADDR;
}
if (addr->personal && u_addr->personal &&
(mutt_str_strcasecmp(addr->personal, u_addr->personal) == 0))
{
- rv |= CRYPT_KV_STRING;
+ rc |= CRYPT_KV_STRING;
}
}
- return rv;
+ return rc;
}
/*
LOFF_T saved_offset;
size_t saved_length;
FILE *decoded_fp = NULL;
- int rv = 0;
+ int rc = 0;
first_part->goodsig = false;
first_part->warnsig = false;
if (!*fpout)
{
mutt_perror(tempfile);
- rv = -1;
+ rc = -1;
goto bail;
}
unlink(tempfile);
*cur = decrypt_part(b, &s, *fpout, 0, &is_signed);
if (!*cur)
- rv = -1;
+ rc = -1;
rewind(*fpout);
if (is_signed > 0)
first_part->goodsig = true;
mutt_file_fclose(&decoded_fp);
}
- return rv;
+ return rc;
}
/**
int pgp_gpgme_check_traditional(FILE *fp, struct Body *b, int just_one)
{
- int rv = 0;
+ int rc = 0;
int r;
for (; b; b = b->next)
{
if (!just_one && is_multipart(b))
- rv = (pgp_gpgme_check_traditional(fp, b->parts, 0) || rv);
+ rc = (pgp_gpgme_check_traditional(fp, b->parts, 0) || rc);
else if (b->type == TYPETEXT)
{
if ((r = mutt_is_application_pgp(b)))
- rv = (rv || r);
+ rc = (rc || r);
else
- rv = (pgp_check_traditional_one_body(fp, b) || rv);
+ rc = (pgp_check_traditional_one_body(fp, b) || rc);
}
if (just_one)
break;
}
- return rv;
+ return rc;
}
void pgp_gpgme_invoke_import(const char *fname)
*/
static int pgp_copy_checksig(FILE *fpin, FILE *fpout)
{
- int rv = -1;
+ int rc = -1;
if (PgpGoodSign.pattern)
{
if (regexec(PgpGoodSign.regex, line, 0, NULL, 0) == 0)
{
mutt_debug(2, "pgp_copy_checksig: \"%s\" matches regex.\n", line);
- rv = 0;
+ rc = 0;
}
else
mutt_debug(2, "pgp_copy_checksig: \"%s\" doesn't match regex.\n", line);
{
mutt_debug(2, "pgp_copy_checksig: No pattern.\n");
mutt_file_copy_stream(fpin, fpout);
- rv = 1;
+ rc = 1;
}
- return rv;
+ return rc;
}
/**
*/
static int pgp_check_decryption_okay(FILE *fpin)
{
- int rv = -1;
+ int rc = -1;
if (PgpDecryptionOkay.pattern)
{
if (regexec(PgpDecryptionOkay.regex, line, 0, NULL, 0) == 0)
{
mutt_debug(2, "pgp_check_decryption_okay: \"%s\" matches regex.\n", line);
- rv = 0;
+ rc = 0;
break;
}
else
else
{
mutt_debug(2, "pgp_check_decryption_okay: No pattern.\n");
- rv = 1;
+ rc = 1;
}
- return rv;
+ return rc;
}
/**
int pgp_check_traditional(FILE *fp, struct Body *b, int just_one)
{
- int rv = 0;
+ int rc = 0;
int r;
for (; b; b = b->next)
{
if (!just_one && is_multipart(b))
- rv = pgp_check_traditional(fp, b->parts, 0) || rv;
+ rc = pgp_check_traditional(fp, b->parts, 0) || rc;
else if (b->type == TYPETEXT)
{
if ((r = mutt_is_application_pgp(b)))
- rv = rv || r;
+ rc = rc || r;
else
- rv = pgp_check_traditional_one_body(fp, b) || rv;
+ rc = pgp_check_traditional_one_body(fp, b) || rc;
}
if (just_one)
break;
}
- return rv;
+ return rc;
}
int pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile)
LOFF_T saved_offset;
size_t saved_length;
FILE *decoded_fp = NULL;
- int rv = 0;
+ int rc = 0;
if (mutt_is_valid_multipart_pgp_encrypted(b))
b = b->parts->next;
if (!*fpout)
{
mutt_perror(tempfile);
- rv = -1;
+ rc = -1;
goto bail;
}
unlink(tempfile);
*cur = pgp_decrypt_part(b, &s, *fpout, p);
if (!*cur)
- rv = -1;
+ rc = -1;
rewind(*fpout);
bail:
mutt_file_fclose(&decoded_fp);
}
- return rv;
+ return rc;
}
/**
static int pgp_id_matches_addr(struct Address *addr, struct Address *u_addr, struct PgpUid *uid)
{
- int rv = 0;
+ int rc = 0;
if (pgp_id_is_valid(uid))
- rv |= PGP_KV_VALID;
+ rc |= PGP_KV_VALID;
if (pgp_id_is_strong(uid))
- rv |= PGP_KV_STRONGID;
+ rc |= PGP_KV_STRONGID;
if (addr->mailbox && u_addr->mailbox &&
(mutt_str_strcasecmp(addr->mailbox, u_addr->mailbox) == 0))
- {
- rv |= PGP_KV_ADDR;
- }
+ rc |= PGP_KV_ADDR;
if (addr->personal && u_addr->personal &&
(mutt_str_strcasecmp(addr->personal, u_addr->personal) == 0))
- {
- rv |= PGP_KV_STRING;
- }
+ rc |= PGP_KV_STRING;
- return rv;
+ return rc;
}
static struct PgpKeyInfo *pgp_select_key(struct PgpKeyInfo *keys,
unsigned char *p = NULL;
size_t l;
- short rv = -1;
+ short rc = -1;
mutt_mktemp(tempfile, sizeof(tempfile));
out = mutt_file_fopen(tempfile, "w+");
p = pgp_read_packet(out, &l);
if (p)
{
- rv = pgp_mic_from_packet(p, l);
+ rc = pgp_mic_from_packet(p, l);
}
else
{
mutt_file_fclose(&in);
mutt_file_fclose(&out);
pgp_release_packet();
- return rv;
+ return rc;
}
const char *pgp_micalg(const char *fname)
size_t tmplength = b->length;
int origType = b->type;
FILE *tmpfp = NULL;
- int rv = 0;
+ int rc = 0;
if (!mutt_is_application_smime(b))
return -1;
if (!*fpout)
{
mutt_perror(tempfile);
- rv = -1;
+ rc = -1;
goto bail;
}
mutt_file_unlink(tempfile);
*cur = smime_handle_entity(b, &s, *fpout);
if (!*cur)
{
- rv = -1;
+ rc = -1;
goto bail;
}
if (*fpout)
rewind(*fpout);
- return rv;
+ return rc;
}
int smime_application_smime_handler(struct Body *m, struct State *s)
char file[_POSIX_PATH_MAX];
struct Body *b = NULL;
FILE *bfp = NULL;
- int rv = -1;
+ int rc = -1;
struct State s;
int sec_type;
newhdr->security &= ~APPLICATION_SMIME;
}
- rv = 0;
+ rc = 0;
bail:
if (msg)
mx_close_message(ctx, &msg);
- if (rv == -1)
+ if (rc == -1)
{
mutt_free_envelope(&newhdr->env);
mutt_free_body(&newhdr->content);
}
- return rv;
+ return rc;
}
static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
{
- int rv = 0;
+ int rc = 0;
if (!menu->tagprefix)
- rv = crypt_pgp_check_traditional(CURATTACH->fp, CURATTACH->content, 1);
+ rc = crypt_pgp_check_traditional(CURATTACH->fp, CURATTACH->content, 1);
else
{
for (int i = 0; i < actx->idxlen; i++)
if (actx->idx[i]->content->tagged)
- rv = rv || crypt_pgp_check_traditional(actx->idx[i]->fp, actx->idx[i]->content, 1);
+ rc = rc || crypt_pgp_check_traditional(actx->idx[i]->fp, actx->idx[i]->content, 1);
}
- return rv;
+ return rc;
}
static void recvattach_edit_content_type(struct AttachCtx *actx,
const char *t = NULL, *t1 = NULL;
int enc = 0, count = 0;
char *charset = NULL;
- int rv = -1;
+ int rc = -1;
pd = d0 = mutt_mem_malloc(strlen(s) + 1);
mutt_convert_string(&d0, charset, Charset, MUTT_ICONV_HOOK_FROM);
mutt_filter_unprintable(&d0);
mutt_str_strfcpy(d, d0, len);
- rv = 0;
+ rc = 0;
error_out_0:
FREE(&charset);
FREE(&d0);
- return rv;
+ return rc;
}
/**
int rfc822_remove_from_adrlist(struct Address **a, const char *mailbox)
{
struct Address *p = NULL, *last = NULL, *t = NULL;
- int rv = -1;
+ int rc = -1;
p = *a;
last = NULL;
t = p;
p = p->next;
free_address(t);
- rv = 0;
+ rc = 0;
}
else
{
}
}
- return rv;
+ return rc;
}
/**
char *ctype = NULL;
char *finalpath = NULL;
- int rv = -1;
+ int rc = -1;
#ifdef USE_NNTP
if (flags & SENDNEWS)
*/
i = query_quadoption(OPT_RECALL, _("Recall postponed message?"));
if (i == MUTT_ABORT)
- return rv;
+ return rc;
if (i == MUTT_YES)
flags |= SENDPOSTPONED;
}
mutt_update_num_postponed();
mutt_message(_("Message postponed."));
- rv = 1;
+ rc = 1;
goto cleanup;
}
}
}
}
- rv = 0;
+ rc = 0;
cleanup:
mutt_free_header(&msg);
FREE(&finalpath);
- return rv;
+ return rc;
}
int state_printf(struct State *s, const char *fmt, ...)
{
- int rv;
+ int rc;
va_list ap;
va_start(ap, fmt);
- rv = vfprintf(s->fpout, fmt, ap);
+ rc = vfprintf(s->fpout, fmt, ap);
va_end(ap);
- return rv;
+ return rc;
}
void state_prefix_put(const char *d, size_t dlen, struct State *s)