unsigned int saved_encoding = 0;
struct Body *saved_parts = NULL;
struct Header *saved_hdr = NULL;
- int ret = 0;
+ int rc = 0;
memset(&s, 0, sizeof(s));
s.flags = displaying;
if (mutt_file_fsync_close(&s.fpout) != 0)
{
mutt_perror("fclose");
- ret = -1;
+ rc = -1;
}
if (!fp)
{
mutt_file_fclose(&s.fpin);
}
- return ret;
+ return rc;
}
/**
char **outbuf, size_t *outbytesleft,
ICONV_CONST char **inrepls, const char *outrepl)
{
- size_t ret = 0, ret1;
+ size_t rc = 0, ret1;
ICONV_CONST char *ib = *inbuf;
size_t ibl = *inbytesleft;
char *ob = *outbuf;
{
ret1 = iconv(cd, &ib, &ibl, &ob, &obl);
if (ret1 != (size_t) -1)
- ret += ret1;
+ rc += ret1;
if (ibl && obl && errno == EILSEQ)
{
if (inrepls)
ibl--;
ob = ob1;
obl = obl1;
- ret++;
+ rc++;
break;
}
}
ibl--;
ob += n;
obl -= n;
- ret++;
+ rc++;
iconv(cd, 0, 0, 0, 0); /* for good measure */
continue;
}
*inbytesleft = ibl;
*outbuf = ob;
*outbytesleft = obl;
- return ret;
+ return rc;
}
}
*/
int getdnsdomainname(char *d, size_t len)
{
- int ret = -1;
+ int rc = -1;
#if defined(HAVE_GETADDRINFO) || defined(HAVE_GETADDRINFO_A)
char node[STRING];
if (gethostname(node, sizeof(node)))
- return ret;
+ return rc;
struct addrinfo hints;
struct addrinfo *h = NULL;
if (h != NULL && h->ai_canonname && (p = strchr(h->ai_canonname, '.')))
{
mutt_str_strfcpy(d, ++p, len);
- ret = 0;
+ rc = 0;
mutt_debug(1, "getdnsdomainname(): %s\n", d);
freeaddrinfo(h);
}
#endif /* HAVE_GETADDRINFO || defined HAVE_GETADDRINFO_A */
- return ret;
+ return rc;
}
*/
static char *x509_get_part(X509_NAME *name, int nid)
{
- static char ret[SHORT_STRING];
+ static char data[SHORT_STRING];
- if (!name || X509_NAME_get_text_by_NID(name, nid, ret, sizeof(ret)) < 0)
- mutt_str_strfcpy(ret, _("Unknown"), sizeof(ret));
+ if (!name || X509_NAME_get_text_by_NID(name, nid, data, sizeof(data)) < 0)
+ mutt_str_strfcpy(data, _("Unknown"), sizeof(data));
- return ret;
+ return data;
}
/**
static int tls_socket_read(struct Connection *conn, char *buf, size_t len)
{
struct TlsSockData *data = conn->sockdata;
- int ret;
+ int rc;
if (!data)
{
do
{
- ret = gnutls_record_recv(data->state, buf, len);
- if ((ret < 0 && gnutls_error_is_fatal(ret) == 1) || ret == GNUTLS_E_INTERRUPTED)
+ rc = gnutls_record_recv(data->state, buf, len);
+ if ((rc < 0 && gnutls_error_is_fatal(rc) == 1) || rc == GNUTLS_E_INTERRUPTED)
{
- mutt_error("tls_socket_read (%s)", gnutls_strerror(ret));
+ mutt_error("tls_socket_read (%s)", gnutls_strerror(rc));
mutt_sleep(2);
return -1;
}
- } while (ret == GNUTLS_E_AGAIN);
+ } while (rc == GNUTLS_E_AGAIN);
- return ret;
+ return rc;
}
/**
struct stat sb;
int plen = mutt_str_strlen(path);
- int ret = stat(path, &sb);
+ int rc = stat(path, &sb);
int slash = (path[plen - 1] == '/');
- if (((ret == 0) && !S_ISDIR(sb.st_mode)) || ((ret == -1) && !slash))
+ if (((rc == 0) && !S_ISDIR(sb.st_mode)) || ((rc == -1) && !slash))
{
/* An existing file or a non-existing path not ending with a slash */
snprintf(hcpath, sizeof(hcpath), "%s%s", path, suffix);
if (!slash)
plen++;
- ret = namer(folder, hcpath + plen, sizeof(hcpath) - plen);
+ rc = namer(folder, hcpath + plen, sizeof(hcpath) - plen);
}
else
{
m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10],
m[11], m[12], m[13], m[14], m[15]);
- ret = snprintf(hcpath, sizeof(hcpath), "%s%s%s%s", path, slash ? "" : "/", name, suffix);
+ rc = snprintf(hcpath, sizeof(hcpath), "%s%s%s%s", path, slash ? "" : "/", name, suffix);
}
- if (ret < 0) /* namer or fprintf failed.. should not happen */
+ if (rc < 0) /* namer or fprintf failed.. should not happen */
return path;
create_hcache_dir(hcpath);
*/
int crypt_valid_passphrase(int flags)
{
- int ret = 0;
+ int rc = 0;
#if !defined(DEBUG)
disable_coredumps();
#endif
if ((WithCrypto & APPLICATION_PGP) && (flags & APPLICATION_PGP))
- ret = crypt_pgp_valid_passphrase();
+ rc = crypt_pgp_valid_passphrase();
if ((WithCrypto & APPLICATION_SMIME) && (flags & APPLICATION_SMIME))
- ret = crypt_smime_valid_passphrase();
+ rc = crypt_smime_valid_passphrase();
- return ret;
+ return rc;
}
int mutt_protect(struct Header *msg, char *keylist)
static int verify_sender(struct Header *h, gpgme_protocol_t protocol)
{
struct Address *sender = NULL;
- unsigned int ret = 1;
+ unsigned int rc = 1;
if (h->env->from)
{
int uid_length = 0;
sender_length = strlen(sender->mailbox);
- for (uid = key->uids; uid && ret; uid = uid->next)
+ for (uid = key->uids; uid && rc; uid = uid->next)
{
uid_length = strlen(uid->email);
if (1 && (uid->email[0] == '<') && (uid->email[uid_length - 1] == '>') &&
if (!at_sign)
{
if (strncmp(uid->email + 1, sender->mailbox, sender_length) == 0)
- ret = 0;
+ rc = 0;
}
else
{
domainname_match =
(strncasecmp(tmp_email, tmp_sender, domainname_length) == 0);
if (mailbox_match && domainname_match)
- ret = 0;
+ rc = 0;
}
}
}
signature_key = NULL;
}
- return ret;
+ return rc;
}
int smime_gpgme_verify_sender(struct Header *h)
FILE *fpout = NULL, *fperr = NULL;
char tmpfname[_POSIX_PATH_MAX];
char email[STRING];
- int ret = -1, count = 0;
+ int rc = -1, count = 0;
pid_t thepid;
size_t len = 0;
if (len && (email[len - 1] == '\n'))
email[len - 1] = '\0';
if (mutt_str_strncasecmp(email, mailbox, mutt_str_strlen(mailbox)) == 0)
- ret = 1;
+ rc = 1;
- ret = ret < 0 ? 0 : ret;
+ rc = rc < 0 ? 0 : rc;
count++;
}
- if (ret == -1)
+ if (rc == -1)
{
mutt_endwin(NULL);
mutt_file_copy_stream(fperr, stdout);
mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!"));
- ret = 1;
+ rc = 1;
}
- else if (!ret)
- ret = 1;
+ else if (!rc)
+ rc = 1;
else
- ret = 0;
+ rc = 0;
if (copy && buffer && num)
{
}
}
else if (copy)
- ret = 2;
+ rc = 2;
mutt_file_fclose(&fpout);
mutt_file_fclose(&fperr);
- return ret;
+ return rc;
}
static char *smime_extract_certificate(char *infile)
static int pop_read_header(struct PopData *pop_data, struct Header *h)
{
FILE *f = NULL;
- int ret, index;
+ int rc, index;
long length;
char buf[LONG_STRING];
char tempfile[_POSIX_PATH_MAX];
}
snprintf(buf, sizeof(buf), "LIST %d\r\n", h->refno);
- ret = pop_query(pop_data, buf, sizeof(buf));
- if (ret == 0)
+ rc = pop_query(pop_data, buf, sizeof(buf));
+ if (rc == 0)
{
sscanf(buf, "+OK %d %ld", &index, &length);
snprintf(buf, sizeof(buf), "TOP %d 0\r\n", h->refno);
- ret = pop_fetch_data(pop_data, buf, NULL, fetch_message, f);
+ rc = pop_fetch_data(pop_data, buf, NULL, fetch_message, f);
if (pop_data->cmd_top == 2)
{
- if (ret == 0)
+ if (rc == 0)
{
pop_data->cmd_top = 1;
mutt_debug(1, "pop_read_header: set TOP capability\n");
}
- if (ret == -2)
+ if (rc == -2)
{
pop_data->cmd_top = 0;
}
}
- switch (ret)
+ switch (rc)
{
case 0:
{
mutt_file_fclose(&f);
unlink(tempfile);
- return ret;
+ return rc;
}
/**
*/
int pop_open_connection(struct PopData *pop_data)
{
- int ret;
+ int rc;
unsigned int n, size;
char buf[LONG_STRING];
- ret = pop_connect(pop_data);
- if (ret < 0)
+ rc = pop_connect(pop_data);
+ if (rc < 0)
{
mutt_sleep(2);
- return ret;
+ return rc;
}
- ret = pop_capabilities(pop_data, 0);
- if (ret == -1)
+ rc = pop_capabilities(pop_data, 0);
+ if (rc == -1)
goto err_conn;
- if (ret == -2)
+ if (rc == -2)
{
mutt_sleep(2);
return -2;
pop_data->use_stls = 2;
if (pop_data->use_stls == 0)
{
- ret =
- query_quadoption(OPT_SSL_STARTTLS, _("Secure connection with TLS?"));
- if (ret == MUTT_ABORT)
+ rc = query_quadoption(OPT_SSL_STARTTLS, _("Secure connection with TLS?"));
+ if (rc == MUTT_ABORT)
return -2;
pop_data->use_stls = 1;
- if (ret == MUTT_YES)
+ if (rc == MUTT_YES)
pop_data->use_stls = 2;
}
if (pop_data->use_stls == 2)
{
mutt_str_strfcpy(buf, "STLS\r\n", sizeof(buf));
- ret = pop_query(pop_data, buf, sizeof(buf));
- if (ret == -1)
+ rc = pop_query(pop_data, buf, sizeof(buf));
+ if (rc == -1)
goto err_conn;
- if (ret != 0)
+ if (rc != 0)
{
mutt_error("%s", pop_data->err_msg);
mutt_sleep(2);
else
{
/* recheck capabilities after STLS completes */
- ret = pop_capabilities(pop_data, 1);
- if (ret == -1)
+ rc = pop_capabilities(pop_data, 1);
+ if (rc == -1)
goto err_conn;
- if (ret == -2)
+ if (rc == -2)
{
mutt_sleep(2);
return -2;
}
#endif
- ret = pop_authenticate(pop_data);
- if (ret == -1)
+ rc = pop_authenticate(pop_data);
+ if (rc == -1)
goto err_conn;
- if (ret == -3)
+ if (rc == -3)
mutt_clear_error();
- if (ret != 0)
- return ret;
+ if (rc != 0)
+ return rc;
/* recheck capabilities after authentication */
- ret = pop_capabilities(pop_data, 2);
- if (ret == -1)
+ rc = pop_capabilities(pop_data, 2);
+ if (rc == -1)
goto err_conn;
- if (ret == -2)
+ if (rc == -2)
{
mutt_sleep(2);
return -2;
/* get total size of mailbox */
mutt_str_strfcpy(buf, "STAT\r\n", sizeof(buf));
- ret = pop_query(pop_data, buf, sizeof(buf));
- if (ret == -1)
+ rc = pop_query(pop_data, buf, sizeof(buf));
+ if (rc == -1)
goto err_conn;
- if (ret == -2)
+ if (rc == -2)
{
mutt_error("%s", pop_data->err_msg);
mutt_sleep(2);
- return ret;
+ return rc;
}
sscanf(buf, "+OK %u %u", &n, &size);
static int rfc2047_encode(ICONV_CONST char *d, size_t dlen, int col, const char *fromcode,
const char *charsets, char **e, size_t *elen, char *specials)
{
- int ret = 0;
+ int rc = 0;
char *buf = NULL;
size_t bufpos, buflen;
char *u = NULL, *t0 = NULL, *t1 = NULL, *t = NULL;
/* Try to convert to UTF-8. */
if (convert_string(d, dlen, fromcode, icode, &u, &ulen))
{
- ret = 1;
+ rc = 1;
icode = 0;
mutt_mem_realloc(&u, (ulen = dlen) + 1);
memcpy(u, d, dlen);
/* No encoding is required. */
*e = u;
*elen = ulen;
- return ret;
+ return rc;
}
/* Choose target charset. */
tocode = tocode1;
else
{
- ret = 2;
+ rc = 2;
icode = 0;
}
}
*e = buf;
*elen = buflen + 1;
- return ret;
+ return rc;
}
void rfc2047_encode_string(char **pd, int encode_specials, int col)
static int bounce_message(FILE *fp, struct Header *h, struct Address *to,
const char *resent_from, struct Address *env_from)
{
- int ret = 0;
+ int rc = 0;
FILE *f = NULL;
char date[SHORT_STRING], tempfile[_POSIX_PATH_MAX];
struct Message *msg = NULL;
/* Try to bounce each message out, aborting if we get any failures. */
for (int i = 0; i < Context->msgcount; i++)
if (message_is_tagged(Context, i))
- ret |= bounce_message(fp, Context->hdrs[i], to, resent_from, env_from);
- return ret;
+ rc |= bounce_message(fp, Context->hdrs[i], to, resent_from, env_from);
+ return rc;
}
/* If we failed to open a message, return with error */
}
#ifdef USE_SMTP
if (SmtpUrl)
- ret = mutt_smtp_send(env_from, to, NULL, NULL, tempfile, h->content->encoding == ENC8BIT);
+ rc = mutt_smtp_send(env_from, to, NULL, NULL, tempfile, h->content->encoding == ENC8BIT);
else
#endif /* USE_SMTP */
- ret = mutt_invoke_sendmail(env_from, to, NULL, NULL, tempfile,
- h->content->encoding == ENC8BIT);
+ rc = mutt_invoke_sendmail(env_from, to, NULL, NULL, tempfile,
+ h->content->encoding == ENC8BIT);
}
if (msg)
mx_close_message(Context, &msg);
- return ret;
+ return rc;
}
int mutt_bounce_message(FILE *fp, struct Header *h, struct Address *to)
struct Account account;
const char *envfrom = NULL;
char buf[1024];
- int ret = -1;
+ int rc = -1;
/* it might be better to synthesize an envelope from from user and host
* but this condition is most likely arrived at accidentally */
}
if (smtp_fill_account(&account) < 0)
- return ret;
+ return rc;
conn = mutt_conn_find(NULL, &account);
if (!conn)
do
{
/* send our greeting */
- if ((ret = smtp_open(conn)))
+ if ((rc = smtp_open(conn)))
break;
FREE(&AuthMechs);
/* send the sender's address */
- ret = snprintf(buf, sizeof(buf), "MAIL FROM:<%s>", envfrom);
+ rc = snprintf(buf, sizeof(buf), "MAIL FROM:<%s>", envfrom);
if (eightbit && mutt_bit_isset(Capabilities, EIGHTBITMIME))
{
mutt_str_strncat(buf, sizeof(buf), " BODY=8BITMIME", 15);
- ret += 14;
+ rc += 14;
}
if (DsnReturn && mutt_bit_isset(Capabilities, DSN))
- ret += snprintf(buf + ret, sizeof(buf) - ret, " RET=%s", DsnReturn);
+ rc += snprintf(buf + rc, sizeof(buf) - rc, " rc=%s", DsnReturn);
if (mutt_bit_isset(Capabilities, SMTPUTF8) &&
(address_uses_unicode(envfrom) || addresses_use_unicode(to) ||
addresses_use_unicode(cc) || addresses_use_unicode(bcc)))
- ret += snprintf(buf + ret, sizeof(buf) - ret, " SMTPUTF8");
+ rc += snprintf(buf + rc, sizeof(buf) - rc, " SMTPUTF8");
mutt_str_strncat(buf, sizeof(buf), "\r\n", 3);
if (mutt_socket_write(conn, buf) == -1)
{
- ret = SMTP_ERR_WRITE;
+ rc = SMTP_ERR_WRITE;
break;
}
- if ((ret = smtp_get_resp(conn)))
+ if ((rc = smtp_get_resp(conn)))
break;
/* send the recipient list */
- if ((ret = smtp_rcpt_to(conn, to)) || (ret = smtp_rcpt_to(conn, cc)) ||
- (ret = smtp_rcpt_to(conn, bcc)))
- {
+ if ((rc = smtp_rcpt_to(conn, to)) || (rc = smtp_rcpt_to(conn, cc)) ||
+ (rc = smtp_rcpt_to(conn, bcc)))
break;
- }
/* send the message data */
- if ((ret = smtp_data(conn, msgfile)))
+ if ((rc = smtp_data(conn, msgfile)))
break;
mutt_socket_write(conn, "QUIT\r\n");
- ret = 0;
+ rc = 0;
} while (0);
if (conn)
mutt_socket_close(conn);
- if (ret == SMTP_ERR_READ)
+ if (rc == SMTP_ERR_READ)
mutt_error(_("SMTP session failed: read error"));
- else if (ret == SMTP_ERR_WRITE)
+ else if (rc == SMTP_ERR_WRITE)
mutt_error(_("SMTP session failed: write error"));
- else if (ret == SMTP_ERR_CODE)
+ else if (rc == SMTP_ERR_CODE)
mutt_error(_("Invalid server response"));
- return ret;
+ return rc;
}