cli: run uncrustify

This is the result of running

     $ uncrustify --replace --config devel/uncrustify.cfg *.c *.h

in the top level source directory

Line breaks were then adjusted manually to keep argc and argv
together.
This commit is contained in:
uncrustify 2021-03-13 08:45:34 -04:00 committed by David Bremner
parent df4c66f85d
commit eef21c2847
21 changed files with 177 additions and 92 deletions

View file

@ -47,17 +47,23 @@ _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, char next,
continue;
*arg_desc->opt_keyword = keywords->value;
fprintf (stderr, "Warning: No known keyword option given for \"%s\", choosing value \"%s\"."
" Please specify the argument explicitly!\n", arg_desc->name, arg_desc->keyword_no_arg_value);
fprintf (stderr,
"Warning: No known keyword option given for \"%s\", choosing value \"%s\"."
" Please specify the argument explicitly!\n", arg_desc->name,
arg_desc->keyword_no_arg_value);
return OPT_GIVEBACK;
}
fprintf (stderr, "No matching keyword for option \"%s\" and default value \"%s\" is invalid.\n", arg_str, arg_desc->name);
fprintf (stderr,
"No matching keyword for option \"%s\" and default value \"%s\" is invalid.\n",
arg_str,
arg_desc->name);
return OPT_FAILED;
}
if (next != '\0')
fprintf (stderr, "Unknown keyword argument \"%s\" for option \"%s\".\n", arg_str, arg_desc->name);
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 OPT_FAILED;
@ -74,7 +80,8 @@ _process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next,
} else if (strcmp (arg_str, "false") == 0) {
value = false;
} else {
fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str, arg_desc->name);
fprintf (stderr, "Unknown argument \"%s\" for (boolean) option \"%s\".\n", arg_str,
arg_desc->name);
return OPT_FAILED;
}
@ -202,6 +209,7 @@ parse_option (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_
const notmuch_opt_desc_t *try;
const char *next_arg = NULL;
if (opt_index < argc - 1 && strncmp (argv[opt_index + 1], "--", 2) != 0)
next_arg = argv[opt_index + 1];

View file

@ -24,11 +24,17 @@
G_BEGIN_DECLS
#define GMIME_TYPE_FILTER_REPLY (g_mime_filter_reply_get_type ())
#define GMIME_FILTER_REPLY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_FILTER_REPLY, GMimeFilterReply))
#define GMIME_FILTER_REPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_FILTER_REPLY, GMimeFilterReplyClass))
#define GMIME_IS_FILTER_REPLY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_FILTER_REPLY))
#define GMIME_IS_FILTER_REPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_FILTER_REPLY))
#define GMIME_FILTER_REPLY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_FILTER_REPLY, GMimeFilterReplyClass))
#define GMIME_FILTER_REPLY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
GMIME_TYPE_FILTER_REPLY, \
GMimeFilterReply))
#define GMIME_FILTER_REPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_FILTER_REPLY, \
GMimeFilterReplyClass))
#define GMIME_IS_FILTER_REPLY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
GMIME_TYPE_FILTER_REPLY))
#define GMIME_IS_FILTER_REPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
GMIME_TYPE_FILTER_REPLY))
#define GMIME_FILTER_REPLY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_FILTER_REPLY, \
GMimeFilterReplyClass))
typedef struct _GMimeFilterReply GMimeFilterReply;
typedef struct _GMimeFilterReplyClass GMimeFilterReplyClass;

View file

