summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--command-line-arguments.c58
-rw-r--r--command-line-arguments.h10
-rw-r--r--crypto.c6
-rw-r--r--debugger.c8
-rw-r--r--gmime-filter-reply.c32
-rw-r--r--mime-node.c10
-rw-r--r--notmuch-client.h35
-rw-r--r--notmuch-compact.c2
-rw-r--r--notmuch-config.c28
-rw-r--r--notmuch-count.c18
-rw-r--r--notmuch-dump.c10
-rw-r--r--notmuch-insert.c70
-rw-r--r--notmuch-new.c30
-rw-r--r--notmuch-reply.c30
-rw-r--r--notmuch-restore.c4
-rw-r--r--notmuch-search.c24
-rw-r--r--notmuch-setup.c6
-rw-r--r--notmuch-show.c52
-rw-r--r--notmuch-tag.c6
-rw-r--r--notmuch.c12
-rw-r--r--sprinter-json.c18
-rw-r--r--sprinter-sexp.c16
-rw-r--r--sprinter-text.c6
-rw-r--r--sprinter.h6
-rw-r--r--tag-util.c24
-rw-r--r--tag-util.h8
-rw-r--r--test/arg-test.c6
-rw-r--r--test/hex-xcode.c8
-rw-r--r--test/random-corpus.c2
29 files changed, 275 insertions, 270 deletions
diff --git a/command-line-arguments.c b/command-line-arguments.c
index 3fa8d904..1ff5aae5 100644
--- a/command-line-arguments.c
+++ b/command-line-arguments.c
@@ -6,11 +6,11 @@
/*
Search the array of keywords for a given argument, assigning the
- output variable to the corresponding value. Return FALSE if nothing
+ output variable to the corresponding value. Return false if nothing
matches.
*/
-static notmuch_bool_t
+static bool
_process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
const notmuch_keyword_t *keywords;
@@ -29,64 +29,64 @@ _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next, const char
else
*arg_desc->opt_keyword = keywords->value;
- return TRUE;
+ return true;
}
if (next != '\0')
fprintf (stderr, "Unknown keyword argument \"%s\" for option \"%s\".\n", arg_str, arg_desc->name);
else
fprintf (stderr, "Option \"%s\" needs a keyword argument.\n", arg_desc->name);
- return FALSE;
+ return false;
}
-static notmuch_bool_t
+static bool
_process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
- notmuch_bool_t value;
+ bool value;
if (next == '\0' || strcmp (arg_str, "true") == 0) {
- value = TRUE;
+ value = true;
} else if (strcmp (arg_str, "false") == 0) {
- value = FALSE;
+ value = false;
} else {
fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str, arg_desc->name);
- return FALSE;
+ return false;
}
*arg_desc->opt_bool = value;
- return TRUE;
+ return true;
}
-static notmuch_bool_t
+static bool
_process_int_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
char *endptr;
if (next == '\0' || arg_str[0] == '\0') {
fprintf (stderr, "Option \"%s\" needs an integer argument.\n", arg_desc->name);
- return FALSE;
+ return false;
}
*arg_desc->opt_int = strtol (arg_str, &endptr, 10);
if (*endptr == '\0')
- return TRUE;
+ return true;
fprintf (stderr, "Unable to parse argument \"%s\" for option \"%s\" as an integer.\n",
arg_str, arg_desc->name);
- return FALSE;
+ return false;
}
-static notmuch_bool_t
+static bool
_process_string_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {
if (next == '\0') {
fprintf (stderr, "Option \"%s\" needs a string argument.\n", arg_desc->name);
- return FALSE;
+ return false;
}
if (arg_str[0] == '\0') {
fprintf (stderr, "String argument for option \"%s\" must be non-empty.\n", arg_desc->name);
- return FALSE;
+ return false;
}
*arg_desc->opt_string = arg_str;
- return TRUE;
+ return true;
}
/* Return number of non-NULL opt_* fields in opt_desc. */
@@ -102,8 +102,8 @@ static int _opt_set_count (const notmuch_opt_desc_t *opt_desc)
!!opt_desc->opt_position;
}
-/* Return TRUE if opt_desc is valid. */
-static notmuch_bool_t _opt_valid (const notmuch_opt_desc_t *opt_desc)
+/* Return true if opt_desc is valid. */
+static bool _opt_valid (const notmuch_opt_desc_t *opt_desc)
{
int n = _opt_set_count (opt_desc);
@@ -115,11 +115,11 @@ static notmuch_bool_t _opt_valid (const notmuch_opt_desc_t *opt_desc)
}
/*
- Search for the {pos_arg_index}th position argument, return FALSE if
+ Search for the {pos_arg_index}th position argument, return false if
that does not exist.
*/
-notmuch_bool_t
+bool
parse_position_arg (const char *arg_str, int pos_arg_index,
const notmuch_opt_desc_t *arg_desc) {
@@ -129,14 +129,14 @@ parse_position_arg (const char *arg_str, int pos_arg_index,
if (pos_arg_counter == pos_arg_index) {
*arg_desc->opt_position = arg_str;
if (arg_desc->present)
- *arg_desc->present = TRUE;
- return TRUE;
+ *arg_desc->present = true;
+ return true;
}
pos_arg_counter++;
}
arg_desc++;
}
- return FALSE;
+ return false;
}
/*
@@ -192,7 +192,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
opt_index ++;
}
- notmuch_bool_t opt_status = FALSE;
+ bool opt_status = false;
if (try->opt_keyword || try->opt_flags)
opt_status = _process_keyword_arg (try, next, value);
else if (try->opt_bool)
@@ -208,7 +208,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
return -1;
if (try->present)
- *try->present = TRUE;
+ *try->present = true;
return opt_index+1;
}
@@ -221,7 +221,7 @@ parse_arguments (int argc, char **argv,
const notmuch_opt_desc_t *options, int opt_index) {
int pos_arg_index = 0;
- notmuch_bool_t more_args = TRUE;
+ bool more_args = true;
while (more_args && opt_index < argc) {
if (strncmp (argv[opt_index],"--",2) != 0) {
@@ -242,7 +242,7 @@ parse_arguments (int argc, char **argv,
opt_index = parse_option (argc, argv, options, opt_index);
if (opt_index < 0) {
fprintf (stderr, "Unrecognized option: %s\n", argv[prev_opt_index]);
- more_args = FALSE;
+ more_args = false;
}
}
}
diff --git a/command-line-arguments.h b/command-line-arguments.h
index dfc808bd..76ca4dcb 100644
--- a/command-line-arguments.h
+++ b/command-line-arguments.h
@@ -1,6 +1,8 @@
#ifndef NOTMUCH_OPTS_H
#define NOTMUCH_OPTS_H
+#include <stdbool.h>
+
#include "notmuch.h"
/*
@@ -17,7 +19,7 @@ typedef struct notmuch_keyword {
typedef struct notmuch_opt_desc {
/* One and only one of opt_* must be set. */
const struct notmuch_opt_desc *opt_inherit;
- notmuch_bool_t *opt_bool;
+ bool *opt_bool;
int *opt_int;
int *opt_keyword;
int *opt_flags;
@@ -27,8 +29,8 @@ typedef struct notmuch_opt_desc {
/* Must be set except for opt_inherit and opt_position. */
const char *name;
- /* Optional, if non-NULL, set to TRUE if the option is present. */
- notmuch_bool_t *present;
+ /* Optional, if non-NULL, set to true if the option is present. */
+ bool *present;
/* Must be set for opt_keyword and opt_flags. */
const struct notmuch_keyword *keywords;
@@ -64,7 +66,7 @@ parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int o
int
parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);
-notmuch_bool_t
+bool
parse_position_arg (const char *arg,
int position_arg_index,
const notmuch_opt_desc_t* options);
diff --git a/crypto.c b/crypto.c
index cc45b885..9c557d6e 100644
--- a/crypto.c
+++ b/crypto.c
@@ -37,8 +37,8 @@ create_gpg_context (notmuch_crypto_t *crypto)
}
crypto->gpgctx = gpgctx;
- g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) gpgctx, TRUE);
- g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, FALSE);
+ g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) gpgctx, true);
+ g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, false);
return gpgctx;
}
@@ -61,7 +61,7 @@ create_pkcs7_context (notmuch_crypto_t *crypto)
crypto->pkcs7ctx = pkcs7ctx;
g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) pkcs7ctx,
- FALSE);
+ false);
return pkcs7ctx;
}
diff --git a/debugger.c b/debugger.c
index 0fa0fb6b..5cb38ac4 100644
--- a/debugger.c
+++ b/debugger.c
@@ -28,20 +28,20 @@
#define RUNNING_ON_VALGRIND 0
#endif
-notmuch_bool_t
+bool
debugger_is_active (void)
{
char buf[1024];
if (RUNNING_ON_VALGRIND)
- return TRUE;
+ return true;
sprintf (buf, "/proc/%d/exe", getppid ());
if (readlink (buf, buf, sizeof (buf)) != -1 &&
strncmp (basename (buf), "gdb", 3) == 0)
{
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
diff --git a/gmime-filter-reply.c b/gmime-filter-reply.c
index 847426bf..a1ba4b45 100644
--- a/gmime-filter-reply.c
+++ b/gmime-filter-reply.c
@@ -16,6 +16,8 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#include <stdbool.h>
+
#include "gmime-filter-reply.h"
/**
@@ -87,8 +89,8 @@ static void
g_mime_filter_reply_init (GMimeFilterReply *filter, GMimeFilterReplyClass *klass)
{
(void) klass;
- filter->saw_nl = TRUE;
- filter->saw_angle = FALSE;
+ filter->saw_nl = true;
+ filter->saw_angle = false;
}
static void
@@ -117,43 +119,43 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,
(void) prespace;
if (reply->encode) {
- g_mime_filter_set_size (filter, 3 * inlen, FALSE);
+ g_mime_filter_set_size (filter, 3 * inlen, false);
outptr = filter->outbuf;
while (inptr < inend) {
if (reply->saw_nl) {
*outptr++ = '>';
*outptr++ = ' ';
- reply->saw_nl = FALSE;
+ reply->saw_nl = false;
}
if (*inptr == '\n')
- reply->saw_nl = TRUE;
+ reply->saw_nl = true;
else
- reply->saw_nl = FALSE;
+ reply->saw_nl = false;
if (*inptr != '\r')
*outptr++ = *inptr;
inptr++;
}
} else {
- g_mime_filter_set_size (filter, inlen + 1, FALSE);
+ g_mime_filter_set_size (filter, inlen + 1, false);
outptr = filter->outbuf;
while (inptr < inend) {
if (reply->saw_nl) {
if (*inptr == '>')
- reply->saw_angle = TRUE;
+ reply->saw_angle = true;
else
*outptr++ = *inptr;
- reply->saw_nl = FALSE;
+ reply->saw_nl = false;
} else if (reply->saw_angle) {
if (*inptr == ' ')
;
else
*outptr++ = *inptr;
- reply->saw_angle = FALSE;
+ reply->saw_angle = false;
} else if (*inptr != '\r') {
if (*inptr == '\n')
- reply->saw_nl = TRUE;
+ reply->saw_nl = true;
*outptr++ = *inptr;
}
@@ -179,19 +181,19 @@ filter_reset (GMimeFilter *filter)
{
GMimeFilterReply *reply = (GMimeFilterReply *) filter;
- reply->saw_nl = TRUE;
- reply->saw_angle = FALSE;
+ reply->saw_nl = true;
+ reply->saw_angle = false;
}
/**
* g_mime_filter_reply_new:
- * @encode: %TRUE if the filter should encode or %FALSE otherwise
+ * @encode: %true if the filter should encode or %false otherwise
* @dots: encode/decode dots (as for SMTP)
*
* Creates a new #GMimeFilterReply filter.
*
- * If @encode is %TRUE, then all lines will be prefixed by "> ",
+ * If @encode is %true, then all lines will be prefixed by "> ",
* otherwise any lines starting with "> " will have that removed
*
* Returns: a new #GMimeFilterReply filter.
diff --git a/mime-node.c b/mime-node.c
index 24d73afa..8b767d78 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -112,7 +112,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
status = NOTMUCH_STATUS_OUT_OF_MEMORY;
goto DONE;
}
- g_mime_stream_file_set_owner (GMIME_STREAM_FILE (mctx->stream), FALSE);
+ g_mime_stream_file_set_owner (GMIME_STREAM_FILE (mctx->stream), false);
mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
if (!mctx->parser) {
@@ -175,7 +175,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
{
GError *err = NULL;
- node->verify_attempted = TRUE;
+ node->verify_attempted = true;
node->sig_list = g_mime_multipart_signed_verify
(GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
@@ -198,7 +198,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
GMimeDecryptResult *decrypt_result = NULL;
GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part);
- node->decrypt_attempted = TRUE;
+ node->decrypt_attempted = true;
node->decrypted_child = g_mime_multipart_encrypted_decrypt
(encrypteddata, cryptoctx, &decrypt_result, &err);
if (! node->decrypted_child) {
@@ -207,8 +207,8 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
goto DONE;
}
- node->decrypt_success = TRUE;
- node->verify_attempted = TRUE;
+ node->decrypt_success = true;
+ node->verify_attempted = true;
/* This may be NULL if the part is not signed. */
node->sig_list = g_mime_decrypt_result_get_signatures (decrypt_result);
diff --git a/notmuch-client.h b/notmuch-client.h
index c68538fc..0365baae 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -24,6 +24,7 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* for getline */
#endif
+#include <stdbool.h>
#include <stdio.h>
#include <sysexits.h>
@@ -72,8 +73,8 @@ typedef struct notmuch_show_format {
} notmuch_show_format_t;
typedef struct notmuch_crypto {
- notmuch_bool_t verify;
- notmuch_bool_t decrypt;
+ bool verify;
+ bool decrypt;
#if (GMIME_MAJOR_VERSION < 3)
notmuch_crypto_context_t* gpgctx;
notmuch_crypto_context_t* pkcs7ctx;
@@ -82,12 +83,12 @@ typedef struct notmuch_crypto {
} notmuch_crypto_t;
typedef struct notmuch_show_params {
- notmuch_bool_t entire_thread;
- notmuch_bool_t omit_excluded;
- notmuch_bool_t output_body;
+ bool entire_thread;
+ bool omit_excluded;
+ bool output_body;
int part;
notmuch_crypto_t crypto;
- notmuch_bool_t include_html;
+ bool include_html;
GMimeStream *out_stream;
} notmuch_show_params_t;
@@ -247,12 +248,12 @@ show_one_part (const char *filename, int part);
void
format_part_sprinter (const void *ctx, struct sprinter *sp, mime_node_t *node,
- notmuch_bool_t output_body,
- notmuch_bool_t include_html);
+ bool output_body,
+ bool include_html);
void
format_headers_sprinter (struct sprinter *sp, GMimeMessage *message,
- notmuch_bool_t reply);
+ bool reply);
typedef enum {
NOTMUCH_SHOW_TEXT_PART_REPLY = 1 << 0,
@@ -286,7 +287,7 @@ notmuch_config_close (notmuch_config_t *config);
int
notmuch_config_save (notmuch_config_t *config);
-notmuch_bool_t
+bool
notmuch_config_is_new (notmuch_config_t *config);
const char *
@@ -345,12 +346,12 @@ notmuch_config_set_new_ignore (notmuch_config_t *config,
const char *new_ignore[],
size_t length);
-notmuch_bool_t
+bool
notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config);
void
notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
- notmuch_bool_t synchronize_flags);
+ bool synchronize_flags);
const char **
notmuch_config_get_search_exclude_tags (notmuch_config_t *config, size_t *length);
@@ -363,7 +364,7 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
int
notmuch_run_hook (const char *db_path, const char *hook);
-notmuch_bool_t
+bool
debugger_is_active (void);
/* mime-node.c */
@@ -406,14 +407,14 @@ struct mime_node {
int part_num;
/* True if decryption of this part was attempted. */
- notmuch_bool_t decrypt_attempted;
+ bool decrypt_attempted;
/* True if decryption of this part's child succeeded. In this
* case, the decrypted part is substituted for the second child of
* this part (which would usually be the encrypted data). */
- notmuch_bool_t decrypt_success;
+ bool decrypt_success;
/* True if signature verification on this part was attempted. */
- notmuch_bool_t verify_attempted;
+ bool verify_attempted;
/* The list of signatures for signed or encrypted containers. If
* there are no signatures, this will be NULL. */
@@ -487,7 +488,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
const char *query_str,
dump_format_t output_format,
dump_include_t include,
- notmuch_bool_t gzip_output);
+ bool gzip_output);
/* If status is non-zero (i.e. error) print appropriate
messages to stderr.
diff --git a/notmuch-compact.c b/notmuch-compact.c
index ae464e48..f8996cf4 100644
--- a/notmuch-compact.c
+++ b/notmuch-compact.c
@@ -32,7 +32,7 @@ notmuch_compact_command (notmuch_config_t *config, int argc, char *argv[])
const char *path = notmuch_config_get_database_path (config);
const char *backup_path = NULL;
notmuch_status_t ret;
- notmuch_bool_t quiet = FALSE;
+ bool quiet = false;
int opt_index;
notmuch_opt_desc_t options[] = {
diff --git a/notmuch-config.c b/notmuch-config.c
index cb9529b9..8fb59f96 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -122,7 +122,7 @@ static const char crypto_config_comment[] =
struct _notmuch_config {
char *filename;
GKeyFile *key_file;
- notmuch_bool_t is_new;
+ bool is_new;
char *database_path;
char *crypto_gpg_path;
@@ -134,7 +134,7 @@ struct _notmuch_config {
size_t new_tags_length;
const char **new_ignore;
size_t new_ignore_length;
- notmuch_bool_t maildir_synchronize_flags;
+ bool maildir_synchronize_flags;
const char **search_exclude_tags;
size_t search_exclude_tags_length;
};
@@ -212,8 +212,8 @@ get_username_from_passwd_file (void *ctx)
return name;
}
-static notmuch_bool_t
-get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
+static bool
+get_config_from_file (notmuch_config_t *config, bool create_new)
{
#define BUF_SIZE 4096
char *config_str = NULL;
@@ -221,7 +221,7 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
int config_bufsize = BUF_SIZE;
size_t len;
GError *error = NULL;
- notmuch_bool_t ret = FALSE;
+ bool ret = false;
FILE *fp = fopen(config->filename, "r");
if (fp == NULL) {
@@ -230,8 +230,8 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
* default configuration file in the case of FILE NOT FOUND.
*/
if (create_new) {
- config->is_new = TRUE;
- ret = TRUE;
+ config->is_new = true;
+ ret = true;
} else {
fprintf (stderr, "Configuration file %s not found.\n"
"Try running 'notmuch setup' to create a configuration.\n",
@@ -271,7 +271,7 @@ get_config_from_file (notmuch_config_t *config, notmuch_bool_t create_new)
if (g_key_file_load_from_data (config->key_file, config_str, config_len,
G_KEY_FILE_KEEP_COMMENTS, &error)) {
- ret = TRUE;
+ ret = true;
goto out;
}
@@ -352,7 +352,7 @@ notmuch_config_open (void *ctx,
talloc_set_destructor (config, notmuch_config_destructor);
/* non-zero defaults */
- config->maildir_synchronize_flags = TRUE;
+ config->maildir_synchronize_flags = true;
if (filename) {
config->filename = talloc_strdup (config, filename);
@@ -366,7 +366,7 @@ notmuch_config_open (void *ctx,
config->key_file = g_key_file_new ();
if (config_mode & NOTMUCH_CONFIG_OPEN) {
- notmuch_bool_t create_new = (config_mode & NOTMUCH_CONFIG_CREATE) != 0;
+ bool create_new = (config_mode & NOTMUCH_CONFIG_CREATE) != 0;
if (! get_config_from_file (config, create_new)) {
talloc_free (config);
@@ -466,7 +466,7 @@ notmuch_config_open (void *ctx,
g_key_file_get_boolean (config->key_file,
"maildir", "synchronize_flags", &error);
if (error) {
- notmuch_config_set_maildir_synchronize_flags (config, TRUE);
+ notmuch_config_set_maildir_synchronize_flags (config, true);
g_error_free (error);
}
@@ -579,7 +579,7 @@ notmuch_config_save (notmuch_config_t *config)
return 0;
}
-notmuch_bool_t
+bool
notmuch_config_is_new (notmuch_config_t *config)
{
return config->is_new;
@@ -1086,7 +1086,7 @@ notmuch_config_command (notmuch_config_t *config, int argc, char *argv[])
}
-notmuch_bool_t
+bool
notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config)
{
return config->maildir_synchronize_flags;
@@ -1094,7 +1094,7 @@ notmuch_config_get_maildir_synchronize_flags (notmuch_config_t *config)
void
notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,
- notmuch_bool_t synchronize_flags)
+ bool synchronize_flags)
{
g_key_file_set_boolean (config->key_file,
"maildir", "synchronize_flags", synchronize_flags);
diff --git a/notmuch-count.c b/notmuch-count.c
index b8b03cdb..1ae7d514 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -29,8 +29,8 @@ enum {
/* The following is to allow future options to be added more easily */
enum {
- EXCLUDE_TRUE,
- EXCLUDE_FALSE,
+ EXCLUDE_true,
+ EXCLUDE_false,
};
/* Return the number of files matching the query, or -1 for an error */
@@ -160,11 +160,11 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
char *query_str;
int opt_index;
int output = OUTPUT_MESSAGES;
- int exclude = EXCLUDE_TRUE;
+ int exclude = EXCLUDE_true;
const char **search_exclude_tags = NULL;
size_t search_exclude_tags_length = 0;
- notmuch_bool_t batch = FALSE;
- notmuch_bool_t print_lastmod = FALSE;
+ bool batch = false;
+ bool print_lastmod = false;
FILE *input = stdin;
const char *input_file_name = NULL;
int ret;
@@ -176,8 +176,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
{ "files", OUTPUT_FILES },
{ 0, 0 } } },
{ .opt_keyword = &exclude, .name = "exclude", .keywords =
- (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },
- { "false", EXCLUDE_FALSE },
+ (notmuch_keyword_t []){ { "true", EXCLUDE_true },
+ { "false", EXCLUDE_false },
{ 0, 0 } } },
{ .opt_bool = &print_lastmod, .name = "lastmod" },
{ .opt_bool = &batch, .name = "batch" },
@@ -193,7 +193,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_process_shared_options (argv[0]);
if (input_file_name) {
- batch = TRUE;
+ batch = true;
input = fopen (input_file_name, "r");
if (input == NULL) {
fprintf (stderr, "Error opening %s for reading: %s\n",
@@ -221,7 +221,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
return EXIT_FAILURE;
}
- if (exclude == EXCLUDE_TRUE) {
+ if (exclude == EXCLUDE_true) {
search_exclude_tags = notmuch_config_get_search_exclude_tags
(config, &search_exclude_tags_length);
}
diff --git a/notmuch-dump.c b/notmuch-dump.c
index 03e64d60..ef2f02df 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -97,7 +97,7 @@ dump_properties_message (void *ctx,
{
const char *message_id;
notmuch_message_properties_t *list;
- notmuch_bool_t first = TRUE;
+ bool first = true;
message_id = notmuch_message_get_message_id (message);
@@ -106,7 +106,7 @@ dump_properties_message (void *ctx,
return 0;
}
- for (list = notmuch_message_get_properties (message, "", FALSE);
+ for (list = notmuch_message_get_properties (message, "", false);
notmuch_message_properties_valid (list); notmuch_message_properties_move_to_next (list)) {
const char *key, *val;
@@ -116,7 +116,7 @@ dump_properties_message (void *ctx,
return 1;
}
gzprintf (output, "#= %s", *buffer_p);
- first = FALSE;
+ first = false;
}
key = notmuch_message_properties_key (list);
@@ -277,7 +277,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
const char *query_str,
dump_format_t output_format,
dump_include_t include,
- notmuch_bool_t gzip_output)
+ bool gzip_output)
{
gzFile output = NULL;
const char *mode = gzip_output ? "w9" : "wT";
@@ -374,7 +374,7 @@ notmuch_dump_command (notmuch_config_t *config, int argc, char *argv[])
int output_format = DUMP_FORMAT_BATCH_TAG;
int include = 0;
- notmuch_bool_t gzip_output = 0;
+ bool gzip_output = 0;
notmuch_opt_desc_t options[] = {
{ .opt_keyword = &output_format, .name = "format", .keywords =
diff --git a/notmuch-insert.c b/notmuch-insert.c
index bbbc29ea..32be7419 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -65,7 +65,7 @@ safe_gethostname (char *hostname, size_t len)
}
/* Call fsync() on a directory path. */
-static notmuch_bool_t
+static bool
sync_dir (const char *dir)
{
int fd, r;
@@ -73,7 +73,7 @@ sync_dir (const char *dir)
fd = open (dir, O_RDONLY);
if (fd == -1) {
fprintf (stderr, "Error: open %s: %s\n", dir, strerror (errno));
- return FALSE;
+ return false;
}
r = fsync (fd);
@@ -88,29 +88,29 @@ sync_dir (const char *dir)
/*
* Check the specified folder name does not contain a directory
* component ".." to prevent writes outside of the Maildir
- * hierarchy. Return TRUE on valid folder name, FALSE otherwise.
+ * hierarchy. Return true on valid folder name, false otherwise.
*/
-static notmuch_bool_t
+static bool
is_valid_folder_name (const char *folder)
{
const char *p = folder;
for (;;) {
if ((p[0] == '.') && (p[1] == '.') && (p[2] == '\0' || p[2] == '/'))
- return FALSE;
+ return false;
p = strchr (p, '/');
if (!p)
- return TRUE;
+ return true;
p++;
}
}
/*
* Make the given directory and its parents as necessary, using the
- * given mode. Return TRUE on success, FALSE otherwise. Partial
+ * given mode. Return true on success, false otherwise. Partial
* results are not cleaned up on errors.
*/
-static notmuch_bool_t
+static bool
mkdir_recursive (const void *ctx, const char *path, int mode)
{
struct stat st;
@@ -123,13 +123,13 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
if (! S_ISDIR (st.st_mode)) {
fprintf (stderr, "Error: '%s' is not a directory: %s\n",
path, strerror (EEXIST));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
} else if (errno != ENOENT) {
fprintf (stderr, "Error: stat '%s': %s\n", path, strerror (errno));
- return FALSE;
+ return false;
}
/* mkdir parents, if any */
@@ -138,27 +138,27 @@ mkdir_recursive (const void *ctx, const char *path, int mode)
parent = talloc_strndup (ctx, path, slash - path);
if (! parent) {
fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
- return FALSE;
+ return false;
}
if (! mkdir_recursive (ctx, parent, mode))
- return FALSE;
+ return false;
}
if (mkdir (path, mode)) {
fprintf (stderr, "Error: mkdir '%s': %s\n", path, strerror (errno));
- return FALSE;
+ return false;
}
- return parent ? sync_dir (parent) : TRUE;
+ return parent ? sync_dir (parent) : true;
}
/*
* Create the given maildir folder, i.e. maildir and its
- * subdirectories cur/new/tmp. Return TRUE on success, FALSE
+ * subdirectories cur/new/tmp. Return true on success, false
* otherwise. Partial results are not cleaned up on errors.
*/
-static notmuch_bool_t
+static bool
maildir_create_folder (const void *ctx, const char *maildir)
{
const char *subdirs[] = { "cur", "new", "tmp" };
@@ -170,14 +170,14 @@ maildir_create_folder (const void *ctx, const char *maildir)
subdir = talloc_asprintf (ctx, "%s/%s", maildir, subdirs[i]);
if (! subdir) {
fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
- return FALSE;
+ return false;
}
if (! mkdir_recursive (ctx, subdir, mode))
- return FALSE;