s++;
}
- if ((s = parse_address(s, token, &tokenlen, sizeof(token) - 1, comment,
- commentlen, commentmax, addr)) == NULL)
+ s = parse_address(s, token, &tokenlen, sizeof(token) - 1, comment, commentlen,
+ commentmax, addr);
+ if (s == NULL)
return NULL;
if (*s != '>')
last = last->next;
ws_pending = mutt_str_is_email_wsp(*s);
- if ((nl = mutt_str_strlen(s)))
+ nl = mutt_str_strlen(s);
+ if (nl)
nl = s[nl - 1] == '\n';
s = mutt_str_skip_email_wsp(s);
if (adr && adr->mailbox)
{
mutt_str_strfcpy(tmp, adr->mailbox, sizeof(tmp));
- if ((pc = strchr(tmp, '@')))
+ pc = strchr(tmp, '@');
+ if (pc)
*pc = '\0';
}
else
mutt_alias_add_reverse(new);
- if ((t = Aliases))
+ t = Aliases;
+ if (t)
{
while (t->next)
t = t->next;
if (mutt_get_field(_("Save to file: "), buf, sizeof(buf), MUTT_FILE) != 0)
return;
mutt_expand_path(buf, sizeof(buf));
- if ((rc = fopen(buf, "a+")))
+ rc = fopen(buf, "a+");
+ if (rc)
{
/* terminate existing file with \n if necessary */
if (fseek(rc, 0, SEEK_END))
goto return_error;
}
- if ((thepid = mutt_create_filter_fd(command, NULL, NULL, NULL, use_pipe ? tempfd : -1,
- use_pager ? pagerfd : -1, -1)) == -1)
+ thepid = mutt_create_filter_fd(command, NULL, NULL, NULL, use_pipe ? tempfd : -1,
+ use_pager ? pagerfd : -1, -1);
+ if (thepid == -1)
{
if (pagerfd != -1)
close(pagerfd);
case 'g':
if (folder->ff->local)
{
- if ((gr = getgrgid(folder->ff->gid)))
+ gr = getgrgid(folder->ff->gid);
+ if (gr)
mutt_format_s(buf, buflen, prec, gr->gr_name);
else
{
case 'u':
if (folder->ff->local)
{
- if ((pw = getpwuid(folder->ff->uid)))
+ pw = getpwuid(folder->ff->uid);
+ if (pw)
mutt_format_s(buf, buflen, prec, pw->pw_name);
else
{
if (typ != MUTT_MBOX && typ != MUTT_MMDF)
return 0;
- if ((f = fopen(path, "rb")))
+ f = fopen(path, "rb");
+ if (f)
{
rc = test_last_status_new(f);
mutt_file_fclose(&f);
mutt_str_strfcpy(exp_dirpart, NONULL(SpoolFile), sizeof(exp_dirpart));
else
mutt_str_strfcpy(exp_dirpart, NONULL(Folder), sizeof(exp_dirpart));
- if ((p = strrchr(s, '/')))
+ p = strrchr(s, '/');
+ if (p)
{
char buf[_POSIX_PATH_MAX];
if (mutt_file_concatn_path(buf, sizeof(buf), exp_dirpart, strlen(exp_dirpart),
}
else
{
- if ((p = strrchr(s, '/')))
+ p = strrchr(s, '/');
+ if (p)
{
if (p == s) /* absolute path */
{
if (!b->content)
b->content = mutt_get_content_info(b->filename, b);
- if ((info = b->content))
+ info = b->content;
+ if (info)
{
switch (b->encoding)
{
if (!fcc_set && *fcc)
{
- if ((i = query_quadoption(OPT_COPY,
- _("Save a copy of this message?"))) == MUTT_ABORT)
+ i = query_quadoption(OPT_COPY, _("Save a copy of this message?"));
+ if (i == MUTT_ABORT)
break;
else if (i == MUTT_NO)
*fcc = 0;
/* Try the DNS subjectAltNames. */
match_found = false;
- if ((subj_alt_names = X509_get_ext_d2i(x509cert, NID_subject_alt_name, NULL, NULL)))
+ subj_alt_names = X509_get_ext_d2i(x509cert, NID_subject_alt_name, NULL, NULL);
+ if (subj_alt_names)
{
subj_alt_names_count = sk_GENERAL_NAME_num(subj_alt_names);
for (int i = 0; i < subj_alt_names_count; i++)
if (!allow_always)
break;
done = 0;
- if ((fp = fopen(CertificateFile, "a")))
+ fp = fopen(CertificateFile, "a");
+ if (fp)
{
if (PEM_write_X509(fp, cert))
done = 1;
regmatch_t pmatch[3];
/* try checking against names stored in stored certs file */
- if ((fp = fopen(CertificateFile, "r")))
+ fp = fopen(CertificateFile, "r");
+ if (fp)
{
if (REGCOMP(&preg,
"^#H ([a-zA-Z0-9_\\.-]+) ([0-9A-F]{4}( [0-9A-F]{4}){7})[ \t]*$",
break;
case OP_MAX + 3: /* accept always */
done = 0;
- if ((fp = fopen(CertificateFile, "a")))
+ fp = fopen(CertificateFile, "a");
+ if (fp)
{
/* save hostname if necessary */
if (certerr & CERTERR_HOSTNAME)
}
cn += 3;
- if ((cnend = strstr(dn, ",EMAIL=")))
+ cnend = strstr(dn, ",EMAIL=");
+ if (cnend)
*cnend = '\0';
/* if we are using a client cert, SASL may expect an external auth name */
gnutls_certificate_set_verify_flags(data->xcred, GNUTLS_VERIFY_DISABLE_TIME_CHECKS);
#endif
- if ((err = gnutls_init(&data->state, GNUTLS_CLIENT)))
+ err = gnutls_init(&data->state, GNUTLS_CLIENT);
+ if (err)
{
mutt_error("gnutls_handshake: %s", gnutls_strerror(err));
mutt_sleep(2);
if (Context && menu->current >= Context->vcount) \
{ \
mutt_flushinp(); \
- mutt_error(_(NoVisible)); \
+ mutt_error(_(NoVisible)); \
break; \
}
* switch statement would need to be run. */
mutt_folder_hook(buf);
- if ((Context = mx_open_mailbox(
- buf, (option(OPT_READ_ONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ? MUTT_READONLY : 0,
- NULL)) != NULL)
+ Context = mx_open_mailbox(
+ buf, (option(OPT_READ_ONLY) || (op == OP_MAIN_CHANGE_FOLDER_READONLY)) ? MUTT_READONLY : 0,
+ NULL);
+ if (Context)
{
menu->current = ci_first_message();
}
int c;
FILE *f = NULL;
- if ((Progname = strrchr(argv[0], '/')))
+ Progname = strrchr(argv[0], '/');
+ if (Progname)
Progname++;
else
Progname = argv[0];
char tmp[LONG_STRING];
struct stat sb;
- if ((f = fopen(path, "r")))
+ f = fopen(path, "r");
+ if (f)
{
fstat(fileno(f), &sb);
buf = be_snarf_data(f, buf, max, len, 0, sb.st_size, 0);
}
else if (flags & MUTT_ALIAS && ch == OP_EDITOR_COMPLETE_QUERY)
{
- if ((i = state->curpos))
+ i = state->curpos;
+ if (i != 0)
{
for (; i && state->wbuf[i - 1] != ','; i--)
;
case 'b':
if (ctx)
{
- if ((p = strrchr(ctx->path, '/')))
+ p = strrchr(ctx->path, '/');
+ if (p)
mutt_str_strfcpy(buf, p + 1, buflen);
else
mutt_str_strfcpy(buf, ctx->path, buflen);
if (hdr->env->from && hdr->env->from->mailbox)
{
mutt_str_strfcpy(tmp, mutt_addr_for_display(hdr->env->from), sizeof(tmp));
- if ((p = strpbrk(tmp, "%@")))
+ p = strpbrk(tmp, "%@");
+ if (p)
*p = 0;
}
else
}
else
mutt_format_s(tmp, sizeof(tmp), prec, mutt_get_name(hdr->env->from));
- if ((p = strpbrk(tmp, " %@")))
+ p = strpbrk(tmp, " %@");
+ if (p)
*p = 0;
mutt_format_s(buf, buflen, prec, tmp);
break;
path[l] = '\0';
mutt_expand_path(path, sizeof(path));
- if ((body2 = mutt_make_file_attach(path)))
+ body2 = mutt_make_file_attach(path);
+ if (body2)
{
body2->description = mutt_str_strdup(p);
for (parts = msg->content; parts->next; parts = parts->next)
return (&OpGeneric[i]);
}
- if ((map = km_get_table(menu)))
+ map = km_get_table(menu);
+ if (map)
{
for (int i = 0; map[i].name; i++)
if (map[i].op == op)
/* don't try to press string into one line with less than 40 characters.
The double parenthesis avoids a gcc warning, sigh ... */
- if ((split = MuttIndexWindow->cols < 40))
+ split = MuttIndexWindow->cols;
+ if (split < 40)
{
col_a = col = 0;
col_b = LONG_STRING;
if (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_SAVEHOOK | MUTT_FCCHOOK |
MUTT_MESSAGEHOOK | MUTT_REPLYHOOK))
{
- if ((pat = mutt_pattern_comp(
- pattern.data, (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_FCCHOOK)) ? 0 : MUTT_FULL_MSG,
- err)) == NULL)
+ pat = mutt_pattern_comp(
+ pattern.data,
+ (data & (MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_FCCHOOK)) ? 0 : MUTT_FULL_MSG, err);
+ if (!pat)
goto error;
}
else if (~data & MUTT_GLOBALHOOK) /* NOT a global hook */
/* Hooks not allowing full patterns: Check syntax of regex */
rx = mutt_mem_malloc(sizeof(regex_t));
#ifdef MUTT_CRYPTHOOK
- if ((rc = REGCOMP(rx, NONULL(pattern.data),
- ((data & (MUTT_CRYPTHOOK | MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0))) != 0)
+ rc = REGCOMP(rx, NONULL(pattern.data),
+ ((data & (MUTT_CRYPTHOOK | MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0));
#else
- if ((rc = REGCOMP(rx, NONULL(pattern.data),
- (data & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0)) != 0)
+ rc = REGCOMP(rx, NONULL(pattern.data),
+ (data & (MUTT_CHARSETHOOK | MUTT_ICONVHOOK)) ? REG_ICASE : 0);
#endif /* MUTT_CRYPTHOOK */
+ if (rc != 0)
{
regerror(rc, rx, err->data, err->dsize);
FREE(&rx);
mutt_debug(3, "Handling CAPABILITY\n");
s = imap_next_word(s);
- if ((bracket = strchr(s, ']')))
+ bracket = strchr(s, ']');
+ if (bracket)
*bracket = '\0';
FREE(&idata->capstr);
idata->capstr = mutt_str_strdup(s);
imap_exec(idata, buf, 0);
queued = 0;
- if ((status = imap_mboxcache_get(idata, mbox, 0)))
+ status = imap_mboxcache_get(idata, mbox, 0);
+ if (status)
return status->messages;
return 0;
/* if we are expunging anyway, we can do deleted messages very quickly... */
if (expunge && mutt_bit_isset(ctx->rights, MUTT_ACL_DELETE))
{
- if ((rc = imap_exec_msgset(idata, "UID STORE", "+FLAGS.SILENT (\\Deleted)",
- MUTT_DELETED, 1, 0)) < 0)
+ rc = imap_exec_msgset(idata, "UID STORE", "+FLAGS.SILENT (\\Deleted)",
+ MUTT_DELETED, 1, 0);
+ if (rc < 0)
{
mutt_error(_("Expunge failed"));
mutt_sleep(1);
idata = ctx->data;
h = ctx->hdrs[msgno];
- if ((msg->fp = msg_cache_get(idata, h)))
+ msg->fp = msg_cache_get(idata, h);
+ if (msg->fp)
{
if (HEADER_DATA(h)->parsed)
return 0;
/* walk past closing '}' */
mx->mbox = mutt_str_strdup(c + 1);
- if ((c = strrchr(tmp, '@')))
+ c = strrchr(tmp, '@');
+ if (c)
{
*c = '\0';
mutt_str_strfcpy(mx->account.user, tmp, sizeof(mx->account.user));
pc = tok->dptr;
do
{
- if ((pc = strpbrk(pc, "\\`")))
+ pc = strpbrk(pc, "\\`");
+ if (pc)
{
/* skip any quoted chars */
if (*pc == '\\')
if (*tok->dptr == '{')
{
tok->dptr++;
- if ((pc = strchr(tok->dptr, '}')))
+ pc = strchr(tok->dptr, '}');
+ if (pc)
{
var = mutt_str_substr_dup(tok->dptr, pc);
tok->dptr = pc + 1;
else
a->major = mutt_str_strdup(buf->data);
- if ((p = strchr(a->major, '/')))
+ p = strchr(a->major, '/');
+ if (p)
{
*p = '\0';
p++;
else
tmp = mutt_str_strdup(buf->data);
- if ((minor = strchr(tmp, '/')))
+ minor = strchr(tmp, '/');
+ if (minor)
{
*minor = '\0';
minor++;
if (myvar)
{
- if ((val = myvar_get(myvar)))
+ val = myvar_get(myvar);
+ if (val)
{
pretty_var(err->data, err->dsize, myvar, val);
break;
* the user has typed so far. Allocate LONG_STRING just to be sure! */
static char UserTyped[LONG_STRING] = { 0 };
-static int NumMatched = 0; /* Number of matches for completion */
+static int NumMatched = 0; /* Number of matches for completion */
static char Completed[STRING] = { 0 }; /* completed string (command or variable) */
static const char **Matches;
/* this is a lie until mutt_init runs: */
/* on one of the systems I use, getcwd() does not return the same prefix
as is listed in the passwd file */
- if ((p = getenv("HOME")))
+ p = getenv("HOME");
+ if (p)
HomeDir = mutt_str_strdup(p);
/* Get some information about the user */
- if ((pw = getpwuid(getuid())))
+ pw = getpwuid(getuid());
+ if (pw)
{
char rnbuf[STRING];
fputs(_("unable to determine home directory"), stderr);
exit(1);
}
- if ((p = getenv("USER")))
+ p = getenv("USER");
+ if (p)
Username = mutt_str_strdup(p);
else
{
}
/* some systems report the FQDN instead of just the hostname */
- if ((p = strchr(utsname.nodename, '.')))
+ p = strchr(utsname.nodename, '.');
+ if (p)
ShortHostname = mutt_str_substr_dup(utsname.nodename, p);
else
ShortHostname = mutt_str_strdup(utsname.nodename);
#endif
#ifdef USE_NNTP
- if ((p = getenv("NNTPSERVER")))
+ p = getenv("NNTPSERVER");
+ if (p)
{
FREE(&NewsServer);
NewsServer = mutt_str_strdup(p);
}
#endif
- if ((p = getenv("MAIL")))
+ p = getenv("MAIL");
+ if (p)
SpoolFile = mutt_str_strdup(p);
else if ((p = getenv("MAILDIR")))
SpoolFile = mutt_str_strdup(p);
SpoolFile = mutt_str_strdup(buffer);
}
- if ((p = getenv("MAILCAPS")))
+ p = getenv("MAILCAPS");
+ if (p)
MailcapPath = mutt_str_strdup(p);
else
{
{
/* check generic menu */
bindings = OpGeneric;
- if ((func = get_func(bindings, tmp.op)))
+ func = get_func(bindings, tmp.op);
+ if (func)
return tmp.op;
}
static char buf[10];
const char *p = NULL;
- if ((p = mutt_map_get_name(c, KeyNames)))
+ p = mutt_map_get_name(c, KeyNames);
+ if (p)
return p;
if (c < 256 && c > -128 && iscntrl((unsigned char) c))
}
/* USE_NNTP 'g:G' */
- if ((i = getopt(argc, argv,
- "+A:a:Bb:F:f:c:Dd:l:Ee:g:GH:s:i:hm:npQ:RSvxyzZ")) != EOF)
+ i = getopt(argc, argv, "+A:a:Bb:F:f:c:Dd:l:Ee:g:GH:s:i:hm:npQ:RSvxyzZ");
+ if (i != EOF)
+ {
switch (i)
{
case 'A':
default:
usage();
}
+ }
}
/* collapse remaining argv */
struct ListNode *np;
STAILQ_FOREACH(np, &alias_queries, entries)
{
- if ((a = mutt_lookup_alias(np->data)))
+ a = mutt_lookup_alias(np->data);
+ if (a)
{
/* output in machine-readable form */
mutt_addrlist_to_intl(a, NULL);
mutt_folder_hook(folder);
mutt_startup_shutdown_hook(MUTT_STARTUPHOOK);
- if ((Context = mx_open_mailbox(
- folder, ((flags & MUTT_RO) || option(OPT_READ_ONLY)) ? MUTT_READONLY : 0, NULL)) ||
- !explicit_folder)
+ Context = mx_open_mailbox(
+ folder, ((flags & MUTT_RO) || option(OPT_READ_ONLY)) ? MUTT_READONLY : 0, NULL);
+ if (Context || !explicit_folder)
{
#ifdef USE_SIDEBAR
mutt_sb_set_open_buffy();
static int mh_read_token(char *t, int *first, int *last)
{
char *p = NULL;
- if ((p = strchr(t, '-')))
+ p = strchr(t, '-');
+ if (p)
{
*p++ = '\0';
if (mutt_str_atoi(t, first) < 0 || mutt_str_atoi(p, last) < 0)
snprintf(sequences, sizeof(sequences), "%s/.mh_sequences", ctx->path);
/* first, copy unknown sequences */
- if ((ofp = fopen(sequences, "r")))
+ ofp = fopen(sequences, "r");
+ if (ofp)
{
while ((buf = mutt_file_read_line(buf, &s, ofp, &l, 0)))
{
if (ctx->hdrs[l]->deleted)
continue;
- if ((p = strrchr(ctx->hdrs[l]->path, '/')))
+ p = strrchr(ctx->hdrs[l]->path, '/');
+ if (p)
p++;
else
p = ctx->hdrs[l]->path;
snprintf(seq_flagged, sizeof(seq_flagged), "%s:", NONULL(MhSeqFlagged));
snprintf(sequences, sizeof(sequences), "%s/.mh_sequences", ctx->path);
- if ((ofp = fopen(sequences, "r")))
+ ofp = fopen(sequences, "r");
+ if (ofp)
{
while ((buf = mutt_file_read_line(buf, &sz, ofp, &line, 0)))
{
for (; md; md = md->next)
{
- if ((p = strrchr(md->h->path, '/')))
+ p = strrchr(md->h->path, '/');
+ if (p)
p++;
else
p = md->h->path;
mutt_str_strfcpy(subdir, s, 4);
/* extract the flags */
- if ((s = strchr(s, ':')))
+ s = strchr(s, ':');
+ if (s)
mutt_str_strfcpy(suffix, s, sizeof(suffix));
else
suffix[0] = '\0';
{
char *t = NULL, *u = NULL;
- if ((t = strrchr(src, '/')))
+ t = strrchr(src, '/');
+ if (t)
src = t + 1;
mutt_str_strfcpy(dest, src, l);
- if ((u = strrchr(dest, ':')))
+ u = strrchr(dest, ':');
+ if (u)
*u = '\0';
return dest;
{
ctx->hdrs[i]->active = false;
- if ((p = mutt_hash_find(fnames, ctx->hdrs[i]->path)) && p->h &&
- (mbox_strict_cmp_headers(ctx->hdrs[i], p->h)))
+ p = mutt_hash_find(fnames, ctx->hdrs[i]->path);
+ if (p && p->h && mbox_strict_cmp_headers(ctx->hdrs[i], p->h))
{
ctx->hdrs[i]->active = true;
/* found the right message */
maildir_canon_filename(unique, msg, sizeof(unique));
- if ((fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "new" : "cur", newname)) ||
- errno != ENOENT)
+ fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "new" : "cur", newname);
+ if (fp || (errno != ENOENT))
{
if (new_hits < UINT_MAX && cur_hits < UINT_MAX)
{
return fp;
}
- if ((fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "cur" : "new", newname)) ||
- errno != ENOENT)
+ fp = md_open_find_message(folder, unique, new_hits > cur_hits ? "cur" : "new", newname);
+ if (fp || (errno != ENOENT))
{
if (new_hits < UINT_MAX && cur_hits < UINT_MAX)
{
char in[LONG_STRING], scratch[LONG_STRING];
mutt_str_strfcpy(in, name, sizeof(in));
- if ((ext = strchr(in, '/')))
+ ext = strchr(in, '/');
+ if (ext)
*ext++ = '\0';
if ((mutt_str_strcasecmp(in, "utf-8") == 0) ||
t = (((lt->tm_hour - utc->tm_hour) * 60) + (lt->tm_min - utc->tm_min)) * 60;
- if ((yday = (lt->tm_yday - utc->tm_yday)))
+ yday = (lt->tm_yday - utc->tm_yday);
+ if (yday != 0)
{
/* This code is optimized to negative timezones (West of Greenwich) */
if ((yday == -1) || /* UTC passed midnight before localtime */
mutt_str_strfcpy(scratch, s, sizeof(scratch));
/* kill the day of the week, if it exists. */
- if ((t = strchr(scratch, ',')))
+ t = strchr(scratch, ',');
+ if (t)
t++;
else
t = scratch;
else
{
struct passwd *pw = NULL;
- if ((t = strchr(s + 1, '/')))
+ t = strchr(s + 1, '/');
+ if (t)
*t = 0;
- if ((pw = getpwnam(s + 1)))
+ pw = getpwnam(s + 1);
+ if (pw)
{
mutt_str_strfcpy(p, pw->pw_dir, sizeof(p));
if (t)
struct Header *h = NULL;
struct Address *alias = NULL;
- if ((alias = mutt_lookup_alias(s + 1)))
+ alias = mutt_lookup_alias(s + 1);
+ if (alias)
{
h = mutt_new_header();
h->env = mutt_env_new();
{
char *p = NULL;
- if ((p = strpbrk(d, "%@")))
+ p = strpbrk(d, "%@");
+ if (p)
*p = 0;
}
mutt_str_strlower(d);
col++;
}
}
- if (len + wlen > buflen)
+ if ((len + wlen) > buflen)
len = mutt_wstr_trunc(tmp, buflen - wlen, cols - col, NULL);
memcpy(wptr, tmp, len);
wptr += len;
*p = '_';
}
- if ((len = mutt_str_strlen(tmp)) + wlen > buflen)
+ len = mutt_str_strlen(tmp);
+ if ((len + wlen) > buflen)
len = mutt_wstr_trunc(tmp, buflen - wlen, cols - col, NULL);
memcpy(wptr, tmp, len);
{
char *p = NULL;
- if ((p = mutt_find_hook(MUTT_MBOXHOOK, ctx->path)))
+ p = mutt_find_hook(MUTT_MBOXHOOK, ctx->path);
+ if (p)
{
is_spool = 1;
mutt_str_strfcpy(mbox, p, sizeof(mbox));
if ((mutt_str_strcasecmp(m->subtype, "pgp") == 0) ||
(mutt_str_strcasecmp(m->subtype, "x-pgp-message") == 0))
{
- if ((p = mutt_param_get("x-action", m->parameter)) &&
- ((mutt_str_strcasecmp(p, "sign") == 0) ||
- (mutt_str_strcasecmp(p, "signclear") == 0)))
+ p = mutt_param_get("x-action", m->parameter);
+ if (p && ((mutt_str_strcasecmp(p, "sign") == 0) ||
+ (mutt_str_strcasecmp(p, "signclear") == 0)))
t |= PGPSIGN;
- if ((p = mutt_param_get("format", m->parameter)) &&
- (mutt_str_strcasecmp(p, "keys-only") == 0))
+ p = mutt_param_get("format", m->parameter);
+ if (p && (mutt_str_strcasecmp(p, "keys-only") == 0))
{
t |= PGPKEY;
}
if ((mutt_str_strcasecmp(m->subtype, "x-pkcs7-mime") == 0) ||
(mutt_str_strcasecmp(m->subtype, "pkcs7-mime") == 0))
{
- if ((t = mutt_param_get("smime-type", m->parameter)))
+ t = mutt_param_get("smime-type", m->parameter);
+ if (t)
{
if (mutt_str_strcasecmp(t, "enveloped-data") == 0)
return SMIMEENCRYPT;
err = gpgme_op_keylist_start(tmpctx, NULL, 0);
while (!err)
{
- if ((err = gpgme_op_keylist_next(tmpctx, &key)))
+ err = gpgme_op_keylist_next(tmpctx, &key);
+ if (err)
break;
uid = key->uids;
subkey = key->subkeys;
rc = (pgp_gpgme_check_traditional(fp, b->parts, 0) || rc);
else if (b->type == TYPETEXT)
{
- if ((r = mutt_is_application_pgp(b)))
+ r = mutt_is_application_pgp(b);
+ if (r != 0)
rc = (rc || r);
else
rc = (pgp_check_traditional_one_body(fp, b) || rc);
struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
int r;
- if ((r = mutt_str_strcasecmp((*s)->uid, (*t)->uid)))
+ r = mutt_str_strcasecmp((*s)->uid, (*t)->uid);
+ if (r != 0)
return r > 0;
else
return (mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t)) > 0);
struct CryptKeyInfo **t = (struct CryptKeyInfo **) b;
int r;
- if ((r = mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t))))
+ r = mutt_str_strcasecmp(crypt_fpr_or_lkeyid(*s), crypt_fpr_or_lkeyid(*t));
+ if (r != 0)
return r > 0;
else
return (mutt_str_strcasecmp((*s)->uid, (*t)->uid) > 0);
unsigned long ts = 0, tt = 0;
int r;
- if ((r = (((*s)->flags & (KEYFLAG_RESTRICTIONS)) - ((*t)->flags & (KEYFLAG_RESTRICTIONS)))))
+ r = (((*s)->flags & (KEYFLAG_RESTRICTIONS)) - ((*t)->flags & (KEYFLAG_RESTRICTIONS)));
+ if (r != 0)
return r > 0;
ts = (*s)->validity;
tt = (*t)->validity;
- if ((r = (tt - ts)))
+ r = (tt - ts);
+ if (r != 0)
return r < 0;
if ((*s)->kobj->subkeys)
if (ts < tt)
return 0;
- if ((r = mutt_str_strcasecmp((*s)->uid, (*t)->uid)))
+ r = mutt_str_strcasecmp((*s)->uid, (*t)->uid);
+ if (r != 0)
return r > 0;
return (mutt_str_strcasecmp(crypt_fpr_or_lkeyid((*s)), crypt_fpr_or_lkeyid((*t))) > 0);
}
case KEY_CAP_CAN_ENCRYPT:
ret = key->can_encrypt;
if (ret == 0)
+ {
for (subkey = key->subkeys; subkey; subkey = subkey->next)
- if ((ret = subkey->can_encrypt))
+ {
+ ret = subkey->can_encrypt;
+ if (ret != 0)
break;
+ }
+ }
break;
case KEY_CAP_CAN_SIGN:
ret = key->can_sign;
if (ret == 0)
+ {
for (subkey = key->subkeys; subkey; subkey = subkey->next)
- if ((ret = subkey->can_sign))
+ {
+ ret = subkey->can_sign;
+ if (ret != 0)
break;
+ }
+ }
break;
case KEY_CAP_CAN_CERTIFY:
ret = key->can_certify;
if (ret == 0)
+ {
for (subkey = key->subkeys; subkey; subkey = subkey->next)
- if ((ret = subkey->can_certify))
+ {
+ ret = subkey->can_certify;
+ if (ret != 0)
break;
+ }
+ }
break;
}
}
}
- if ((key = crypt_getkeybystr(resp, abilities, app, forced_valid)))
+ key = crypt_getkeybystr(resp, abilities, app, forced_valid);
+ if (key)
return key;
mutt_error(_("No matching keys found for \"%s\""), resp);
break;
case 'a': /* sign (a)s */
- if ((p = crypt_ask_for_key(_("Sign as: "), NULL, KEYFLAG_CANSIGN,
- is_smime ? APPLICATION_SMIME : APPLICATION_PGP, NULL)))
+ p = crypt_ask_for_key(_("Sign as: "), NULL, KEYFLAG_CANSIGN,
+ is_smime ? APPLICATION_SMIME : APPLICATION_PGP, NULL);
+ if (p)
{
snprintf(input_signas, sizeof(input_signas), "0x%s", crypt_fpr_or_lkeyid(p));
mutt_str_replace(is_smime ? &SmimeDefaultKey : &PgpSignAs, input_signas);
for (p = buf; p; p = pend)
{
- if ((pend = strchr(p, ':')))
+ pend = strchr(p, ':');
+ if (pend)
*pend++ = 0;
field++;
if (!*p && (field != 1) && (field != 10))
if (!option(OPT_PGP_USE_GPG_AGENT))
return false;
- if ((tty = ttyname(0)))
+ tty = ttyname(0);
+ if (tty)
{
setenv("GPG_TTY", tty, 0);
mutt_envlist_set("GPG_TTY", tty, false);
return -1;
}
- if ((thepid = pgp_invoke_decode(&pgpin, NULL, &pgperr, -1, fileno(pgpout),
- -1, tmpfname, needpass)) == -1)
+ thepid = pgp_invoke_decode(&pgpin, NULL, &pgperr, -1, fileno(pgpout),
+ -1, tmpfname, needpass);
+ if (thepid == -1)
{
mutt_file_fclose(&pgpout);
maybe_goodsig = false;
rc = pgp_check_traditional(fp, b->parts, 0) || rc;
else if (b->type == TYPETEXT)
{
- if ((r = mutt_is_application_pgp(b)))
+ r = mutt_is_application_pgp(b);
+ if (r)
rc = rc || r;
else
rc = pgp_check_traditional_one_body(fp, b) || rc;
crypt_current_time(s, "PGP");
- if ((thepid = pgp_invoke_verify(NULL, &pgpout, NULL, -1, -1, fileno(pgperr),
- tempfile, sigfile)) != -1)
+ thepid = pgp_invoke_verify(NULL, &pgpout, NULL, -1, -1, fileno(pgperr), tempfile, sigfile);
+ if (thepid != -1)
{
if (pgp_copy_checksig(pgpout, s->fpout) >= 0)
badsig = 0;
if (pgp_copy_checksig(pgperr, s->fpout) >= 0)
badsig = 0;
- if ((rv = mutt_wait_filter(thepid)))
+ rv = mutt_wait_filter(thepid);
+ if (rv)
badsig = -1;
mutt_debug(1, "mutt_wait_filter returned %d.\n", rv);
mutt_file_copy_bytes(s->fpin, pgptmp, a->length);
mutt_file_fclose(&pgptmp);
- if ((thepid = pgp_invoke_decrypt(&pgpin, &pgpout, NULL, -1, -1,
- fileno(pgperr), pgptmpfile)) == -1)
+ thepid = pgp_invoke_decrypt(&pgpin, &pgpout, NULL, -1, -1, fileno(pgperr), pgptmpfile);
+ if (thepid == -1)
{
mutt_file_fclose(&pgperr);
unlink(pgptmpfile);
mutt_write_mime_body(a, fptmp);
mutt_file_fclose(&fptmp);
- if ((thepid = pgp_invoke_encrypt(&pgpin, NULL, NULL, -1, fileno(fpout),
- fileno(pgperr), pgpinfile, keylist, sign)) == -1)
+ thepid = pgp_invoke_encrypt(&pgpin, NULL, NULL, -1, fileno(fpout),
+ fileno(pgperr), pgpinfile, keylist, sign);
+ if (thepid == -1)
{
mutt_file_fclose(&fpout);
mutt_file_fclose(&pgperr);
unlink(pgperrfile);
- if ((thepid = pgp_invoke_traditional(&pgpin, NULL, NULL, -1, fileno(pgpout),
- fileno(pgperr), pgpinfile, keylist, flags)) == -1)
+ thepid = pgp_invoke_traditional(&pgpin, NULL, NULL, -1, fileno(pgpout),
+ fileno(pgperr), pgpinfile, keylist, flags);
+ if (thepid == -1)
{
mutt_perror(_("Can't invoke PGP"));
mutt_file_fclose(&pgpout);
case 'a': /* sign (a)s */
unset_option(OPT_PGP_CHECK_TRUST);
- if ((p = pgp_ask_for_key(_("Sign as: "), NULL, 0, PGP_SECRING)))
+ p = pgp_ask_for_key(_("Sign as: "), NULL, 0, PGP_SECRING);
+ if (p)
{
snprintf(input_signas, sizeof(input_signas), "0x%s", pgp_fpr_or_lkeyid(p));
mutt_str_replace(&PgpSignAs, input_signas);
struct PgpUid **s = (struct PgpUid **) a;
struct PgpUid **t = (struct PgpUid **) b;
- if ((r = mutt_str_strcasecmp((*s)->addr, (*t)->addr)))
+ r = mutt_str_strcasecmp((*s)->addr, (*t)->addr);
+ if (r != 0)
return r > 0;
else
return (mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent),
struct PgpUid **s = (struct PgpUid **) a;
struct PgpUid **t = (struct PgpUid **) b;
- if ((r = mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent),
- pgp_fpr_or_lkeyid((*t)->parent))))
+ r = mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent));
+ if (r != 0)
return r > 0;
else
return (mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0);
struct PgpUid **s = (struct PgpUid **) a;
struct PgpUid **t = (struct PgpUid **) b;
- if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
- return r > 0;
+ r = ((*s)->parent->gen_time - (*t)->parent->gen_time);
+ if (r != 0)
+ return (r > 0);
return (mutt_str_strcasecmp((*s)->addr, (*t)->addr) > 0);
}
struct PgpUid **s = (struct PgpUid **) a;
struct PgpUid **t = (struct PgpUid **) b;
- if ((r = (((*s)->parent->flags & (KEYFLAG_RESTRICTIONS)) -
- ((*t)->parent->flags & (KEYFLAG_RESTRICTIONS)))))
- return r > 0;
- if ((r = ((*s)->trust - (*t)->trust)))
- return r < 0;
- if ((r = ((*s)->parent->keylen - (*t)->parent->keylen)))
- return r < 0;
- if ((r = ((*s)->parent->gen_time - (*t)->parent->gen_time)))
- return r < 0;
- if ((r = mutt_str_strcasecmp((*s)->addr, (*t)->addr)))
- return r > 0;
+ r = (((*s)->parent->flags & (KEYFLAG_RESTRICTIONS)) -
+ ((*t)->parent->flags & (KEYFLAG_RESTRICTIONS)));
+ if (r != 0)
+ return (r > 0);
+ r = ((*s)->trust - (*t)->trust);
+ if (r != 0)
+ return (r < 0);
+ r = ((*s)->parent->keylen - (*t)->parent->keylen);
+ if (r != 0)
+ return (r < 0);
+ r = ((*s)->parent->gen_time - (*t)->parent->gen_time);
+ if (r != 0)
+ return (r < 0);
+ r = mutt_str_strcasecmp((*s)->addr, (*t)->addr);
+ if (r != 0)
+ return (r > 0);
return (mutt_str_strcasecmp(pgp_fpr_or_lkeyid((*s)->parent),
pgp_fpr_or_lkeyid((*t)->parent)) > 0);
}
snprintf(tmpbuf, sizeof(tmpbuf), "0x%s",
pgp_fpr_or_lkeyid(pgp_principal_key(KeyTable[menu->current]->parent)));
- if ((thepid = pgp_invoke_verify_key(NULL, NULL, NULL, -1, fileno(fp),
- fileno(devnull), tmpbuf)) == -1)
+ thepid = pgp_invoke_verify_key(NULL, NULL, NULL, -1, fileno(fp),
+ fileno(devnull), tmpbuf);
+ if (thepid == -1)
{
mutt_perror(_("Can't create filter"));
unlink(tempfile);
}
}
- if ((key = pgp_getkeybystr(resp, abilities, keyring)))
+ key = pgp_getkeybystr(resp, abilities, keyring);
+ if (key)
return key;
mutt_error(_("No matching keys found for \"%s\""), resp);
mutt_message(_("Invoking PGP..."));
- if ((thepid = pgp_invoke_export(NULL, NULL, NULL, -1, fileno(tempfp),
- fileno(devnull), tmp)) == -1)
+ thepid = pgp_invoke_export(NULL, NULL, NULL, -1, fileno(tempfp), fileno(devnull), tmp);
+ if (thepid == -1)
{
mutt_perror(_("Can't create filter"));
unlink(tempf);
/*
* Else: Ask the user.
*/
- if ((k = pgp_select_key(matches, a, NULL)))
+ k = pgp_select_key(matches, a, NULL);
+ if (k)
pgp_remove_key(&matches, k);
}
if (matches)
{
- if ((k = pgp_select_key(matches, NULL, p)))
+ k = pgp_select_key(matches, NULL, p);
+ if (k)
pgp_remove_key(&matches, k);
pgp_free_key(&matches);
if (mutt_get_field(prompt, resp, sizeof(resp), MUTT_CLEAR) != 0)
return NULL;
- if ((key = smime_get_key_by_str(resp, abilities, public)))
+ key = smime_get_key_by_str(resp, abilities, public);
+ if (key)
return key;
mutt_error(_("No matching keys found for \"%s\""), resp);
}
mutt_file_unlink(tmpfname);
- if ((thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr),
- certificate, NULL, NULL, NULL, NULL, NULL, NULL,
- SmimeGetCertEmailCommand)) == -1)
+ thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), certificate,
+ NULL, NULL, NULL, NULL, NULL, NULL, SmimeGetCertEmailCommand);
+ if (thepid == -1)
{
mutt_message(_("Error: unable to create OpenSSL subprocess!"));
mutt_file_fclose(&fperr);
/* Step 1: Convert the signature to a PKCS#7 structure, as we can't
extract the full set of certificates directly.
*/
- if ((thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), infile, NULL,
- NULL, NULL, NULL, NULL, NULL, SmimePk7outCommand)) == -1)
+ thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), infile,
+ NULL, NULL, NULL, NULL, NULL, NULL, SmimePk7outCommand);
+ if (thepid == -1)
{
mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!"));
mutt_file_fclose(&fperr);
/* Step 2: Extract the certificates from a PKCS#7 structure.
*/
- if ((thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), pk7out, NULL,
- NULL, NULL, NULL, NULL, NULL, SmimeGetCertCommand)) == -1)
+ thepid = smime_invoke(NULL, NULL, NULL, -1, fileno(fpout), fileno(fperr), pk7out,
+ NULL, NULL, NULL, NULL, NULL, NULL, SmimeGetCertCommand);
+ if (thepid == -1)
{
mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!"));
mutt_file_fclose(&fperr);
/* Extract signer's certificate
*/
- if ((thepid = smime_invoke(NULL, NULL, NULL, -1, -1, fileno(fperr), infile, NULL, NULL, NULL,
- NULL, certfile, NULL, SmimeGetSignerCertCommand)) == -1)
+ thepid = smime_invoke(NULL, NULL, NULL, -1, -1, fileno(fperr), infile, NULL, NULL,
+ NULL, NULL, certfile, NULL, SmimeGetSignerCertCommand);
+ if (thepid == -1)
{
mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess!"));
mutt_file_fclose(&fperr);
}
mutt_endwin(NULL);
- if ((certfile = smime_extract_certificate(infile)))
+ certfile = smime_extract_certificate(infile);
+ if (certfile)
{
mutt_endwin(NULL);
- if ((thepid = smime_invoke(&smimein, NULL, NULL, -1, fileno(fpout),
- fileno(fperr), certfile, NULL, NULL, NULL, NULL,
- NULL, NULL, SmimeImportCertCommand)) == -1)
+ thepid = smime_invoke(&smimein, NULL, NULL, -1, fileno(fpout), fileno(fperr), certfile,
+ NULL, NULL, NULL, NULL, NULL, NULL, SmimeImportCertCommand);
+ if (thepid == -1)
{
mutt_message(_("Error: unable to create OpenSSL subprocess!"));
return;
if (mbox)
{
- if ((certfile = smime_extract_signer_certificate(tempfname)))
+ certfile = smime_extract_signer_certificate(tempfname);
+ if (certfile)
{
mutt_file_unlink(tempfname);
if (smime_handle_cert_email(certfile, mbox, 0, NULL, NULL))
*certfile = '\0';
for (cert_start = certlist; cert_start; cert_start = cert_end)
{
- if ((cert_end = strchr(cert_start, ' ')))
+ cert_end = strchr(cert_start, ' ');
+ if (cert_end)
*cert_end = '\0';
if (*cert_start)
{
mutt_write_mime_body(a, fptmp);
mutt_file_fclose(&fptmp);
- if ((thepid = smime_invoke_encrypt(&smimein, NULL, NULL, -1, fileno(fpout),
- fileno(smimeerr), smimeinfile, certfile)) == -1)
+ thepid = smime_invoke_encrypt(&smimein, NULL, NULL, -1, fileno(fpout),
+ fileno(smimeerr), smimeinfile, certfile);
+ if (thepid == -1)
{
mutt_file_fclose(&smimeerr);
mutt_file_unlink(smimeinfile);
smime_free_key(&default_key);
- if ((thepid = smime_invoke_sign(&smimein, NULL, &smimeerr, -1,
- fileno(smimeout), -1, filetosign)) == -1)
+ thepid = smime_invoke_sign(&smimein, NULL, &smimeerr, -1, fileno(smimeout), -1, filetosign);
+ if (thepid == -1)
{
mutt_perror(_("Can't open OpenSSL subprocess!"));
mutt_file_fclose(&smimeout);
crypt_current_time(s, "OpenSSL");
- if ((thepid = smime_invoke_verify(NULL, &smimeout, NULL, -1, -1, fileno(smimeerr),
- tempfile, signedfile, 0)) != -1)
+ thepid = smime_invoke_verify(NULL, &smimeout, NULL, -1, -1, fileno(smimeerr),
+ tempfile, signedfile, 0);
+ if (thepid != -1)
{
fflush(smimeout);
mutt_file_fclose(&smimeout);
case 'S': /* (s)ign in oppenc mode */
if (!SmimeDefaultKey)
{
- if ((key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0)))
+ key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0);
+ if (key)
{
mutt_str_replace(&SmimeDefaultKey, key->hash);
smime_free_key(&key);
case 'a': /* sign (a)s */
- if ((key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0)))
+ key = smime_ask_for_key(_("Sign as: "), KEYFLAG_CANSIGN, 0);
+ if (key)
{
mutt_str_replace(&SmimeDefaultKey, key->hash);
smime_free_key(&key);
goto out; /* fake display */
}
- if ((b_read = fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt,
- &buflen, &buf_ready)) < 0)
+ b_read = fill_buffer(f, last_pos, (*line_info)[n].offset, &buf, &fmt, &buflen, &buf_ready);
+ if (b_read < 0)
{
if (change_last)
(*last)--;
#if defined(USE_SLANG_CURSES) || defined(HAVE_RESIZETERM)
if (Resize)
{
- if ((rd->search_compiled = Resize->search_compiled))
+ rd->search_compiled = Resize->search_compiled;
+ if (rd->search_compiled)
{
- if ((err = REGCOMP(&rd->search_re, rd->searchbuf,
- REG_NEWLINE | mutt_which_case(rd->searchbuf))) != 0)
+ err = REGCOMP(&rd->search_re, rd->searchbuf,
+ REG_NEWLINE | mutt_which_case(rd->searchbuf));
+ if (err != 0)
{
regerror(err, &rd->search_re, buffer, sizeof(buffer));
mutt_error("%s", buffer);
}
}
- if ((err = REGCOMP(&rd.search_re, searchbuf,
- REG_NEWLINE | mutt_which_case(searchbuf))) != 0)
+ err = REGCOMP(&rd.search_re, searchbuf, REG_NEWLINE | mutt_which_case(searchbuf));
+ if (err != 0)
{
regerror(err, &rd.search_re, buffer, sizeof(buffer));
mutt_error("%s", buffer);
/* Some pre-RFC1521 gateways still use the "name=filename" convention,
* but if a filename has already been set in the content-disposition,
* let that take precedence, and don't set it here */
- if ((pc = mutt_param_get("name", ct->parameter)) && !ct->filename)
+ pc = mutt_param_get("name", ct->parameter);
+ if (pc && !ct->filename)
ct->filename = mutt_str_strdup(pc);
#ifdef SUN_ATTACHMENT
/* this is deep and utter perversion */
- if ((pc = mutt_param_get("conversions", ct->parameter)))
+ pc = mutt_param_get("conversions", ct->parameter);
+ if (pc)
ct->encoding = mutt_check_encoding(pc);
#endif
}
/* Now get the subtype */
- if ((subtype = strchr(s, '/')))
+ subtype = strchr(s, '/');
+ if (subtype)
{
*subtype++ = '\0';
for (pc = subtype; *pc && !ISSPACE(*pc) && *pc != ';'; pc++)
if (s)
{
s = mutt_str_skip_email_wsp(s + 1);
- if ((s = mutt_param_get("filename", (parms = parse_parameters(s)))))
+ s = mutt_param_get("filename", (parms = parse_parameters(s)));
+ if (s)
mutt_str_replace(&ct->filename, s);
- if ((s = mutt_param_get("name", parms)))
+ s = mutt_param_get("name", parms);
+ if (s)
ct->form_name = mutt_str_strdup(s);
mutt_param_free(&parms);
}
while (*(line = mutt_read_rfc822_line(fp, line, &linelen)) != 0)
{
/* Find the value of the current header */
- if ((c = strchr(line, ':')))
+ c = strchr(line, ':');
+ if (c)
{
*c = 0;
c = mutt_str_skip_email_wsp(c + 1);
if (cur->content->parts)
break; /* The message was parsed earlier. */
- if ((msg = mx_open_message(ctx, cur->msgno)))
+ msg = mx_open_message(ctx, cur->msgno);
+ if (msg)
{
mutt_parse_part(msg->fp, cur->content);
{
/* remember that we've already searched this message */
h->searched = true;
- if ((h->matched = (mutt_pattern_exec(SearchPattern, MUTT_MATCH_FULL_ADDRESS,
- Context, h, NULL) > 0)))
+ h->matched =
+ mutt_pattern_exec(SearchPattern, MUTT_MATCH_FULL_ADDRESS, Context, h, NULL);
+ if (h->matched > 0)
{
mutt_clear_error();
if (msg && *msg)
mutt_str_strfcpy(kring, tmp_kring, sizeof(kring));
else
{
- if ((env_pgppath = getenv("PGPPATH")))
+ env_pgppath = getenv("PGPPATH");
+ if (env_pgppath)
mutt_str_strfcpy(pgppath, env_pgppath, sizeof(pgppath));
else if ((env_home = getenv("HOME")))
snprintf(pgppath, sizeof(pgppath), "%s/.pgp", env_home);
if (!ctx->quiet)
mutt_progress_update(&progress, i + 1 - old_count, -1);
#ifdef USE_HCACHE
- if ((data = mutt_hcache_fetch(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data))))
+ data = mutt_hcache_fetch(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data));
+ if (data)
{
char *uidl = mutt_str_strdup(ctx->hdrs[i]->data);
int refno = ctx->hdrs[i]->refno;
unsigned short bcache = 1;
/* see if we already have the message in body cache */
- if ((msg->fp = mutt_bcache_get(pop_data->bcache, h->data)))
+ msg->fp = mutt_bcache_get(pop_data->bcache, h->data);
+ if (msg->fp)
return 0;
/*
if (!quiet)
mutt_message(_("Waiting for response..."));
fgets(msg, sizeof(msg), fp);
- if ((p = strrchr(msg, '\n')))
+ p = strrchr(msg, '\n');
+ if (p)
*p = '\0';
while ((buf = mutt_file_read_line(buf, &buflen, fp, &dummy, 0)) != NULL)
{
- if ((p = strtok(buf, "\t\n")))
+ p = strtok(buf, "\t\n");
+ if (p)
{
if (!first)
{
}
else
{
- if ((rc = mutt_check_overwrite(body->filename, buf, tfile, sizeof(tfile),
- &append, directory)) == -1)
+ rc = mutt_check_overwrite(body->filename, buf, tfile, sizeof(tfile), &append, directory);
+ if (rc == -1)
return -1;
else if (rc == 1)
{
if (!mime_fwd_all && !cur && (nattach > 1) && !check_can_decode(actx, cur))
{
- if ((rc = query_quadoption(OPT_MIME_FORWARD_REST,
- _("Can't decode all tagged attachments. "
- "MIME-forward the others?"))) == MUTT_ABORT)
+ rc = query_quadoption(
+ OPT_MIME_FORWARD_REST,
+ _("Can't decode all tagged attachments. MIME-forward the others?"));
+ if (rc == MUTT_ABORT)
goto bail;
else if (rc == MUTT_NO)
mime_fwd_any = false;
tmpbody[0] = '\0';
- if ((rc = query_quadoption(OPT_MIME_FORWARD,
- _("Forward MIME encapsulated?"))) == MUTT_NO)
+ rc = query_quadoption(OPT_MIME_FORWARD, _("Forward MIME encapsulated?"));
+ if (rc == MUTT_NO)
{
/* no MIME encapsulation */
if (nattach > 1 && !check_can_decode(actx, cur))
{
- if ((rc = query_quadoption(OPT_MIME_FORWARD_REST,
- _("Can't decode all tagged attachments. "
- "MIME-encapsulate the others?"))) == MUTT_ABORT)
+ rc = query_quadoption(OPT_MIME_FORWARD_REST,
+ _("Can't decode all tagged attachments. "
+ "MIME-encapsulate the others?"));
+ if (rc == MUTT_ABORT)
return;
else if (rc == MUTT_YES)
mime_reply_any = true;
{
for (int i = 0; i < chain->cl; i++)
{
- if ((j = chain->ch[i]))
+ j = chain->ch[i];
+ if (j != 0)
t = type2_list[j]->shortname;
else
t = "*";
tocode = fromcode;
if (icode)
{
- if ((tocode1 = mutt_choose_charset(icode, charsets, u, ulen, 0, 0)))
+ tocode1 = mutt_choose_charset(icode, charsets, u, ulen, 0, 0);
+ if (tocode1)
tocode = tocode1;
else
{
case 2:
/* ignore language specification a la RFC2231 */
t = pp1;
- if ((t1 = memchr(pp, '*', t - pp)))
+ t1 = memchr(pp, '*', t - pp);
+ if (t1)
t = t1;
charset = mutt_str_substr_dup(pp, t);
break;
*t = '\0';
mutt_str_strfcpy(charset, value, chslen);
- if ((u = strchr(t + 1, '\'')))
+ u = strchr(t + 1, '\'');
+ if (u)
return u + 1;
else
return t + 1;
mutt_str_strfcpy(attribute, par->attribute, sizeof(attribute));
- if ((encoded = par->encoded))
+ encoded = par->encoded;
+ if (encoded != 0)
valp = rfc2231_get_charset(par->value, charset, sizeof(charset));
else
valp = par->value;
q = par->next;
rfc2231_free_parameter(&par);
- if ((par = q))
+ par = q;
+ if (par)
valp = par->value;
} while (par && (strcmp(par->attribute, attribute) == 0));
memset(&fst, 0, sizeof(fst));
/* respect DelSp of RFC3676 only with f=f parts */
- if ((t = (char *) mutt_param_get("delsp", a->parameter)))
+ t = mutt_param_get("delsp", a->parameter);
+ if (t)
{
delsp = mutt_str_strlen(t) == 3 && (mutt_str_strncasecmp(t, "yes", 3) == 0);
t = NULL;
char *tmp = NULL;
/* Strip off the leading path... */
- if ((t = strrchr(fn, '/')))
+ t = strrchr(fn, '/');
+ if (t)
t++;
else
t = fn;
while (fgets(buf, sizeof(buf) - 1, f) != NULL)
{
/* weed out any comments */
- if ((p = strchr(buf, '#')))
+ p = strchr(buf, '#');
+ if (p)
*p = 0;
/* remove any leading space. */
if (b->next && check_boundary(boundary, b->next))
return true;
- if ((p = mutt_param_get("boundary", b->parameter)) && (mutt_str_strcmp(p, boundary) == 0))
+ p = mutt_param_get("boundary", b->parameter);
+ if (p && (mutt_str_strcmp(p, boundary) == 0))
{
return true;
}
struct ListNode *tmp;
STAILQ_FOREACH(tmp, &env->userhdrs, entries)
{
- if ((p = strchr(tmp->data, ':')))
+ p = strchr(tmp->data, ':');
+ if (p)
{
q = p;
if (may_hide_host && option(OPT_HIDDEN_HOST))
{
- if ((p = strchr(Hostname, '.')))
+ p = strchr(Hostname, '.');
+ if (p)
p++;
/* sanity check: don't hide the host if
if (!option(OPT_NO_CURSES))
mutt_need_hard_redraw();
- if ((i = send_msg(path, args, msg, option(OPT_NO_CURSES) ? NULL : &childout)) !=
- (EX_OK & 0xff))
+ i = send_msg(path, args, msg, option(OPT_NO_CURSES) ? NULL : &childout);
+ if (i != (EX_OK & 0xff))
{
if (i != S_BKG)
{
* mutt_expando_format to do the actual work. mutt_expando_format will callback to
* us using sidebar_format_str() for the sidebar specific formatting characters.
*/
-static void make_sidebar_entry(char *buf, size_t buflen, int width,
- char *box, struct SbEntry *sbe)
+static void make_sidebar_entry(char *buf, size_t buflen, int width, char *box,
+ struct SbEntry *sbe)
{
if (!buf || !box || !sbe)
return;
snprintf(buf, sizeof(buf), "RCPT TO:<%s>\r\n", a->mailbox);
if (mutt_socket_write(conn, buf) == -1)
return SMTP_ERR_WRITE;
- if ((r = smtp_get_resp(conn)))
+ r = smtp_get_resp(conn);
+ if (r != 0)
return r;
a = a->next;
}
mutt_file_fclose(&fp);
return SMTP_ERR_WRITE;
}
- if ((r = smtp_get_resp(conn)))
+ r = smtp_get_resp(conn);
+ if (r != 0)
{
mutt_file_fclose(&fp);
return r;
if (mutt_socket_write(conn, ".\r\n") == -1)
return SMTP_ERR_WRITE;
- if ((r = smtp_get_resp(conn)))
+ r = smtp_get_resp(conn);
+ if (r != 0)
return r;
return 0;
return -1;
/* get greeting string */
- if ((rc = smtp_get_resp(conn)))
+ rc = smtp_get_resp(conn);
+ if (rc != 0)
return rc;
- if ((rc = smtp_helo(conn)))
+ rc = smtp_helo(conn);
+ if (rc != 0)
return rc;
#ifdef USE_SSL
{
if (mutt_socket_write(conn, "STARTTLS\r\n") < 0)
return SMTP_ERR_WRITE;
- if ((rc = smtp_get_resp(conn)))
+ rc = smtp_get_resp(conn);
+ if (rc != 0)
return rc;
if (mutt_ssl_starttls(conn))
}
/* re-EHLO to get authentication mechanisms */
- if ((rc = smtp_helo(conn)))
+ rc = smtp_helo(conn);
+ if (rc != 0)
return rc;
}
#endif
do
{
/* send our greeting */
- if ((rc = smtp_open(conn)))
+ rc = smtp_open(conn);
+ if (rc != 0)
break;
FREE(&AuthMechs);
rc = SMTP_ERR_WRITE;
break;
}
- if ((rc = smtp_get_resp(conn)))
+ rc = smtp_get_resp(conn);
+ if (rc != 0)
break;
/* send the recipient list */
break;
/* send the message data */
- if ((rc = smtp_data(conn, msgfile)))
+ rc = smtp_data(conn, msgfile);
+ if (rc != 0)
break;
mutt_socket_write(conn, "QUIT\r\n");
while (src && *src)
{
qs = mutt_mem_calloc(1, sizeof(struct UrlQueryString));
- if ((k = strchr(src, '&')))
+ k = strchr(src, '&');
+ if (k)
*k = '\0';
- if ((v = strchr(src, '=')))
+ v = strchr(src, '=');
+ if (v)
{
*v = '\0';
qs->value = v + 1;
src += 2;
- if ((t = strchr(src, '?')))
+ t = strchr(src, '?');
+ if (t)
{
*t++ = '\0';
if (parse_query_string(u, t) < 0)
goto err;
}
- if ((u->path = strchr(src, '/')))
+ u->path = strchr(src, '/');
+ if (u->path)
*u->path++ = '\0';
if (u->path && url_pct_decode(u->path) < 0)
goto err;
- if ((t = strrchr(src, '@')))
+ t = strrchr(src, '@');
+ if (t)
{
*t = '\0';
- if ((p = strchr(src, ':')))
+ p = strchr(src, ':');
+ if (p)
{
*p = '\0';
u->pass = p + 1;
else
t = src;
- if ((p = strchr(t, ':')))
+ p = strchr(t, ':');
+ if (p)
{
int num;
*p++ = '\0';
if (!tmp)
return -1;
- if ((headers = strchr(tmp, '?')))
+ headers = strchr(tmp, '?');
+ if (headers)
*headers++ = '\0';
if (url_pct_decode(tmp) < 0)
for (; tag; tag = strtok_r(NULL, "&", &p))
{
- if ((value = strchr(tag, '=')))
+ value = strchr(tag, '=');
+ if (value)
*value++ = '\0';
if (!value || !*value)
continue;