@ -243,7 +243,8 @@ node_verify (mime_node_t *node, GMimeObject *part)
status = _notmuch_message_crypto_potential_sig_list (node->ctx->msg_crypto, node->sig_list);
if (status) /* this is a warning, not an error */
fprintf (stderr, "Warning: failed to note signature status: %s.\n", notmuch_status_to_string (status));
fprintf (stderr, "Warning: failed to note signature status: %s.\n", notmuch_status_to_string (
status));
}
/* Decrypt and optionally verify an encrypted mime node */
@ -278,7 +279,8 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
node->decrypt_success = true;
status = _notmuch_message_crypto_successful_decryption (node->ctx->msg_crypto);
if (status) /* this is a warning, not an error */
fprintf (stderr, "Warning: failed to note decryption status: %s.\n", notmuch_status_to_string (status));
fprintf (stderr, "Warning: failed to note decryption status: %s.\n",
notmuch_status_to_string (status));
if (decrypt_result) {
/* This may be NULL if the part is not signed. */
@ -287,9 +289,11 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
node->verify_attempted = true;
g_object_ref (node->sig_list);
set_signature_list_destructor (node);
status = _notmuch_message_crypto_potential_sig_list (node->ctx->msg_crypto, node->sig_list);
status = _notmuch_message_crypto_potential_sig_list (node->ctx->msg_crypto,
node->sig_list);
if (status) /* this is a warning, not an error */
fprintf (stderr, "Warning: failed to note signature status: %s.\n", notmuch_status_to_string (status));
fprintf (stderr, "Warning: failed to note signature status: %s.\n",
notmuch_status_to_string (status));
}
if (node->ctx->crypto->decrypt == NOTMUCH_DECRYPT_TRUE && message) {
@ -366,7 +370,8 @@ _mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
}
/* Handle PGP/MIME parts (by definition not cryptographic payload parts) */
if (GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE)) {
if (GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt !=
NOTMUCH_DECRYPT_FALSE)) {
if (node->nchildren != 2) {
/* this violates RFC 3156 section 4, so we won't bother with it. */
fprintf (stderr, "Error: %d part(s) for a multipart/encrypted "
@ -385,19 +390,22 @@ _mime_node_set_up_part (mime_node_t *node, GMimeObject *part, int numchild)
node_verify (node, part);
}
} else if (GMIME_IS_APPLICATION_PKCS7_MIME (part) &&
GMIME_SECURE_MIME_TYPE_SIGNED_DATA == g_mime_application_pkcs7_mime_get_smime_type (GMIME_APPLICATION_PKCS7_MIME (part))) {
GMIME_SECURE_MIME_TYPE_SIGNED_DATA == g_mime_application_pkcs7_mime_get_smime_type (
GMIME_APPLICATION_PKCS7_MIME (part))) {
/* If node->ctx->crypto->verify is false, it would be better
* to just unwrap (instead of verifying), but
* https://github.com/jstedfast/gmime/issues/67 */
node_verify (node, part);
} else if (GMIME_IS_APPLICATION_PKCS7_MIME (part) &&
GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA == g_mime_application_pkcs7_mime_get_smime_type (GMIME_APPLICATION_PKCS7_MIME (part)) &&
GMIME_SECURE_MIME_TYPE_ENVELOPED_DATA == g_mime_application_pkcs7_mime_get_smime_type (
GMIME_APPLICATION_PKCS7_MIME (part)) &&
(node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE)) {
node_decrypt_and_verify (node, part);
if (node->unwrapped_child && node->nchildren == 0)
node->nchildren = 1;
} else {
if (_notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ? node->parent->part : NULL, numchild) &&
if (_notmuch_message_crypto_potential_payload (node->ctx->msg_crypto, part, node->parent ?
node->parent->part : NULL, numchild) &&
node->ctx->msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL) {
GMimeObject *clean_payload = _notmuch_repair_crypto_payload_skip_legacy_display (part);
if (clean_payload != part) {

View file

@ -171,46 +171,60 @@ void
notmuch_exit_if_unsupported_format (void);
int
notmuch_count_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_count_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_dump_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_dump_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_new_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_new_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_insert_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_insert_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_reindex_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_reindex_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_reply_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_reply_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_restore_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_restore_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_search_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_search_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_address_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_address_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_setup_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_setup_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_show_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_show_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_tag_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_tag_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_config_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_config_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
int
notmuch_compact_command (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
notmuch_compact_command (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
const char *
notmuch_time_relative_date (const void *ctx, time_t then);
@ -503,9 +517,10 @@ print_status_gzbytes (const char *loc,
int bytes);
/* the __location__ macro is defined in talloc.h */
#define ASSERT_GZBYTES(file, bytes) ((print_status_gzbytes (__location__, file, bytes)) ? exit (1) : 0)
#define ASSERT_GZBYTES(file, bytes) ((print_status_gzbytes (__location__, file, bytes)) ? exit (1) : \
0)
#define GZPRINTF(file, fmt, ...) ASSERT_GZBYTES (file, gzprintf (file, fmt, ##__VA_ARGS__));
#define GZPUTS(file, str) ASSERT_GZBYTES(file, gzputs (file, str));
#define GZPUTS(file, str) ASSERT_GZBYTES (file, gzputs (file, str));
#include "command-line-arguments.h"

View file

@ -27,7 +27,8 @@ status_update_cb (const char *msg, unused (void *closure))
}
int
notmuch_compact_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_compact_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
const char *backup_path = NULL;
notmuch_status_t ret;

View file

@ -510,7 +510,9 @@ notmuch_config_close (notmuch_config_t *config)
talloc_free (config);
}
const char *_notmuch_config_get_path (notmuch_config_t *config) {
const char *
_notmuch_config_get_path (notmuch_config_t *config)
{
return config->filename;
}
/* Save any changes made to the notmuch configuration.
@ -1105,7 +1107,8 @@ notmuch_config_command_list (notmuch_config_t *config)
}
int
notmuch_config_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch), int argc, char *argv[])
notmuch_config_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch),
int argc, char *argv[])
{
int ret;
int opt_index;

View file

@ -86,12 +86,12 @@ print_count (notmuch_database_t *notmuch, const char *query_str,
status = notmuch_query_add_tag_exclude (query,
notmuch_config_values_get (exclude_tags));
if (status && status != NOTMUCH_STATUS_IGNORED) {
print_status_query ("notmuch count", query, status);
ret = -1;
goto DONE;
}
if (status && status != NOTMUCH_STATUS_IGNORED) {
print_status_query ("notmuch count", query, status);
ret = -1;
goto DONE;
}
}
switch (output) {
case OUTPUT_MESSAGES:
@ -151,7 +151,8 @@ count_file (notmuch_database_t *notmuch, FILE *input, notmuch_config_values_t *e
}
int
notmuch_count_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_count_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
char *query_str;
int opt_index;

View file

@ -339,7 +339,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
output = NULL;
goto DONE;
} else
output = NULL;
output = NULL;
if (output_file_name) {
ret = rename (tempname, output_file_name);
@ -361,7 +361,8 @@ notmuch_database_dump (notmuch_database_t *notmuch,
}
int
notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch , int argc, char *argv[])
notmuch_dump_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
const char *query_str = NULL;
int ret;

View file

@ -444,7 +444,8 @@ add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
}
int
notmuch_insert_command (unused(notmuch_config_t *config),notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_insert_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
notmuch_status_t status, close_status;
struct sigaction action;

View file

@ -673,8 +673,9 @@ add_files (notmuch_database_t *notmuch,
char *absolute = talloc_asprintf (state->removed_directories,
"%s/%s", path, filename);
if (state->debug)
printf ("(D) add_files, pass 2: queuing passed directory %s for deletion from database\n",
absolute);
printf (
"(D) add_files, pass 2: queuing passed directory %s for deletion from database\n",
absolute);
_filename_list_add (state->removed_directories, absolute);
}
@ -756,8 +757,9 @@ add_files (notmuch_database_t *notmuch,
notmuch_filenames_get (db_subdirs));
if (state->debug)
printf ("(D) add_files, pass 3: queuing leftover directory %s for deletion from database\n",
absolute);
printf (
"(D) add_files, pass 3: queuing leftover directory %s for deletion from database\n",
absolute);
_filename_list_add (state->removed_directories, absolute);
@ -1043,7 +1045,8 @@ print_results (const add_files_state_t *state)
}
static int
_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) {
_maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state)
{
if (notmuch_database_needs_upgrade (notmuch)) {
time_t now = time (NULL);
struct tm *gm_time = gmtime (&now);
@ -1094,7 +1097,8 @@ _maybe_upgrade (notmuch_database_t *notmuch, add_files_state_t *state) {
}
int
notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
add_files_state_t add_files_state = {
.verbosity = VERBOSITY_NORMAL,
@ -1155,7 +1159,7 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu
for (notmuch_config_values_start (add_files_state.new_tags);
notmuch_config_values_valid (add_files_state.new_tags);
notmuch_config_values_move_to_next (add_files_state.new_tags)) {
const char *tag,*error_msg;
const char *tag, *error_msg;
tag = notmuch_config_values_get (add_files_state.new_tags);
error_msg = illegal_tag (tag, false);
@ -1233,7 +1237,8 @@ notmuch_new_command (unused(notmuch_config_t *config), notmuch_database_t *notmu
if (do_print_progress) {
do_print_progress = 0;
generic_print_progress ("Cleaned up", "messages",
tv_start, add_files_state.removed_messages + add_files_state.renamed_messages,
tv_start, add_files_state.removed_messages +
add_files_state.renamed_messages,
add_files_state.removed_files->count);
}
}

View file

@ -83,7 +83,8 @@ reindex_query (notmuch_database_t *notmuch, const char *query_string,
}
int
notmuch_reindex_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_reindex_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
char *query_string = NULL;
struct sigaction action;

View file

@ -639,7 +639,9 @@ do_reply (notmuch_database_t *notmuch,
return 1;
if (count != 1) {
fprintf (stderr, "Error: search term did not match precisely one message (matched %u messages).\n", count);
fprintf (stderr,
"Error: search term did not match precisely one message (matched %u messages).\n",
count);
return 1;
}
@ -703,7 +705,8 @@ do_reply (notmuch_database_t *notmuch,
}
int
notmuch_reply_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_reply_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
notmuch_query_t *query;
char *query_string;

View file

@ -219,7 +219,8 @@ parse_sup_line (void *ctx, char *line,
}
int
notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
bool accumulate = false;
tag_op_flag_t flags = 0;
@ -343,7 +344,8 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n
if (ret)
goto DONE;
}
if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == '=') {
if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] ==
'=') {
ret = process_properties_line (notmuch, line + 2);
if (ret)
goto DONE;
@ -360,6 +362,7 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n
}
char *p;
for (p = line; (input_format == DUMP_FORMAT_AUTO) && *p; p++) {
if (*p == '(')
input_format = DUMP_FORMAT_SUP;
@ -382,7 +385,8 @@ notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *n
line_ctx = talloc_new (notmuch);
if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == '=') {
if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] ==
'=') {
ret = process_properties_line (notmuch, line + 2);
if (ret)
goto DONE;

View file

@ -794,7 +794,8 @@ static const notmuch_opt_desc_t common_options[] = {
};
int
notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
search_context_t *ctx = &search_context;
int opt_index, ret;
@ -831,7 +832,8 @@ notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *no
if (ctx->output != OUTPUT_FILES && ctx->output != OUTPUT_MESSAGES &&
ctx->dupe != -1) {
fprintf (stderr, "Error: --duplicate=N is only supported with --output=files and --output=messages.\n");
fprintf (stderr,
"Error: --duplicate=N is only supported with --output=files and --output=messages.\n");
return EXIT_FAILURE;
}
@ -860,7 +862,8 @@ notmuch_search_command (unused(notmuch_config_t *config), notmuch_database_t *no
}
int
notmuch_address_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_address_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
search_context_t *ctx = &search_context;
int opt_index, ret;

View file

@ -80,14 +80,16 @@ _get_disposition (GMimeObject *meta)
return g_mime_content_disposition_get_disposition (disposition);
}
static bool _get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag) {
static bool
_get_message_flag (notmuch_message_t *message, notmuch_message_flag_t flag)
{
notmuch_bool_t is_set;
notmuch_status_t status;
status = notmuch_message_get_flag_st (message, flag, &is_set);
if (print_status_message ("notmuch show", message, status))
INTERNAL_ERROR("unexpected error getting message flag\n");
INTERNAL_ERROR ("unexpected error getting message flag\n");
return is_set;
}
@ -438,6 +440,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
}
int i;
for (i = 0; i < g_mime_signature_list_length (siglist); i++) {
GMimeSignature *signature = g_mime_signature_list_get_signature (siglist, i);
@ -668,7 +671,8 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
sp->map_key (sp, "decrypted");
sp->begin_map (sp);
sp->map_key (sp, "status");
sp->string (sp, msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL ? "full" : "partial");
sp->string (sp, msg_crypto->decryption_status == NOTMUCH_MESSAGE_DECRYPTED_FULL ?
"full" : "partial");
if (msg_crypto->payload_subject) {
const char *subject = g_mime_message_get_subject GMIME_MESSAGE (node->part);
@ -965,7 +969,8 @@ show_message (void *ctx,
notmuch_status_t session_key_count_error = NOTMUCH_STATUS_SUCCESS;
if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
session_key_count_error = notmuch_message_count_properties (message, "session-key", &session_keys);
session_key_count_error = notmuch_message_count_properties (message, "session-key",
&session_keys);
status = mime_node_open (local, message, &(params->crypto), &root);
if (status)
@ -973,12 +978,15 @@ show_message (void *ctx,
part = mime_node_seek_dfs (root, (params->part < 0 ? 0 : params->part));
if (part)
status = format->part (local, sp, part, indent, params);
if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE && session_key_count_error == NOTMUCH_STATUS_SUCCESS) {
if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE && session_key_count_error ==
NOTMUCH_STATUS_SUCCESS) {
unsigned int new_session_keys = 0;
if (notmuch_message_count_properties (message, "session-key", &new_session_keys) == NOTMUCH_STATUS_SUCCESS &&
if (notmuch_message_count_properties (message, "session-key", &new_session_keys) ==
NOTMUCH_STATUS_SUCCESS &&
new_session_keys > session_keys) {
/* try a quiet re-indexing */
notmuch_indexopts_t *indexopts = notmuch_database_get_default_indexopts (notmuch_message_get_database (message));
notmuch_indexopts_t *indexopts = notmuch_database_get_default_indexopts (
notmuch_message_get_database (message));
if (indexopts) {
notmuch_indexopts_set_decrypt_policy (indexopts, NOTMUCH_DECRYPT_AUTO);
print_status_message ("Error re-indexing message with --decrypt=stash",
@ -1064,7 +1072,9 @@ do_show_single (void *ctx,
return 1;
if (count != 1) {
fprintf (stderr, "Error: search term did not match precisely one message (matched %u messages).\n", count);
fprintf (stderr,
"Error: search term did not match precisely one message (matched %u messages).\n",
count);
return 1;
}
@ -1157,9 +1167,9 @@ do_show_unthreaded (void *ctx,
notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, TRUE);
excluded = _get_message_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);
if (!excluded || !params->omit_excluded) {
if (! excluded || ! params->omit_excluded) {
status = show_message (ctx, format, sp, message, 0, params);
if (status && !res)
if (status && ! res)
res = status;
} else {
sp->null (sp);
@ -1215,7 +1225,8 @@ static const notmuch_show_format_t *formatters[] = {
};
int
notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch), int argc, char *argv[])
notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch),
int argc, char *argv[])
{
notmuch_database_t *notmuch;
notmuch_query_t *query;
@ -1321,10 +1332,12 @@ notmuch_show_command (notmuch_config_t *config, unused(notmuch_database_t *notmu
(format != NOTMUCH_FORMAT_TEXT &&
format != NOTMUCH_FORMAT_JSON &&
format != NOTMUCH_FORMAT_SEXP)) {
fprintf (stderr, "Warning: --include-html only implemented for format=text, format=json and format=sexp\n");
fprintf (stderr,
"Warning: --include-html only implemented for format=text, format=json and format=sexp\n");
}
notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
mode = NOTMUCH_DATABASE_MODE_READ_WRITE;
if (notmuch_database_open_with_config (NULL,

View file

@ -187,7 +187,8 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,
}
int
notmuch_tag_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[])
notmuch_tag_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch,
int argc, char *argv[])
{
tag_op_list_t *tag_ops = NULL;
char *query_string = NULL;

View file

@ -39,8 +39,8 @@
*
*/
#define MINUTE (60)
#define HOUR (60 *MINUTE)
#define DAY (24 *HOUR)
#define HOUR (60 * MINUTE)
#define DAY (24 * HOUR)
#define RELATIVE_DATE_MAX 20
const char *
notmuch_time_relative_date (const void *ctx, time_t then)

View file

@ -31,7 +31,8 @@
* Each subcommand should be passed either a config object, or an open
* database
*/
typedef int (*command_function_t) (notmuch_config_t *config, notmuch_database_t *notmuch, int argc, char *argv[]);
typedef int (*command_function_t) (notmuch_config_t *config, notmuch_database_t *notmuch,
int argc, char *argv[]);
typedef struct command {
const char *name;
@ -125,7 +126,8 @@ notmuch_process_shared_indexing_options (notmuch_database_t *notmuch)
notmuch_status_t status;
if (indexing_cli_choices.opts == NULL)
return NOTMUCH_STATUS_OUT_OF_MEMORY;
status = notmuch_indexopts_set_decrypt_policy (indexing_cli_choices.opts, indexing_cli_choices.decrypt_policy);
status = notmuch_indexopts_set_decrypt_policy (indexing_cli_choices.opts,
indexing_cli_choices.decrypt_policy);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to set index decryption policy to %d. (%s)\n",
indexing_cli_choices.decrypt_policy, notmuch_status_to_string (status));
@ -144,9 +146,11 @@ static command_t commands[] = {
{ "setup", notmuch_setup_command, NOTMUCH_COMMAND_CONFIG_OPEN | NOTMUCH_COMMAND_CONFIG_CREATE,
"Interactively set up notmuch for first use." },
{ "new", notmuch_new_command,
NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE | NOTMUCH_COMMAND_DATABASE_CREATE,
NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE |
NOTMUCH_COMMAND_DATABASE_CREATE,
"Find and import new messages to the notmuch database." },
{ "insert", notmuch_insert_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
{ "insert", notmuch_insert_command, NOTMUCH_COMMAND_DATABASE_EARLY |
NOTMUCH_COMMAND_DATABASE_WRITE,
"Add a new message into the maildir and notmuch database." },
{ "search", notmuch_search_command, NOTMUCH_COMMAND_DATABASE_EARLY,
"Search for messages matching the given search terms." },
@ -162,11 +166,14 @@ static command_t commands[] = {
"Add/remove tags for all messages matching the search terms." },
{ "dump", notmuch_dump_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
"Create a plain-text dump of the tags for each message." },
{ "restore", notmuch_restore_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
{ "restore", notmuch_restore_command, NOTMUCH_COMMAND_DATABASE_EARLY |
NOTMUCH_COMMAND_DATABASE_WRITE,
"Restore the tags from the given dump file (see 'dump')." },
{ "compact", notmuch_compact_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
{ "compact", notmuch_compact_command, NOTMUCH_COMMAND_DATABASE_EARLY |
NOTMUCH_COMMAND_DATABASE_WRITE,
"Compact the notmuch database." },
{ "reindex", notmuch_reindex_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE,
{ "reindex", notmuch_reindex_command, NOTMUCH_COMMAND_DATABASE_EARLY |
NOTMUCH_COMMAND_DATABASE_WRITE,
"Re-index all messages matching the search terms." },
{ "config", notmuch_config_command, NOTMUCH_COMMAND_CONFIG_OPEN,
"Get or set settings in the notmuch configuration file." },
@ -248,14 +255,16 @@ void
notmuch_exit_if_unsupported_format (void)
{
if (notmuch_format_version > NOTMUCH_FORMAT_CUR) {
fprintf (stderr, "\
fprintf (stderr,
"\
A caller requested output format version %d, but the installed notmuch\n\
CLI only supports up to format version %d. You may need to upgrade your\n\
notmuch CLI.\n",
notmuch_format_version, NOTMUCH_FORMAT_CUR);
exit (NOTMUCH_EXIT_FORMAT_TOO_NEW);
} else if (notmuch_format_version < NOTMUCH_FORMAT_MIN) {
fprintf (stderr, "\
fprintf (stderr,
"\
A caller requested output format version %d, which is no longer supported\n\
by the notmuch CLI (it requires at least version %d). You may need to\n\
upgrade your notmuch front-end.\n",
@ -265,7 +274,8 @@ upgrade your notmuch front-end.\n",
/* Warn about old version requests so compatibility issues are
* less likely when we drop support for a deprecated format
* versions. */
fprintf (stderr, "\
fprintf (stderr,
"\
A caller requested deprecated output format version %d, which may not\n\
be supported in the future.\n", notmuch_format_version);
}
@ -339,7 +349,8 @@ _help_for (const char *topic_name)
}
static int
notmuch_help_command (unused (notmuch_config_t *config), unused(notmuch_database_t *notmuch), int argc, char *argv[])
notmuch_help_command (unused (notmuch_config_t *config), unused(notmuch_database_t *notmuch), int
argc, char *argv[])
{
int opt_index;

View file

@ -129,7 +129,7 @@ json_integer (struct sprinter *sp, int64_t val)
{
struct sprinter_json *spj = json_begin_value (sp);
fprintf (spj->stream, "%"PRId64, val);
fprintf (spj->stream, "%" PRId64, val);
}
static void

View file

@ -166,7 +166,7 @@ sexp_integer (struct sprinter *sp, int64_t val)
{
struct sprinter_sexp *sps = sexp_begin_value (sp);
fprintf (sps->stream, "%"PRId64, val);
fprintf (sps->stream, "%" PRId64, val);
}
static void

View file

@ -49,7 +49,7 @@ text_integer (struct sprinter *sp, int64_t val)
{
struct sprinter_text *sptxt = (struct sprinter_text *) sp;
fprintf (sptxt->stream, "%"PRId64, val);
fprintf (sptxt->stream, "%" PRId64, val);
}
static void