C99 has <stdbool.h> which defines true and false.
Closes #291
return 0;
}
-/* returns TRUE if the given address belongs to the user. */
+/* returns true if the given address belongs to the user. */
int mutt_addr_is_user (ADDRESS *addr)
{
const char *fqdn;
{
char command[_POSIX_PATH_MAX+STRING];
rfc1524_entry *entry;
- int piped = FALSE;
+ int piped = false;
dprint (2, (debugfile, "Using mailcap...\n"));
case 'D':
if (folder->ff->local)
{
- int do_locales = TRUE;
+ int do_locales = true;
if (op == 'D') {
t_fmt = NONULL(DateFmt);
if (*t_fmt == '!') {
++t_fmt;
- do_locales = FALSE;
+ do_locales = false;
}
} else {
tnow = time (NULL);
mutt_error (_("Error running \"%s\"!"), buf);
unlink (tempfile);
if (!option (OPTNOCURSES))
- keypad (stdscr, TRUE);
+ keypad (stdscr, true);
if (r != -1)
mutt_set_flag (Context, cur, MUTT_READ, 1);
if (r != -1 && option (OPTPROMPTAFTER))
#ifdef USE_NOTMUCH
if (Context->magic == MUTT_NOTMUCH)
- nm_longrun_init(Context, TRUE);
+ nm_longrun_init(Context, true);
#endif
for (i = 0; i < Context->vcount; i++)
{
hdr_count = 1;
x = 0;
- error = FALSE;
+ error = false;
/* We are going to read and collect the headers in an array
* so we are able to do re-ordering.
flags & CH_PREFIX ? prefix : 0,
mutt_window_wrap_cols (MuttIndexWindow, Wrap), flags) == -1)
{
- error = TRUE;
+ error = true;
break;
}
}
{
if (fputs (headers[x], out) == EOF)
{
- error = TRUE;
+ error = true;
break;
}
}
customize this is of course the Mutt way. */
void mutt_need_hard_redraw (void)
{
- keypad (stdscr, TRUE);
- clearok (stdscr, TRUE);
+ keypad (stdscr, true);
+ clearok (stdscr, true);
set_option (OPTNEEDREDRAW);
}
/* the terminal may have been resized while the editor owned it */
mutt_resize_screen ();
#endif
- keypad (stdscr, TRUE);
- clearok (stdscr, TRUE);
+ keypad (stdscr, true);
+ clearok (stdscr, true);
}
int mutt_yesorno (const char *msg, int def)
/* If XT (boolean) is set, then this terminal supports the standard escape. */
/* Beware: tigetflag returns -1 if XT is invalid or not a boolean. */
#ifdef HAVE_USE_EXTENDED_NAMES
- use_extended_names (TRUE);
+ use_extended_names (true);
tcapi = tigetflag("XT");
if (tcapi == 1)
return 1;
* force a real complete redraw. clrtobot() doesn't seem to be able
* to handle every case without this.
*/
- clearok(stdscr,TRUE);
+ clearok(stdscr,true);
continue;
}
#endif
case OP_REDRAW:
- clearok (stdscr, TRUE);
+ clearok (stdscr, true);
menu->redraw = REDRAW_FULL;
break;
if (tag) {
for (j = 0; j < Context->vcount; j++) {
if (Context->hdrs[Context->v2r[j]]->tagged) {
- Context->hdrs[Context->v2r[j]]->quasi_deleted = TRUE;
- Context->changed = TRUE;
+ Context->hdrs[Context->v2r[j]]->quasi_deleted = true;
+ Context->changed = true;
}
}
} else {
- CURHDR->quasi_deleted = TRUE;
+ CURHDR->quasi_deleted = true;
Context->changed = 1;
}
break;
mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG,
1, Context->tagged);
}
- nm_longrun_init(Context, TRUE);
+ nm_longrun_init(Context, true);
for (px = 0, j = 0; j < Context->vcount; j++) {
if (Context->hdrs[Context->v2r[j]]->tagged) {
if (!Context->quiet)
nm_modify_message_tags(Context, Context->hdrs[Context->v2r[j]], buf);
if (op == OP_MAIN_MODIFY_LABELS_THEN_HIDE)
{
- Context->hdrs[Context->v2r[j]]->quasi_deleted = TRUE;
- Context->changed = TRUE;
+ Context->hdrs[Context->v2r[j]]->quasi_deleted = true;
+ Context->changed = true;
}
}
}
}
if (op == OP_MAIN_MODIFY_LABELS_THEN_HIDE)
{
- CURHDR->quasi_deleted = TRUE;
- Context->changed = TRUE;
+ CURHDR->quasi_deleted = true;
+ Context->changed = true;
}
if (menu->menu == MENU_PAGER)
{
int i;
char *p;
- scrollok (stdscr, TRUE);
+ scrollok (stdscr, true);
be_edit_header (msg->env, 0);
FILE *fpin = NULL;
FILE *fpout = NULL;
FILE *fperr = NULL;
- int piped = FALSE;
+ int piped = false;
pid_t thepid;
int rc = 0;
* path of. Should be at least of PATH_MAX length, will contain the full result.
* - reference: path to a file which directory will be set as reference for setting
* up the absolute path.
- * Returns: TRUE (1) on success, FALSE (0) otherwise.
+ * Returns: true (1) on success, false (0) otherwise.
*/
static int to_absolute_path(char *path, const char *reference)
{
/* if path is already absolute, don't do anything */
if ((strlen(path) > 1) && (path[0] == '/'))
{
- return TRUE;
+ return true;
}
ref_tmp = strdup(reference);
if (!path)
{
printf("Error: issue converting path to absolute (%s)", strerror(errno));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
#define MAXERRS 128
memset (Matches, 0, Matches_listsize);
memset (Completed, 0, sizeof (Completed));
- nm_longrun_init(Context, FALSE);
+ nm_longrun_init(Context, false);
/* Work out how many tags there are. */
if (nm_get_all_tags(Context, NULL, &tag_count_1) || tag_count_1 == 0)
#ifdef NCURSES_VERSION
int j;
- use_extended_names(TRUE);
+ use_extended_names(true);
for (j = 0; KeyNames[j].name; ++j)
{
# include <time.h>
# include <limits.h>
# include <stdarg.h>
+# include <stdbool.h>
# include <signal.h>
# ifndef _POSIX_PATH_MAX
# define N_(a) a
# endif
-# define TRUE 1
-# define FALSE 0
-
# define HUGE_STRING 8192
# define LONG_STRING 1024
# define STRING 256
mutt_signal_init ();
#endif
ci_start_color ();
- keypad (stdscr, TRUE);
+ keypad (stdscr, true);
cbreak ();
noecho ();
nonl ();
typeahead (-1); /* simulate smooth scrolling */
#endif
#if HAVE_META
- meta (stdscr, TRUE);
+ meta (stdscr, true);
#endif
init_extended_keys();
mutt_reflow_windows ();
mutt_resize_screen ();
menu->redraw = REDRAW_FULL;
SigWinch = 0;
- clearok(stdscr,TRUE);/*force complete redraw*/
+ clearok(stdscr,true);/*force complete redraw*/
}
#endif
break;
case OP_REDRAW:
- clearok (stdscr, TRUE);
+ clearok (stdscr, true);
menu->redraw = REDRAW_FULL;
break;
#include <time.h>
#include <limits.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <signal.h>
/* On OS X 10.5.x, wide char functions are inlined by default breaking
* --without-wc-funcs compilation
#include "hash.h"
#include "charset.h"
+#ifndef __bool_true_false_are_defined
+# define boot int
+# define _Bool int
+# define false 0
+# define true (!false)
+# define __bool_true_false_are_defined 1
+#endif
+
#ifndef HAVE_WC_FUNCS
# ifdef MB_LEN_MAX
# undef MB_LEN_MAX
#include "globals.h"
#endif /*MUTT_H*/
+
+
+
+
const char *db_filename = get_db_filename(data);
if (db_filename)
- data->db = do_database_open(db_filename, writable, TRUE);
+ data->db = do_database_open(db_filename, writable, true);
}
return data->db;
}
notmuch_status_t st;
notmuch_filenames_t *ls;
notmuch_message_t *msg = NULL;
- notmuch_database_t *db = get_db(data, TRUE);
+ notmuch_database_t *db = get_db(data, true);
int trans;
dprint(2, (debugfile, "nm: remove filename '%s'\n", path));
notmuch_status_t st;
notmuch_filenames_t *ls;
notmuch_message_t *msg;
- notmuch_database_t *db = get_db(data, TRUE);
+ notmuch_database_t *db = get_db(data, true);
int trans;
if (!db || !new || !old || (access(new, F_OK) != 0))
if (!data)
return -1;
- if (!(db = get_db(data, FALSE)) || !(msg = get_nm_message(db, h)))
+ if (!(db = get_db(data, false)) || !(msg = get_nm_message(db, h)))
goto done;
dprint(1, (debugfile,
if (!buf || !*buf || !data)
return -1;
- if (!(db = get_db(data, TRUE)) || !(msg = get_nm_message(db, hdr)))
+ if (!(db = get_db(data, true)) || !(msg = get_nm_message(db, hdr)))
goto done;
dprint(1, (debugfile, "nm: tags modify: '%s'\n", buf));
mutt_set_header_color(ctx, hdr);
rc = 0;
- hdr->changed = TRUE;
+ hdr->changed = true;
done:
if (!is_longrun(data))
release_db(data);
/* don't be verbose about connection, as we're called from
* sidebar/buffy very often */
- db = do_database_open(db_filename, FALSE, FALSE);
+ db = do_database_open(db_filename, false, false);
if (!db)
goto done;
if (!path || !data || (access(path, F_OK) != 0))
return 0;
- db = get_db(data, TRUE);
+ db = get_db(data, true);
if (!db)
return -1;
if (!data)
return -1;
- if (!(db = get_db(data, FALSE)) ||
+ if (!(db = get_db(data, false)) ||
!(tags = notmuch_database_get_all_tags(db)))
goto done;
progress_reset(ctx);
- q = get_query(data, FALSE);
+ q = get_query(data, false);
if (q)
{
switch (get_query_type(data))
dprint(1, (debugfile, "nm: checking (db=%d ctx=%d)\n", mtime, ctx->mtime));
- q = get_query(data, FALSE);
+ q = get_query(data, false);
if (!q)
goto done;
static int nntp_fetch_lines (NNTP_DATA *nntp_data, char *query, size_t qlen,
char *msg, int (*funct) (char *, void *), void *data)
{
- int done = FALSE;
+ int done = false;
int rc;
while (!done)
{
if (buf[1] == '\0')
{
- done = TRUE;
+ done = true;
break;
}
if (buf[1] == '.')
char buf[LONG_STRING];
char *msg = _("Checking for new newsgroups...");
unsigned int i;
- int rc, update_active = FALSE;
+ int rc, update_active = false;
if (!nserv || !nserv->newgroups_time)
return -1;
if (rc < 0)
return -1;
if (rc > 0)
- update_active = TRUE;
+ update_active = true;
}
}
/* select current newsgroup */
mutt_progress_update (&progress, ++count, -1);
}
}
- update_active = TRUE;
+ update_active = true;
rc = 1;
}
if (update_active)
}
SigWinch = 0;
- clearok(stdscr,TRUE);/*force complete redraw*/
+ clearok(stdscr,true);/*force complete redraw*/
continue;
}
#endif
break;
case OP_REDRAW:
- clearok (stdscr, TRUE);
+ clearok (stdscr, true);
redraw = REDRAW_FULL;
break;
{
const char *pc = buffer.data;
- int haveMin = FALSE;
- int untilNow = FALSE;
+ int haveMin = false;
+ int untilNow = false;
if (isdigit ((unsigned char)*pc))
{
/* minimum date specified */
FREE (&buffer.data);
return (-1);
}
- haveMin = TRUE;
+ haveMin = true;
SKIPWS (pc);
if (*pc == '-')
{
SLsmg_reset_smg ();
SLsmg_init_smg ();
stdscr = newwin (0, 0, 0, 0);
- keypad (stdscr, TRUE);
+ keypad (stdscr, true);
#else
resizeterm (SLtt_Screen_Rows, SLtt_Screen_Cols);
#endif
char *command, int clen)
{
int x=0,y=0;
- int needspipe = TRUE;
+ int needspipe = true;
char buf[LONG_STRING];
char type[LONG_STRING];
else if (command[x] == 's' && filename != NULL)
{
y += mutt_quote_filename (buf + y, sizeof (buf) - y, filename);
- needspipe = FALSE;
+ needspipe = false;
}
else if (command[x] == 't')
{
size_t buflen;
char *ch;
char *field;
- int found = FALSE;
+ int found = false;
int copiousoutput;
int composecommand;
int editcommand;
/* find length of basetype */
if ((ch = strchr (type, '/')) == NULL)
- return FALSE;
+ return false;
btlen = ch - type;
if ((fp = fopen (filename, "r")) != NULL)
entry->command = safe_strdup (field);
/* parse the optional fields */
- found = TRUE;
- copiousoutput = FALSE;
- composecommand = FALSE;
- editcommand = FALSE;
- printcommand = FALSE;
+ found = true;
+ copiousoutput = false;
+ composecommand = false;
+ editcommand = false;
+ printcommand = false;
while (ch)
{
if (!ascii_strcasecmp (field, "needsterminal"))
{
if (entry)
- entry->needsterminal = TRUE;
+ entry->needsterminal = true;
}
else if (!ascii_strcasecmp (field, "copiousoutput"))
{
- copiousoutput = TRUE;
+ copiousoutput = true;
if (entry)
- entry->copiousoutput = TRUE;
+ entry->copiousoutput = true;
}
else if (!ascii_strncasecmp (field, "composetyped", 12))
{
/* this compare most occur before compose to match correctly */
if (get_field_text (field + 12, entry ? &entry->composetypecommand : NULL,
type, filename, line))
- composecommand = TRUE;
+ composecommand = true;
}
else if (!ascii_strncasecmp (field, "compose", 7))
{
if (get_field_text (field + 7, entry ? &entry->composecommand : NULL,
type, filename, line))
- composecommand = TRUE;
+ composecommand = true;
}
else if (!ascii_strncasecmp (field, "print", 5))
{
if (get_field_text (field + 5, entry ? &entry->printcommand : NULL,
type, filename, line))
- printcommand = TRUE;
+ printcommand = true;
}
else if (!ascii_strncasecmp (field, "edit", 4))
{
if (get_field_text (field + 4, entry ? &entry->editcommand : NULL,
type, filename, line))
- editcommand = TRUE;
+ editcommand = true;
}
else if (!ascii_strncasecmp (field, "nametemplate", 12))
{
if (mutt_system (test_command))
{
/* a non-zero exit code means test failed */
- found = FALSE;
+ found = false;
}
FREE (&test_command);
}
if (opt == MUTT_AUTOVIEW)
{
if (!copiousoutput)
- found = FALSE;
+ found = false;
}
else if (opt == MUTT_COMPOSE)
{
if (!composecommand)
- found = FALSE;
+ found = false;
}
else if (opt == MUTT_EDIT)
{
if (!editcommand)
- found = FALSE;
+ found = false;
}
else if (opt == MUTT_PRINT)
{
if (!printcommand)
- found = FALSE;
+ found = false;
}
if (!found)
{
char path[_POSIX_PATH_MAX];
int x;
- int found = FALSE;
+ int found = false;
char *curr = MailcapPath;
/* rfc1524 specifies that a path of mailcap files should be searched.