break;
}
- int err = REGCOMP(&rx, s, REG_NOSUB);
+ int err = REG_COMP(&rx, s, REG_NOSUB);
if (err != 0)
{
regerror(err, &rx, buf->data, buf->dsize);
else
flags = REG_ICASE;
- const int r = REGCOMP(&tmp->regex, s, flags);
+ const int r = REG_COMP(&tmp->regex, s, flags);
if (r != 0)
{
regerror(r, &tmp->regex, err->data, err->dsize);
break; \
}
-#define CURATTACH actx->idx[actx->v2r[menu->current]]
+#define CUR_ATTACH actx->idx[actx->v2r[menu->current]]
/**
* enum HeaderField - Ordered list of headers for the compose screen
*/
static void redraw_crypt_lines(struct Email *msg)
{
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(MuttIndexWindow, HDR_CRYPT, 0, "%*s",
HeaderPadding[HDR_CRYPT], _(Prompts[HDR_CRYPT]));
NORMAL_COLOR;
if ((msg->security & (SEC_ENCRYPT | SEC_SIGN)) == (SEC_ENCRYPT | SEC_SIGN))
{
- SETCOLOR(MT_COLOR_COMPOSE_SECURITY_BOTH);
+ SET_COLOR(MT_COLOR_COMPOSE_SECURITY_BOTH);
addstr(_("Sign, Encrypt"));
}
else if (msg->security & SEC_ENCRYPT)
{
- SETCOLOR(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
+ SET_COLOR(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
addstr(_("Encrypt"));
}
else if (msg->security & SEC_SIGN)
{
- SETCOLOR(MT_COLOR_COMPOSE_SECURITY_SIGN);
+ SET_COLOR(MT_COLOR_COMPOSE_SECURITY_SIGN);
addstr(_("Sign"));
}
else
{
/* L10N: This refers to the encryption of the email, e.g. "Security: None" */
- SETCOLOR(MT_COLOR_COMPOSE_SECURITY_NONE);
+ SET_COLOR(MT_COLOR_COMPOSE_SECURITY_NONE);
addstr(_("None"));
}
NORMAL_COLOR;
if (((WithCrypto & APPLICATION_PGP) != 0) &&
(msg->security & APPLICATION_PGP) && (msg->security & SEC_SIGN))
{
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
NORMAL_COLOR;
printw("%s", C_PgpSignAs ? C_PgpSignAs : _("<default>"));
if (((WithCrypto & APPLICATION_SMIME) != 0) &&
(msg->security & APPLICATION_SMIME) && (msg->security & SEC_SIGN))
{
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
NORMAL_COLOR;
printw("%s", C_SmimeSignAs ? C_SmimeSignAs : _("<default>"));
if (((WithCrypto & APPLICATION_SMIME) != 0) && (msg->security & APPLICATION_SMIME) &&
(msg->security & SEC_ENCRYPT) && C_SmimeEncryptWith && *C_SmimeEncryptWith)
{
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(MuttIndexWindow, HDR_CRYPTINFO, 40, "%s", _("Encrypt with: "));
NORMAL_COLOR;
printw("%s", NONULL(C_SmimeEncryptWith));
{
char *t = NULL;
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(MuttIndexWindow, HDR_MIX, 0, "%*s",
HeaderPadding[HDR_MIX], _(Prompts[HDR_MIX]));
NORMAL_COLOR;
buf[0] = '\0';
mutt_addr_write(buf, sizeof(buf), addr, true);
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(MuttIndexWindow, line, 0, "%*s", HeaderPadding[line],
_(Prompts[line]));
NORMAL_COLOR;
}
#endif
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(MuttIndexWindow, HDR_SUBJECT, 0, "%*s",
HeaderPadding[HDR_SUBJECT], _(Prompts[HDR_SUBJECT]));
NORMAL_COLOR;
draw_envelope_addr(HDR_REPLYTO, msg->env->reply_to);
- SETCOLOR(MT_COLOR_COMPOSE_HEADER);
+ SET_COLOR(MT_COLOR_COMPOSE_HEADER);
mutt_window_mvprintw(MuttIndexWindow, HDR_FCC, 0, "%*s",
HeaderPadding[HDR_FCC], _(Prompts[HDR_FCC]));
NORMAL_COLOR;
redraw_mix_line(&msg->chain);
#endif
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_window_mvaddstr(MuttIndexWindow, HDR_ATTACH - 1, 0, _("-- Attachments"));
mutt_window_clrtoeol(MuttIndexWindow);
compose_status_line(buf, sizeof(buf), 0, MuttStatusWindow->cols, menu,
NONULL(C_ComposeFormat));
mutt_window_move(MuttStatusWindow, 0, 0);
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_paddstr(MuttStatusWindow->cols, buf);
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
case OP_DELETE:
CHECK_COUNT;
- if (CURATTACH->unowned)
- CURATTACH->content->unlink = false;
+ if (CUR_ATTACH->unowned)
+ CUR_ATTACH->content->unlink = false;
if (delete_attachment(actx, menu->current) == -1)
break;
mutt_update_compose_menu(actx, menu, false);
case OP_COMPOSE_TOGGLE_RECODE:
{
CHECK_COUNT;
- if (!mutt_is_text_part(CURATTACH->content))
+ if (!mutt_is_text_part(CUR_ATTACH->content))
{
mutt_error(_("Recoding only affects text attachments"));
break;
}
- CURATTACH->content->noconv = !CURATTACH->content->noconv;
- if (CURATTACH->content->noconv)
+ CUR_ATTACH->content->noconv = !CUR_ATTACH->content->noconv;
+ if (CUR_ATTACH->content->noconv)
mutt_message(_("The current attachment won't be converted"));
else
mutt_message(_("The current attachment will be converted"));
case OP_COMPOSE_EDIT_DESCRIPTION:
CHECK_COUNT;
- mutt_str_strfcpy(buf,
- CURATTACH->content->description ? CURATTACH->content->description : "",
- sizeof(buf));
+ mutt_str_strfcpy(
+ buf, CUR_ATTACH->content->description ? CUR_ATTACH->content->description : "",
+ sizeof(buf));
/* header names should not be translated */
if (mutt_get_field("Description: ", buf, sizeof(buf), 0) == 0)
{
- mutt_str_replace(&CURATTACH->content->description, buf);
+ mutt_str_replace(&CUR_ATTACH->content->description, buf);
menu->redraw = REDRAW_CURRENT;
}
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
}
else
{
- mutt_update_encoding(CURATTACH->content);
+ mutt_update_encoding(CUR_ATTACH->content);
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
}
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
case OP_COMPOSE_TOGGLE_DISPOSITION:
/* toggle the content-disposition between inline/attachment */
- CURATTACH->content->disposition =
- (CURATTACH->content->disposition == DISP_INLINE) ? DISP_ATTACH : DISP_INLINE;
+ CUR_ATTACH->content->disposition =
+ (CUR_ATTACH->content->disposition == DISP_INLINE) ? DISP_ATTACH : DISP_INLINE;
menu->redraw = REDRAW_CURRENT;
break;
case OP_EDIT_TYPE:
CHECK_COUNT;
{
- mutt_edit_content_type(NULL, CURATTACH->content, NULL);
+ mutt_edit_content_type(NULL, CUR_ATTACH->content, NULL);
/* this may have been a change to text/something */
- mutt_update_encoding(CURATTACH->content);
+ mutt_update_encoding(CUR_ATTACH->content);
menu->redraw = REDRAW_CURRENT;
}
case OP_COMPOSE_EDIT_LANGUAGE:
CHECK_COUNT;
buf[0] = '\0'; /* clear buffer first */
- if (CURATTACH->content->language)
- mutt_str_strfcpy(buf, CURATTACH->content->language, sizeof(buf));
+ if (CUR_ATTACH->content->language)
+ mutt_str_strfcpy(buf, CUR_ATTACH->content->language, sizeof(buf));
if (mutt_get_field("Content-Language: ", buf, sizeof(buf), 0) == 0)
{
- CURATTACH->content->language = mutt_str_strdup(buf);
+ CUR_ATTACH->content->language = mutt_str_strdup(buf);
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
mutt_clear_error();
}
case OP_COMPOSE_EDIT_ENCODING:
CHECK_COUNT;
- mutt_str_strfcpy(buf, ENCODING(CURATTACH->content->encoding), sizeof(buf));
+ mutt_str_strfcpy(buf, ENCODING(CUR_ATTACH->content->encoding), sizeof(buf));
if ((mutt_get_field("Content-Transfer-Encoding: ", buf, sizeof(buf), 0) == 0) &&
(buf[0] != '\0'))
{
int enc = mutt_check_encoding(buf);
if ((enc != ENC_OTHER) && (enc != ENC_UUENCODED))
{
- CURATTACH->content->encoding = enc;
+ CUR_ATTACH->content->encoding = enc;
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
mutt_clear_error();
}
case OP_COMPOSE_EDIT_FILE:
CHECK_COUNT;
- mutt_edit_file(NONULL(C_Editor), CURATTACH->content->filename);
- mutt_update_encoding(CURATTACH->content);
+ mutt_edit_file(NONULL(C_Editor), CUR_ATTACH->content->filename);
+ mutt_update_encoding(CUR_ATTACH->content);
menu->redraw = REDRAW_CURRENT | REDRAW_STATUS;
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
break;
case OP_COMPOSE_TOGGLE_UNLINK:
CHECK_COUNT;
- CURATTACH->content->unlink = !CURATTACH->content->unlink;
+ CUR_ATTACH->content->unlink = !CUR_ATTACH->content->unlink;
menu->redraw = REDRAW_INDEX;
/* No send2hook since this doesn't change the message. */
}
menu->redraw = REDRAW_FULL;
}
- else if (mutt_get_tmp_attachment(CURATTACH->content) == 0)
+ else if (mutt_get_tmp_attachment(CUR_ATTACH->content) == 0)
menu->redraw = REDRAW_CURRENT;
/* No send2hook since this doesn't change the message. */
{
CHECK_COUNT;
char *src = NULL;
- if (CURATTACH->content->d_filename)
- src = CURATTACH->content->d_filename;
+ if (CUR_ATTACH->content->d_filename)
+ src = CUR_ATTACH->content->d_filename;
else
- src = CURATTACH->content->filename;
+ src = CUR_ATTACH->content->filename;
mutt_str_strfcpy(buf, mutt_path_basename(NONULL(src)), sizeof(buf));
int ret = mutt_get_field(_("Send attachment with name: "), buf, sizeof(buf), MUTT_FILE);
if (ret == 0)
{
/* As opposed to RENAME_FILE, we don't check buf[0] because it's
* valid to set an empty string here, to erase what was set */
- mutt_str_replace(&CURATTACH->content->d_filename, buf);
+ mutt_str_replace(&CUR_ATTACH->content->d_filename, buf);
menu->redraw = REDRAW_CURRENT;
}
break;
case OP_COMPOSE_RENAME_FILE:
CHECK_COUNT;
- mutt_str_strfcpy(buf, CURATTACH->content->filename, sizeof(buf));
+ mutt_str_strfcpy(buf, CUR_ATTACH->content->filename, sizeof(buf));
mutt_pretty_mailbox(buf, sizeof(buf));
if ((mutt_get_field(_("Rename to: "), buf, sizeof(buf), MUTT_FILE) == 0) &&
(buf[0] != '\0'))
{
struct stat st;
- if (stat(CURATTACH->content->filename, &st) == -1)
+ if (stat(CUR_ATTACH->content->filename, &st) == -1)
{
/* L10N: "stat" is a system call. Do "man 2 stat" for more information. */
mutt_error(_("Can't stat %s: %s"), buf, strerror(errno));
}
mutt_expand_path(buf, sizeof(buf));
- if (mutt_file_rename(CURATTACH->content->filename, buf))
+ if (mutt_file_rename(CUR_ATTACH->content->filename, buf))
break;
- mutt_str_replace(&CURATTACH->content->filename, buf);
+ mutt_str_replace(&CUR_ATTACH->content->filename, buf);
menu->redraw = REDRAW_CURRENT;
- if (CURATTACH->content->stamp >= st.st_mtime)
- mutt_stamp_attachment(CURATTACH->content);
+ if (CUR_ATTACH->content->stamp >= st.st_mtime)
+ mutt_stamp_attachment(CUR_ATTACH->content);
}
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
break;
}
update_idx(menu, actx, new);
- CURATTACH->content->type = itype;
- mutt_str_replace(&CURATTACH->content->subtype, p);
- CURATTACH->content->unlink = true;
+ CUR_ATTACH->content->type = itype;
+ mutt_str_replace(&CUR_ATTACH->content->subtype, p);
+ CUR_ATTACH->content->unlink = true;
menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
- if (mutt_compose_attachment(CURATTACH->content))
+ if (mutt_compose_attachment(CUR_ATTACH->content))
{
- mutt_update_encoding(CURATTACH->content);
+ mutt_update_encoding(CUR_ATTACH->content);
menu->redraw = REDRAW_FULL;
}
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
case OP_COMPOSE_EDIT_MIME:
CHECK_COUNT;
- if (mutt_edit_attachment(CURATTACH->content))
+ if (mutt_edit_attachment(CUR_ATTACH->content))
{
- mutt_update_encoding(CURATTACH->content);
+ mutt_update_encoding(CUR_ATTACH->content);
menu->redraw = REDRAW_FULL;
}
mutt_message_hook(NULL, msg, MUTT_SEND2_HOOK);
case OP_SAVE:
CHECK_COUNT;
mutt_save_attachment_list(actx, NULL, menu->tagprefix,
- CURATTACH->content, NULL, menu);
+ CUR_ATTACH->content, NULL, menu);
/* no send2hook, since this doesn't modify the message */
break;
case OP_PRINT:
CHECK_COUNT;
- mutt_print_attachment_list(actx, NULL, menu->tagprefix, CURATTACH->content);
+ mutt_print_attachment_list(actx, NULL, menu->tagprefix, CUR_ATTACH->content);
/* no send2hook, since this doesn't modify the message */
break;
case OP_FILTER:
CHECK_COUNT;
mutt_pipe_attachment_list(actx, NULL, menu->tagprefix,
- CURATTACH->content, (op == OP_FILTER));
+ CUR_ATTACH->content, (op == OP_FILTER));
if (op == OP_FILTER) /* cte might have changed */
menu->redraw = menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT;
menu->redraw |= REDRAW_STATUS;
str++;
}
- int rc = REGCOMP(reg->regex, str, rflags);
+ int rc = REG_COMP(reg->regex, str, rflags);
if ((rc != 0) && err)
{
regerror(rc, reg->regex, err->data, err->dsize);
const int dialog_row_len = 128;
-/* Just in case OpenSSL doesn't define DEVRANDOM */
-#ifndef DEVRANDOM
-#define DEVRANDOM "/dev/urandom"
+/* Just in case OpenSSL doesn't define DEV_RANDOM */
+#ifndef DEV_RANDOM
+#define DEV_RANDOM "/dev/urandom"
#endif
/* LibreSSL defines OPENSSL_VERSION_NUMBER but sets it to 0x20000000L.
#else
static int entropy_byte_count = 0;
/* OpenSSL fills the entropy pool from /dev/urandom if it exists */
-#define HAVE_ENTROPY() (!access(DEVRANDOM, R_OK) || entropy_byte_count >= 16)
+#define HAVE_ENTROPY() (!access(DEV_RANDOM, R_OK) || entropy_byte_count >= 16)
#endif
/* index for storing hostname as application specific data in SSL structure */
FILE *fp = fopen(C_CertificateFile, "r");
if (fp)
{
- if (REGCOMP(&preg, "^#H ([a-zA-Z0-9_\\.-]+) ([0-9A-F]{4}( [0-9A-F]{4}){7})[ \t]*$",
- REG_ICASE) != 0)
+ if (REG_COMP(&preg, "^#H ([a-zA-Z0-9_\\.-]+) ([0-9A-F]{4}( [0-9A-F]{4}){7})[ \t]*$",
+ REG_ICASE) != 0)
{
mutt_file_fclose(&fp);
return 0;
/* Don't let the subprocess think it can use the controlling tty */
setsid();
- execle(EXECSHELL, "sh", "-c", C_Tunnel, NULL, mutt_envlist_getlist());
+ execle(EXEC_SHELL, "sh", "-c", C_Tunnel, NULL, mutt_envlist_getlist());
_exit(127);
}
mutt_sig_unblock_system(true);
mutt_menu_current_redraw();
}
mutt_window_clearline(MuttMessageWindow, 0);
- SETCOLOR(MT_COLOR_PROMPT);
+ SET_COLOR(MT_COLOR_PROMPT);
addstr(field);
NORMAL_COLOR;
mutt_refresh();
answer[1] = '\0';
bool reyes_ok = (expr = nl_langinfo(YESEXPR)) && (expr[0] == '^') &&
- (REGCOMP(&reyes, expr, REG_NOSUB) == 0);
+ (REG_COMP(&reyes, expr, REG_NOSUB) == 0);
bool reno_ok = (expr = nl_langinfo(NOEXPR)) && (expr[0] == '^') &&
- (REGCOMP(&reno, expr, REG_NOSUB) == 0);
+ (REG_COMP(&reno, expr, REG_NOSUB) == 0);
/* In order to prevent the default answer to the question to wrapped
* around the screen in the even the question is wider than the screen,
prompt_lines * MuttMessageWindow->cols - answer_string_wid, NULL);
mutt_window_move(MuttMessageWindow, 0, 0);
- SETCOLOR(MT_COLOR_PROMPT);
+ SET_COLOR(MT_COLOR_PROMPT);
addnstr(msg, trunc_msg_len);
addstr(answer_string);
NORMAL_COLOR;
if (OptKeepQuiet || !ErrorBufMessage)
return;
- SETCOLOR(OptMsgErr ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
+ SET_COLOR(OptMsgErr ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
mutt_window_mvaddstr(MuttMessageWindow, 0, 0, ErrorBuf);
NORMAL_COLOR;
mutt_window_clrtoeol(MuttMessageWindow);
{
struct Event ch;
- SETCOLOR(MT_COLOR_PROMPT);
+ SET_COLOR(MT_COLOR_PROMPT);
mutt_window_mvaddstr(MuttMessageWindow, 0, 0, (char *) prompt);
addstr(_(" ('?' for list): "));
NORMAL_COLOR;
while ((cur = strchr(prompt, '(')))
{
// write the part between prompt and cur using MT_COLOR_PROMPT
- SETCOLOR(MT_COLOR_PROMPT);
+ SET_COLOR(MT_COLOR_PROMPT);
addnstr(prompt, cur - prompt);
if (isalnum(cur[1]) && (cur[2] == ')'))
{
// we have a single letter within parentheses
- SETCOLOR(MT_COLOR_OPTIONS);
+ SET_COLOR(MT_COLOR_OPTIONS);
addch(cur[1]);
prompt = cur + 3;
}
}
}
- SETCOLOR(MT_COLOR_PROMPT);
+ SET_COLOR(MT_COLOR_PROMPT);
addstr(prompt);
NORMAL_COLOR;
{
/* remove trailing whitespace from the line */
p = tmp + mutt_str_strlen(tmp) - 1;
- while ((p >= tmp) && ISSPACE(*p))
+ while ((p >= tmp) && IS_SPACE(*p))
*p-- = '\0';
p = tmp + 2;
const char *p = NULL;
short q = 0;
- for (p = s; *p && (q || !ISSPACE(*p)); p++)
+ for (p = s; *p && (q || !IS_SPACE(*p)); p++)
{
if (*p == '\\')
{
if (pc)
{
*pc++ = 0;
- while (*pc && ISSPACE(*pc))
+ while (*pc && IS_SPACE(*pc))
pc++;
parse_parameters(&ct->parameter, pc);
if (subtype)
{
*subtype++ = '\0';
- for (pc = subtype; *pc && !ISSPACE(*pc) && (*pc != ';'); pc++)
+ for (pc = subtype; *pc && !IS_SPACE(*pc) && (*pc != ';'); pc++)
;
*pc = '\0';
ct->subtype = mutt_str_strdup(subtype);
while (true)
{
if (!fgets(buf, *linelen - offset, fp) || /* end of file or */
- (ISSPACE(*line) && !offset)) /* end of headers */
+ (IS_SPACE(*line) && !offset)) /* end of headers */
{
*line = '\0';
return line;
if (*buf == '\n')
{
/* we did get a full line. remove trailing space */
- while (ISSPACE(*buf))
+ while (IS_SPACE(*buf))
{
*buf-- = '\0'; /* we can't come beyond line's beginning because
* it begins with a non-space */
if (len > 0)
{
/* Remove any trailing whitespace, up to the length of the boundary */
- for (size_t i = len - 1; ISSPACE(buf[i]) && (i >= (blen + 2)); i--)
+ for (size_t i = len - 1; IS_SPACE(buf[i]) && (i >= (blen + 2)); i--)
buf[i] = '\0';
}
mutt_envlist_set("COLUMNS", columns, 1);
}
- execle(EXECSHELL, "sh", "-c", cmd, NULL, mutt_envlist_getlist());
+ execle(EXEC_SHELL, "sh", "-c", cmd, NULL, mutt_envlist_getlist());
_exit(127);
}
else if (pid == -1)
#define BUFI_SIZE 1000
#define BUFO_SIZE 2000
-#define TXTHTML 1
-#define TXTPLAIN 2
-#define TXTENRICHED 3
+#define TXT_HTML 1
+#define TXT_PLAIN 2
+#define TXT_ENRICHED 3
/**
* typedef handler_t - Manage a PGP or S/MIME encrypted MIME part
/* chop trailing whitespace if we got the full line */
if (last == '\n')
{
- while ((linelen > 0) && ISSPACE(line[linelen - 1]))
+ while ((linelen > 0) && IS_SPACE(line[linelen - 1]))
linelen--;
line[linelen] = '\0';
}
{
if (b->type == TYPE_TEXT)
{
- if ((mutt_str_strcasecmp("plain", b->subtype) == 0) && (type <= TXTPLAIN))
+ if ((mutt_str_strcasecmp("plain", b->subtype) == 0) && (type <= TXT_PLAIN))
{
choice = b;
- type = TXTPLAIN;
+ type = TXT_PLAIN;
}
- else if ((mutt_str_strcasecmp("enriched", b->subtype) == 0) && (type <= TXTENRICHED))
+ else if ((mutt_str_strcasecmp("enriched", b->subtype) == 0) && (type <= TXT_ENRICHED))
{
choice = b;
- type = TXTENRICHED;
+ type = TXT_ENRICHED;
}
- else if ((mutt_str_strcasecmp("html", b->subtype) == 0) && (type <= TXTHTML))
+ else if ((mutt_str_strcasecmp("html", b->subtype) == 0) && (type <= TXT_HTML))
{
choice = b;
- type = TXTHTML;
+ type = TXT_HTML;
}
}
b = b->next;
{
/* Hooks not allowing full patterns: Check syntax of regex */
rx = mutt_mem_malloc(sizeof(regex_t));
- rc = REGCOMP(rx, NONULL(pattern.data), ((data & MUTT_CRYPT_HOOK) ? REG_ICASE : 0));
+ rc = REG_COMP(rx, NONULL(pattern.data), ((data & MUTT_CRYPT_HOOK) ? REG_ICASE : 0));
if (rc != 0)
{
regerror(rc, rx, err->data, err->dsize);
s++;
SKIPWS(s);
const char *flag_word = s;
- while (*s && (*s != ')') && !ISSPACE(*s))
+ while (*s && (*s != ')') && !IS_SPACE(*s))
s++;
const char ctmp = *s;
*s = '\0';
#define IMAP_CMD_RESPOND 2 ///< `+`
#define IMAP_CMD_NEW 3 ///< ImapCommand.state additions
-#define IMAP_CACHE_LEN 10 ///< number of entries in the hash table */
-
-#define SEQLEN 5
+#define SEQ_LEN 5
#define IMAP_MAX_CMDLEN 1024 ///< Maximum length of command lines before they must be split (for lazy servers)
typedef uint8_t ImapOpenFlags; ///< Flags, e.g. #MUTT_THREAD_COLLAPSE
*/
struct ImapCommand
{
- char seq[SEQLEN + 1]; ///< Command tag, e.g. 'a0001'
+ char seq[SEQ_LEN + 1]; ///< Command tag, e.g. 'a0001'
int state; ///< Command state, e.g. #IMAP_CMD_NEW
};
char *flag_word = s;
bool is_system_keyword = mutt_str_startswith(s, "\\", CASE_IGNORE);
- while (*s && !ISSPACE(*s) && (*s != ')'))
+ while (*s && !IS_SPACE(*s) && (*s != ')'))
s++;
ctmp = *s;
{
mutt_debug(LL_DEBUG1, "#1 command failed: %s\n", adata->buf);
- char *pc = adata->buf + SEQLEN;
+ char *pc = adata->buf + SEQ_LEN;
SKIPWS(pc);
pc = imap_next_word(pc);
mutt_error("%s", pc);
if (!imap_code(adata->buf))
{
mutt_debug(LL_DEBUG1, "#2 command failed: %s\n", adata->buf);
- char *pc = adata->buf + SEQLEN;
+ char *pc = adata->buf + SEQ_LEN;
SKIPWS(pc);
pc = imap_next_word(pc);
mutt_error("%s", pc);
}
if (*s == '\"')
quoted = quoted ? 0 : 1;
- if (!quoted && ISSPACE(*s))
+ if (!quoted && IS_SPACE(*s))
break;
s++;
}
char buf[1024];
menu_status_line(buf, sizeof(buf), menu, NONULL(C_StatusFormat));
mutt_window_move(MuttStatusWindow, 0, 0);
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_draw_statusline(MuttStatusWindow->cols, buf, sizeof(buf));
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
* avoid cyclic sourcing */
static struct ListHead MuttrcStack = STAILQ_HEAD_INITIALIZER(MuttrcStack);
-#define MAXERRS 128
+#define MAX_ERRS 128
-#define NUMVARS mutt_array_size(MuttVars)
-#define NUMCOMMANDS mutt_array_size(Commands)
+#define NUM_VARS mutt_array_size(MuttVars)
+#define NUM_COMMANDS mutt_array_size(Commands)
/* Initial string that starts completion. No telling how much the user has
* typed so far. Allocate 1024 just to be sure! */
static char Completed[256] = { 0 }; /* completed string (command or variable) */
static const char **Matches;
/* this is a lie until mutt_init runs: */
-static int MatchesListsize = MAX(NUMVARS, NUMCOMMANDS) + 10;
+static int MatchesListsize = MAX(NUM_VARS, NUM_COMMANDS) + 10;
#ifdef USE_NOTMUCH
/* List of tags found in last call to mutt_nm_query_complete(). */
if (current <= (MatchesListsize - 2))
return;
- int base_space = MAX(NUMVARS, NUMCOMMANDS) + 1;
+ int base_space = MAX(NUM_VARS, NUM_COMMANDS) + 1;
int extra_space = MatchesListsize - base_space;
extra_space *= 2;
const int space = base_space + extra_space;
tmpminor[len + 2] = '\0';
a->major_int = mutt_check_mime_type(a->major);
- ret = REGCOMP(&a->minor_regex, tmpminor, REG_ICASE);
+ ret = REG_COMP(&a->minor_regex, tmpminor, REG_ICASE);
FREE(&tmpminor);
if (line_rc == MUTT_CMD_ERROR)
{
mutt_error(_("Error in %s, line %d: %s"), rcfile, line, err->data);
- if (--rc < -MAXERRS)
+ if (--rc < -MAX_ERRS)
{
if (conv)
FREE(¤tline);
{
/* the neomuttrc source keyword */
mutt_buffer_reset(err);
- mutt_buffer_printf(err, (rc >= -MAXERRS) ? _("source: errors in %s") : _("source: reading aborted due to too many errors in %s"),
+ mutt_buffer_printf(err, (rc >= -MAX_ERRS) ? _("source: errors in %s") : _("source: reading aborted due to too many errors in %s"),
rcfile);
rc = -1;
}
{
if (!qc)
{
- if ((ISSPACE(ch) && !(flags & MUTT_TOKEN_SPACE)) ||
+ if ((IS_SPACE(ch) && !(flags & MUTT_TOKEN_SPACE)) ||
((ch == '#') && !(flags & MUTT_TOKEN_COMMENT)) ||
((ch == '=') && (flags & MUTT_TOKEN_EQUAL)) ||
((ch == '?') && (flags & MUTT_TOKEN_QUESTION)) ||
char *end_char = NULL;
long int result = strtol(s + 1, &end_char, 8);
/* allow trailing whitespace, eg. < 1001 > */
- while (ISSPACE(*end_char))
+ while (IS_SPACE(*end_char))
end_char++;
/* negative keycodes don't make sense, also detect overflow */
if ((*end_char != '>') || (result < 0) || (result == LONG_MAX))
/* Combining tree fg color and another bg color requires
* having use_default_colors, because the other bg color
* may be undefined. */
- ATTRSET(mutt_combine_color(ColorDefs[MT_COLOR_TREE], attr));
+ ATTR_SET(mutt_combine_color(ColorDefs[MT_COLOR_TREE], attr));
#else
- SETCOLOR(MT_COLOR_TREE);
+ SET_COLOR(MT_COLOR_TREE);
#endif
while (*s && (*s < MUTT_TREE_MAX))
n--;
}
if (do_color)
- ATTRSET(attr);
+ ATTR_SET(attr);
}
else if (*s == MUTT_SPECIAL_INDEX)
{
if (C_Help)
{
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_window_move(menu->helpwin, 0, 0);
mutt_paddstr(menu->helpwin->cols, menu->help);
NORMAL_COLOR;
char buf[256];
snprintf(buf, sizeof(buf), "-- NeoMutt: %s", menu->title);
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_window_move(menu->statuswin, 0, 0);
mutt_paddstr(menu->statuswin->cols, buf);
NORMAL_COLOR;
menu_make_entry(buf, sizeof(buf), menu, i);
menu_pad_string(menu, buf, sizeof(buf));
- ATTRSET(attr);
+ ATTR_SET(attr);
mutt_window_move(menu->indexwin, i - menu->top + menu->offset, 0);
do_color = true;
if (i == menu->current)
{
- SETCOLOR(MT_COLOR_INDICATOR);
+ SET_COLOR(MT_COLOR_INDICATOR);
if (C_ArrowCursor)
{
addstr("->");
- ATTRSET(attr);
+ ATTR_SET(attr);
addch(' ');
}
else
* position the cursor for drawing. */
const int old_color = menu->menu_color(menu->oldcurrent);
mutt_window_move(menu->indexwin, menu->oldcurrent + menu->offset - menu->top, 0);
- ATTRSET(old_color);
+ ATTR_SET(old_color);
if (C_ArrowCursor)
{
}
/* now draw it in the new location */
- SETCOLOR(MT_COLOR_INDICATOR);
+ SET_COLOR(MT_COLOR_INDICATOR);
mutt_window_mvaddstr(menu->indexwin, menu->current + menu->offset - menu->top, 0, "->");
}
else
const int cur_color = menu->menu_color(menu->current);
menu_make_entry(buf, sizeof(buf), menu, menu->current);
menu_pad_string(menu, buf, sizeof(buf));
- SETCOLOR(MT_COLOR_INDICATOR);
+ SET_COLOR(MT_COLOR_INDICATOR);
mutt_window_move(menu->indexwin, menu->current + menu->offset - menu->top, 0);
print_enriched_string(menu->current, cur_color, (unsigned char *) buf, 0);
}
menu_make_entry(buf, sizeof(buf), menu, menu->current);
menu_pad_string(menu, buf, sizeof(buf));
- SETCOLOR(MT_COLOR_INDICATOR);
+ SET_COLOR(MT_COLOR_INDICATOR);
if (C_ArrowCursor)
{
addstr("->");
- ATTRSET(attr);
+ ATTR_SET(attr);
addch(' ');
menu_pad_string(menu, buf, sizeof(buf));
print_enriched_string(menu->current, attr, (unsigned char *) buf, 1);
if (search_buf)
{
int flags = mutt_mb_is_lower(search_buf) ? REG_ICASE : 0;
- rc = REGCOMP(&re, search_buf, REG_NOSUB | flags);
+ rc = REG_COMP(&re, search_buf, REG_NOSUB | flags);
}
if (rc != 0)
regex_t minor_regex;
};
-#define EXECSHELL "/bin/sh"
+#define EXEC_SHELL "/bin/sh"
char *mutt_compile_help(char *buf, size_t buflen, int menu, const struct Mapping *items);
return false;
regex_t *rx = mutt_mem_malloc(sizeof(regex_t));
- int rc = REGCOMP(rx, pat, REG_ICASE);
+ int rc = REG_COMP(rx, pat, REG_ICASE);
if (rc != 0)
{
regerror(rc, rx, err->data, err->dsize);
*/
bool mutt_date_is_day_name(const char *s)
{
- if ((strlen(s) < 3) || !*(s + 3) || !ISSPACE(*(s + 3)))
+ if ((strlen(s) < 3) || !*(s + 3) || !IS_SPACE(*(s + 3)))
return false;
for (int i = 0; i < mutt_array_size(Weekdays); i++)
#include "memory.h"
#include "string2.h"
-#define SOMEPRIME 149711
+#define SOME_PRIME 149711
/**
* gen_string_hash - Generate a hash from a string
while (*s)
h += ((h << 7) + *s++);
- h = (h * SOMEPRIME) % n;
+ h = (h * SOME_PRIME) % n;
return h;
}
while (*s)
h += ((h << 7) + tolower(*s++));
- h = (h * SOMEPRIME) % n;
+ h = (h * SOME_PRIME) % n;
return h;
}
#define SWAP(n) (n)
#endif
-#define BLOCKSIZE 4096
-
/* This array contains the bytes used to pad the buffer to the next
* 64-byte boundary. (RFC1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
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)
+ if (REG_COMP(rx->regex, NONULL(str), flags) != 0)
mutt_regex_free(&rx);
return rx;
str++;
}
- int rc = REGCOMP(reg->regex, str, rflags);
+ int rc = REG_COMP(reg->regex, str, rflags);
if ((rc != 0) && err)
{
regerror(rc, reg->regex, err->data, err->dsize);
#endif
/**
- * REGCOMP - Compile a regular expression
+ * REG_COMP - Compile a regular expression
* @param preg regex_t struct to fill
* @param regex Regular expression string
* @param cflags Flags
* @retval 0 Success
* @retval num Failure, e.g. REG_BADPAT
*/
-#define REGCOMP(preg, regex, cflags) regcomp(preg, regex, REG_WORDS | REG_EXTENDED | (cflags))
+#define REG_COMP(preg, regex, cflags) regcomp(preg, regex, REG_WORDS | REG_EXTENDED | (cflags))
/**
* struct Regex - Cached regular expression
void mutt_sha1_transform(uint32_t state[5], const unsigned char buffer[64]);
void mutt_sha1_update(struct Sha1Ctx *sha1ctx, const unsigned char *data, uint32_t len);
-#define SHA_DIGEST_LENGTH 20
-
#endif /* MUTT_LIB_SHA1_H */
*/
void mutt_str_remove_trailing_ws(char *s)
{
- for (char *p = s + mutt_str_strlen(s) - 1; (p >= s) && ISSPACE(*p); p--)
+ for (char *p = s + mutt_str_strlen(s) - 1; (p >= s) && IS_SPACE(*p); p--)
*p = '\0';
}
*/
const char *mutt_str_next_word(const char *s)
{
- while (*s && !ISSPACE(*s))
+ while (*s && !IS_SPACE(*s))
s++;
SKIPWS(s);
return s;
int i;
for (i = 0; i < (sizeof(tmp) - 2); i++, b++)
{
- if (!*b || ISSPACE(*b))
+ if (!*b || IS_SPACE(*b))
{
tmp[i] = '\0';
break;
#define STR_COMMAND 8192 ///< Enough space for a long command line
#define NONULL(x) ((x) ? (x) : "")
-#define ISSPACE(ch) isspace((unsigned char) ch)
+#define IS_SPACE(ch) isspace((unsigned char) ch)
#define EMAIL_WSP " \t\r\n"
/* Exit values */
};
typedef uint8_t MuttAccountFlags; ///< Flags, Which ConnAccount fields are initialised, e.g. #MUTT_ACCT_PORT
-#define MUTT_ACCT__NO_FLAGS 0 ///< No flags are set
+#define MUTT_ACCT_NO_FLAGS 0 ///< No flags are set
#define MUTT_ACCT_PORT (1 << 0) ///< Port field has been set
#define MUTT_ACCT_USER (1 << 1) ///< User field has been set
#define MUTT_ACCT_LOGIN (1 << 2) ///< Login field has been set
* right column.
*/
#ifdef HAVE_BKGDSET
-#define SETCOLOR(X) \
+#define SET_COLOR(X) \
do \
{ \
if (ColorDefs[X] != 0) \
else \
bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' '); \
} while (false)
-#define ATTRSET(X) bkgdset(X | ' ')
+#define ATTR_SET(X) bkgdset(X | ' ')
#else
-#define SETCOLOR(X) \
+#define SET_COLOR(X) \
do \
{ \
if (ColorDefs[X] != 0) \
else \
attrset(ColorDefs[MT_COLOR_NORMAL]); \
} while (false)
-#define ATTRSET attrset
+#define ATTR_SET attrset
#endif
/* reset the color to the normal terminal color as defined by 'color normal ...' */
{
if (level == LL_ERROR)
BEEP();
- SETCOLOR((level == LL_ERROR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
+ SET_COLOR((level == LL_ERROR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
mutt_window_mvaddstr(MuttMessageWindow, 0, 0, ErrorBuf);
NORMAL_COLOR;
mutt_window_clrtoeol(MuttMessageWindow);
{
mutt_save_path(buf, buflen, a);
for (char *p = buf; *p; p++)
- if ((*p == '/') || ISSPACE(*p) || !IsPrint((unsigned char) *p))
+ if ((*p == '/') || IS_SPACE(*p) || !IsPrint((unsigned char) *p))
*p = '_';
}
#include <stdlib.h>
#include "mutt/mutt.h"
-#define CHUNKSIZE 1024 /**< Amount of data to read at once */
+#define CHUNK_SIZE 1024 /**< Amount of data to read at once */
static unsigned char *pbuf = NULL; /**< Cache PGP data packet */
static size_t plen = 0; /**< Length of cached packet */
{
if (*used + material >= plen)
{
- size_t nplen = *used + material + CHUNKSIZE;
+ size_t nplen = *used + material + CHUNK_SIZE;
unsigned char *p = realloc(pbuf, nplen);
if (!p)
if (plen == 0)
{
- plen = CHUNKSIZE;
+ plen = CHUNK_SIZE;
pbuf = mutt_mem_malloc(plen);
}
anum_t nb = nntp_edata_get(*eb)->article_num;
int result = (na == nb) ? 0 : (na > nb) ? 1 : -1;
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
struct Regex *C_Smileys; ///< Config: Regex to match smileys to prevent mistakes when quoting text
bool C_Tilde; ///< Config: Character to pad blank lines in the pager
-#define ISHEADER(x) ((x) == MT_COLOR_HEADER || (x) == MT_COLOR_HDEFAULT)
+#define IS_HEADER(x) ((x) == MT_COLOR_HEADER || (x) == MT_COLOR_HDEFAULT)
#define IsAttach(pager) (pager && (pager)->body)
#define IsMsgAttach(pager) \
/* check for a blank line */
while (*s)
{
- if (!ISSPACE(*s))
+ if (!IS_SPACE(*s))
return 0;
s++;
}
{
if (!cnt && C_Markers)
{
- SETCOLOR(MT_COLOR_MARKERS);
+ SET_COLOR(MT_COLOR_MARKERS);
addch('+');
last_color = ColorDefs[MT_COLOR_MARKERS];
}
if (color != last_color)
{
- ATTRSET(color);
+ ATTR_SET(color);
last_color = color;
}
}
bool null_rx;
int offset, i = 0;
- if ((n == 0) || ISHEADER(line_info[n - 1].type) ||
+ if ((n == 0) || IS_HEADER(line_info[n - 1].type) ||
(check_protected_header_marker(raw) == 0))
{
if (buf[0] == '\n') /* end of header */
/* move the break point only if smart_wrap is set */
if (C_SmartWrap)
{
- if ((cnt < b_read) && (ch != -1) && !ISHEADER((*line_info)[n].type) &&
- !ISSPACE(buf[cnt]))
+ if ((cnt < b_read) && (ch != -1) && !IS_HEADER((*line_info)[n].type) &&
+ !IS_SPACE(buf[cnt]))
{
buf_ptr = buf + ch;
/* skip trailing blanks */
else
def_color = ColorDefs[(*line_info)[m].type];
- ATTRSET(def_color);
+ ATTR_SET(def_color);
}
if (col < pager_window->cols)
if (C_Help)
{
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_window_move(MuttHelpWindow, 0, 0);
mutt_paddstr(MuttHelpWindow->cols, rd->helpstr);
NORMAL_COLOR;
if (rd->search_compiled)
{
int flags = mutt_mb_is_lower(rd->searchbuf) ? REG_ICASE : 0;
- const int err = REGCOMP(&rd->search_re, rd->searchbuf, REG_NEWLINE | flags);
+ const int err = REG_COMP(&rd->search_re, rd->searchbuf, REG_NEWLINE | flags);
if (err != 0)
{
regerror(err, &rd->search_re, buf, sizeof(buf));
rd->last_offset = rd->line_info[rd->curline].offset;
} while (rd->force_redraw);
- SETCOLOR(MT_COLOR_TILDE);
+ SET_COLOR(MT_COLOR_TILDE);
while (rd->lines < rd->pager_window->rows)
{
mutt_window_clrtoeol(rd->pager_window);
/* print out the pager status bar */
mutt_window_move(rd->pager_status_window, 0, 0);
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
if (IsEmail(rd->extra) || IsMsgAttach(rd->extra))
{
menu_status_line(buf, sizeof(buf), rd->index, NONULL(C_StatusFormat));
mutt_window_move(rd->index_status_window, 0, 0);
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_draw_statusline(rd->index_status_window->cols, buf, sizeof(buf));
NORMAL_COLOR;
}
}
int rflags = mutt_mb_is_lower(searchbuf) ? REG_ICASE : 0;
- int err = REGCOMP(&rd.search_re, searchbuf, REG_NEWLINE | rflags);
+ int err = REG_COMP(&rd.search_re, searchbuf, REG_NEWLINE | rflags);
if (err != 0)
{
regerror(err, &rd.search_re, buf, sizeof(buf));
int new_topline = rd.topline;
/* Skip all the email headers */
- if (ISHEADER(rd.line_info[new_topline].type))
+ if (IS_HEADER(rd.line_info[new_topline].type))
{
while (((new_topline < rd.last_line) ||
(0 == (dretval = display_line(
&rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP),
&rd.quote_list, &rd.q_level, &rd.force_redraw,
&rd.search_re, rd.pager_window)))) &&
- ISHEADER(rd.line_info[new_topline].type))
+ IS_HEADER(rd.line_info[new_topline].type))
{
new_topline++;
}
{
pat->p.regex = mutt_mem_malloc(sizeof(regex_t));
int flags = mutt_mb_is_lower(buf.data) ? REG_ICASE : 0;
- int rc = REGCOMP(pat->p.regex, buf.data, REG_NEWLINE | REG_NOSUB | flags);
+ int rc = REG_COMP(pat->p.regex, buf.data, REG_NEWLINE | REG_NOSUB | flags);
if (rc != 0)
{
char errmsg[256];
if (l < w)
{
/* The string fits within the colour bar */
- SETCOLOR(MT_COLOR_PROGRESS);
+ SET_COLOR(MT_COLOR_PROGRESS);
addstr(buf2);
w -= l;
while (w-- > 0)
ch = buf2[off];
buf2[off] = '\0';
- SETCOLOR(MT_COLOR_PROGRESS);
+ SET_COLOR(MT_COLOR_PROGRESS);
addstr(buf2);
buf2[off] = ch;
NORMAL_COLOR;
break; \
}
-#define CURATTACH actx->idx[actx->v2r[menu->current]]
+#define CUR_ATTACH actx->idx[actx->v2r[menu->current]]
static const struct Mapping AttachHelp[] = {
{ N_("Exit"), OP_EXIT }, { N_("Save"), OP_SAVE }, { N_("Pipe"), OP_PIPE },
static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
{
if (!menu->tagprefix)
- crypt_pgp_extract_key_from_attachment(CURATTACH->fp, CURATTACH->content);
+ crypt_pgp_extract_key_from_attachment(CUR_ATTACH->fp, CUR_ATTACH->content);
else
{
for (int i = 0; i < actx->idxlen; i++)
int rc = 0;
if (!menu->tagprefix)
- rc = crypt_pgp_check_traditional(CURATTACH->fp, CURATTACH->content, true);
+ rc = crypt_pgp_check_traditional(CUR_ATTACH->fp, CUR_ATTACH->content, true);
else
{
for (int i = 0; i < actx->idxlen; i++)
static void recvattach_edit_content_type(struct AttachCtx *actx,
struct Menu *menu, struct Email *e)
{
- if (!mutt_edit_content_type(e, CURATTACH->content, CURATTACH->fp))
+ if (!mutt_edit_content_type(e, CUR_ATTACH->content, CUR_ATTACH->fp))
return;
/* The mutt_update_recvattach_menu() will overwrite any changes
- * made to a decrypted CURATTACH->content, so warn the user. */
- if (CURATTACH->decrypted)
+ * made to a decrypted CUR_ATTACH->content, so warn the user. */
+ if (CUR_ATTACH->decrypted)
{
mutt_message(
_("Structural changes to decrypted attachments are not supported"));
/* fallthrough */
case OP_VIEW_ATTACH:
- op = mutt_view_attachment(CURATTACH->fp, CURATTACH->content,
+ op = mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content,
MUTT_VA_REGULAR, e, actx);
break;
case OP_EDIT_TYPE:
/* when we edit the content-type, we should redisplay the attachment
* immediately */
- mutt_edit_content_type(e, CURATTACH->content, CURATTACH->fp);
+ mutt_edit_content_type(e, CUR_ATTACH->content, CUR_ATTACH->fp);
if (recv)
recvattach_edit_content_type(actx, menu, e);
else
- mutt_edit_content_type(e, CURATTACH->content, CURATTACH->fp);
+ mutt_edit_content_type(e, CUR_ATTACH->content, CUR_ATTACH->fp);
menu->redraw |= REDRAW_INDEX;
op = OP_VIEW_ATTACH;
{
int rindex, curlevel;
- CURATTACH->content->collapsed = !CURATTACH->content->collapsed;
+ CUR_ATTACH->content->collapsed = !CUR_ATTACH->content->collapsed;
/* When expanding, expand all the children too */
- if (CURATTACH->content->collapsed)
+ if (CUR_ATTACH->content->collapsed)
return;
- curlevel = CURATTACH->level;
+ curlevel = CUR_ATTACH->level;
rindex = actx->v2r[menu->current] + 1;
while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel))
switch (op)
{
case OP_ATTACH_VIEW_MAILCAP:
- mutt_view_attachment(CURATTACH->fp, CURATTACH->content, MUTT_VA_MAILCAP, e, actx);
+ mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content, MUTT_VA_MAILCAP, e, actx);
menu->redraw = REDRAW_FULL;
break;
case OP_ATTACH_VIEW_TEXT:
- mutt_view_attachment(CURATTACH->fp, CURATTACH->content, MUTT_VA_AS_TEXT, e, actx);
+ mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content, MUTT_VA_AS_TEXT, e, actx);
menu->redraw = REDRAW_FULL;
break;
continue;
case OP_ATTACH_COLLAPSE:
- if (!CURATTACH->content->parts)
+ if (!CUR_ATTACH->content->parts)
{
mutt_error(_("There are no subparts to show"));
break;
break;
case OP_PRINT:
- mutt_print_attachment_list(actx, CURATTACH->fp, menu->tagprefix,
- CURATTACH->content);
+ mutt_print_attachment_list(actx, CUR_ATTACH->fp, menu->tagprefix,
+ CUR_ATTACH->content);
break;
case OP_PIPE:
- mutt_pipe_attachment_list(actx, CURATTACH->fp, menu->tagprefix,
- CURATTACH->content, false);
+ mutt_pipe_attachment_list(actx, CUR_ATTACH->fp, menu->tagprefix,
+ CUR_ATTACH->content, false);
break;
case OP_SAVE:
- mutt_save_attachment_list(actx, CURATTACH->fp, menu->tagprefix,
- CURATTACH->content, e, menu);
+ mutt_save_attachment_list(actx, CUR_ATTACH->fp, menu->tagprefix,
+ CUR_ATTACH->content, e, menu);
if (!menu->tagprefix && C_Resolve && (menu->current < menu->max - 1))
menu->current++;
}
if (!menu->tagprefix)
{
- if (CURATTACH->parent_type == TYPE_MULTIPART)
+ if (CUR_ATTACH->parent_type == TYPE_MULTIPART)
{
- CURATTACH->content->deleted = true;
+ CUR_ATTACH->content->deleted = true;
if (C_Resolve && (menu->current < menu->max - 1))
{
menu->current++;
CHECK_READONLY;
if (!menu->tagprefix)
{
- CURATTACH->content->deleted = false;
+ CUR_ATTACH->content->deleted = false;
if (C_Resolve && (menu->current < menu->max - 1))
{
menu->current++;
case OP_RESEND:
CHECK_ATTACH;
- mutt_attach_resend(CURATTACH->fp, actx,
- menu->tagprefix ? NULL : CURATTACH->content);
+ mutt_attach_resend(CUR_ATTACH->fp, actx,
+ menu->tagprefix ? NULL : CUR_ATTACH->content);
menu->redraw = REDRAW_FULL;
break;
case OP_BOUNCE_MESSAGE:
CHECK_ATTACH;
- mutt_attach_bounce(m, CURATTACH->fp, actx,
- menu->tagprefix ? NULL : CURATTACH->content);
+ mutt_attach_bounce(m, CUR_ATTACH->fp, actx,
+ menu->tagprefix ? NULL : CUR_ATTACH->content);
menu->redraw = REDRAW_FULL;
break;
case OP_FORWARD_MESSAGE:
CHECK_ATTACH;
- mutt_attach_forward(CURATTACH->fp, e, actx,
- menu->tagprefix ? NULL : CURATTACH->content, SEND_NO_FLAGS);
+ mutt_attach_forward(CUR_ATTACH->fp, e, actx,
+ menu->tagprefix ? NULL : CUR_ATTACH->content, SEND_NO_FLAGS);
menu->redraw = REDRAW_FULL;
break;
#ifdef USE_NNTP
case OP_FORWARD_TO_GROUP:
CHECK_ATTACH;
- mutt_attach_forward(CURATTACH->fp, e, actx,
- menu->tagprefix ? NULL : CURATTACH->content, SEND_NEWS);
+ mutt_attach_forward(CUR_ATTACH->fp, e, actx,
+ menu->tagprefix ? NULL : CUR_ATTACH->content, SEND_NEWS);
menu->redraw = REDRAW_FULL;
break;
case OP_FOLLOWUP:
CHECK_ATTACH;
- if (!CURATTACH->content->email->env->followup_to ||
- (mutt_str_strcasecmp(CURATTACH->content->email->env->followup_to, "poster") != 0) ||
+ if (!CUR_ATTACH->content->email->env->followup_to ||
+ (mutt_str_strcasecmp(CUR_ATTACH->content->email->env->followup_to, "poster") != 0) ||
(query_quadoption(C_FollowupToPoster,
_("Reply by mail as poster prefers?")) != MUTT_YES))
{
- mutt_attach_reply(CURATTACH->fp, e, actx,
- menu->tagprefix ? NULL : CURATTACH->content,
+ mutt_attach_reply(CUR_ATTACH->fp, e, actx,
+ menu->tagprefix ? NULL : CUR_ATTACH->content,
SEND_NEWS | SEND_REPLY);
menu->redraw = REDRAW_FULL;
break;
else if (op == OP_LIST_REPLY)
flags |= SEND_LIST_REPLY;
- mutt_attach_reply(CURATTACH->fp, e, actx,
- menu->tagprefix ? NULL : CURATTACH->content, flags);
+ mutt_attach_reply(CUR_ATTACH->fp, e, actx,
+ menu->tagprefix ? NULL : CUR_ATTACH->content, flags);
menu->redraw = REDRAW_FULL;
break;
}
case OP_COMPOSE_TO_SENDER:
CHECK_ATTACH;
- mutt_attach_mail_sender(CURATTACH->fp, e, actx,
- menu->tagprefix ? NULL : CURATTACH->content);
+ mutt_attach_mail_sender(CUR_ATTACH->fp, e, actx,
+ menu->tagprefix ? NULL : CUR_ATTACH->content);
menu->redraw = REDRAW_FULL;
break;
if (coords[i].r < MIX_MAXROW)
{
if (selected)
- SETCOLOR(MT_COLOR_INDICATOR);
+ SET_COLOR(MT_COLOR_INDICATOR);
else
NORMAL_COLOR;
*/
static void mix_redraw_head(struct MixChain *chain)
{
- SETCOLOR(MT_COLOR_STATUS);
+ SET_COLOR(MT_COLOR_STATUS);
mutt_window_mvprintw(MuttIndexWindow, MIX_VOFFSET - 1, 0,
"-- Remailer chain [Length: %d]", chain ? chain->cl : 0);
mutt_window_clrtoeol(MuttIndexWindow);
{
int i;
- if (chain->cl >= MAXMIXES)
+ if (chain->cl >= MAX_MIXES)
return -1;
if ((mutt_str_strcmp(s, "0") == 0) || (mutt_str_strcasecmp(s, "<random>") == 0))
case OP_GENERIC_SELECT_ENTRY:
case OP_MIX_APPEND:
{
- if ((chain->cl < MAXMIXES) && (c_cur < chain->cl))
+ if ((chain->cl < MAX_MIXES) && (c_cur < chain->cl))
c_cur++;
}
/* fallthrough */
case OP_MIX_INSERT:
{
- if (chain->cl < MAXMIXES)
+ if (chain->cl < MAX_MIXES)
{
chain->cl++;
for (int i = chain->cl - 1; i > c_cur; i--)
else
{
/* L10N The '%d' here hard-coded to 19 */
- mutt_error(_("Mixmaster chains are limited to %d elements"), MAXMIXES);
+ mutt_error(_("Mixmaster chains are limited to %d elements"), MAX_MIXES);
}
break;
extern char *C_Mixmaster;
/* Mixmaster's maximum chain length. Don't change this. */
-#define MAXMIXES 19
+#define MAX_MIXES 19
typedef uint8_t MixCapFlags; ///< Flags, e.g. #MIX_CAP_NO_FLAGS
#define MIX_CAP_NO_FLAGS 0 ///< No flags are set
struct MixChain
{
size_t cl;
- int ch[MAXMIXES];
+ int ch[MAX_MIXES];
};
int mix_send_message(struct ListHead *chain, const char *tempfile);
}
*p++ = 0;
- for (q = p; *q && !ISSPACE(*q); q++)
+ for (q = p; *q && !IS_SPACE(*q); q++)
;
mutt_str_substr_cpy(subtype, p, q, sizeof(subtype));
if (delim_len > num_cols)
return 0;
- SETCOLOR(MT_COLOR_DIVIDER);
+ SET_COLOR(MT_COLOR_DIVIDER);
int col = C_SidebarOnRight ? 0 : (C_SidebarWidth - delim_len);
if (entryidx == OpnIndex)
{
if ((ColorDefs[MT_COLOR_SB_INDICATOR] != 0))
- SETCOLOR(MT_COLOR_SB_INDICATOR);
+ SET_COLOR(MT_COLOR_SB_INDICATOR);
else
- SETCOLOR(MT_COLOR_INDICATOR);
+ SET_COLOR(MT_COLOR_INDICATOR);
}
else if (entryidx == HilIndex)
- SETCOLOR(MT_COLOR_HIGHLIGHT);
+ SET_COLOR(MT_COLOR_HIGHLIGHT);
else if ((m->msg_unread > 0) || (m->has_new))
- SETCOLOR(MT_COLOR_NEW);
+ SET_COLOR(MT_COLOR_NEW);
else if (m->msg_flagged > 0)
- SETCOLOR(MT_COLOR_FLAGGED);
+ SET_COLOR(MT_COLOR_FLAGGED);
else if ((ColorDefs[MT_COLOR_SB_SPOOLFILE] != 0) &&
(mutt_str_strcmp(m->path, C_Spoolfile) == 0))
{
- SETCOLOR(MT_COLOR_SB_SPOOLFILE);
+ SET_COLOR(MT_COLOR_SB_SPOOLFILE);
}
else
{
if (ColorDefs[MT_COLOR_ORDINARY] != 0)
- SETCOLOR(MT_COLOR_ORDINARY);
+ SET_COLOR(MT_COLOR_ORDINARY);
else
NORMAL_COLOR;
}
struct Email **pb = (struct Email **) b;
int result = (*pb)->score - (*pa)->score; /* note that this is reverse */
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
struct Email **pb = (struct Email **) b;
int result = (*pa)->content->length - (*pb)->content->length;
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
struct Email **pb = (struct Email **) b;
int result = (*pa)->date_sent - (*pb)->date_sent;
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
else
rc = mutt_str_strcasecmp((*pa)->env->real_subj, (*pb)->env->real_subj);
rc = perform_auxsort(rc, a, b);
- return SORTCODE(rc);
+ return SORT_CODE(rc);
}
/**
const char *fb = mutt_get_name((*ppb)->env->to);
int result = mutt_str_strncasecmp(fa, fb, sizeof(fa));
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
const char *fb = mutt_get_name((*ppb)->env->from);
int result = mutt_str_strncasecmp(fa, fb, sizeof(fa));
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
struct Email **pb = (struct Email **) b;
int result = (*pa)->received - (*pb)->received;
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
struct Email **eb = (struct Email **) b;
/* no need to auxsort because you will never have equality here */
- return SORTCODE((*ea)->index - (*eb)->index);
+ return SORT_CODE((*ea)->index - (*eb)->index);
}
/**
/* If one msg has spam attr but other does not, sort the one with first. */
if (ahas && !bhas)
- return SORTCODE(1);
+ return SORT_CODE(1);
if (!ahas && bhas)
- return SORTCODE(-1);
+ return SORT_CODE(-1);
/* Else, if neither has a spam attr, presume equality. Fall back on aux. */
if (!ahas && !bhas)
{
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/* Both have spam attrs. */
/* 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(strcmp(aptr, bptr));
+ return SORT_CODE(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 */
result = perform_auxsort(result, a, b);
}
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
/* First we bias toward a message with a label, if the other does not. */
if (ahas && !bhas)
- return SORTCODE(-1);
+ return SORT_CODE(-1);
if (!ahas && bhas)
- return SORTCODE(1);
+ return SORT_CODE(1);
/* If neither has a label, use aux sort. */
if (!ahas && !bhas)
{
result = perform_auxsort(result, a, b);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/* If both have a label, we just do a lexical compare. */
result = mutt_str_strcasecmp((*ppa)->env->x_label, (*ppb)->env->x_label);
- return SORTCODE(result);
+ return SORT_CODE(result);
}
/**
/* These Config Variables are only used in sort.c */
extern bool C_ReverseAlias;
-#define SORTCODE(x) ((OptAuxSort ? C_SortAux : C_Sort) & SORT_REVERSE) ? -(x) : x
+#define SORT_CODE(x) ((OptAuxSort ? C_SortAux : C_Sort) & SORT_REVERSE) ? -(x) : x
/**
* typedef sort_t - Prototype for a function to compare two emails
sigaction(SIGTSTP, &act, NULL);
sigaction(SIGCONT, &act, NULL);
- execle(EXECSHELL, "sh", "-c", cmd, NULL, mutt_envlist_getlist());
+ execle(EXEC_SHELL, "sh", "-c", cmd, NULL, mutt_envlist_getlist());
_exit(127); /* execl error */
}
else if (pid != -1)
{
if (!qc)
{
- if ((ISSPACE(ch) && !(flags & MUTT_TOKEN_SPACE)) ||
+ if ((IS_SPACE(ch) && !(flags & MUTT_TOKEN_SPACE)) ||
((ch == '#') && !(flags & MUTT_TOKEN_COMMENT)) ||
((ch == '=') && (flags & MUTT_TOKEN_EQUAL)) ||
((ch == '?') && (flags & MUTT_TOKEN_QUESTION)) ||