aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-show.c
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2014-01-10 23:28:53 +0200
committerDavid Bremner <david@tethera.net>2014-01-18 14:45:26 -0400
commitc7453773064efbd0b2cd17b15ba483edbd28ce1e (patch)
tree00d526c4d671c4a793573fff423888d4b81beb05 /notmuch-show.c
parent17e44cd584017c9187860e0dc80ea407940b8939 (diff)
cli: clean up exit status code returned by the cli commands
Apart from the status codes for format mismatches, the non-zero exit status codes have been arbitrary. Make the cli consistently return either EXIT_SUCCESS or EXIT_FAILURE.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r--notmuch-show.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index c07f8871..528694be 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1113,10 +1113,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
};
opt_index = parse_arguments (argc, argv, options, 1);
- if (opt_index < 0) {
- /* diagnostics already printed */
- return 1;
- }
+ if (opt_index < 0)
+ return EXIT_FAILURE;
/* decryption implies verification */
if (params.crypto.decrypt)
@@ -1143,7 +1141,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
case NOTMUCH_FORMAT_MBOX:
if (params.part > 0) {
fprintf (stderr, "Error: specifying parts is incompatible with mbox output format.\n");
- return 1;
+ return EXIT_FAILURE;
}
format = &format_mbox;
@@ -1193,22 +1191,22 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
query_string = query_string_from_args (config, argc-opt_index, argv+opt_index);
if (query_string == NULL) {
fprintf (stderr, "Out of memory\n");
- return 1;
+ return EXIT_FAILURE;
}
if (*query_string == '\0') {
fprintf (stderr, "Error: notmuch show requires at least one search term.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READ_ONLY, &notmuch))
- return 1;
+ return EXIT_FAILURE;
query = notmuch_query_create (notmuch, query_string);
if (query == NULL) {
fprintf (stderr, "Out of memory\n");
- return 1;
+ return EXIT_FAILURE;
}
/* Create structure printer. */
@@ -1242,5 +1240,5 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_query_destroy (query);
notmuch_database_destroy (notmuch);
- return ret;
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
}