aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-count.c
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2014-01-10 23:28:53 +0200
committerGravatar David Bremner <david@tethera.net>2014-01-18 14:45:26 -0400
commitc7453773064efbd0b2cd17b15ba483edbd28ce1e (patch)
tree00d526c4d671c4a793573fff423888d4b81beb05 /notmuch-count.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-count.c')
-rw-r--r--notmuch-count.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/notmuch-count.c b/notmuch-count.c
index 01e4e301..6058f7c9 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -150,10 +150,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
};
opt_index = parse_arguments (argc, argv, options, 1);
-
- if (opt_index < 0) {
- return 1;
- }
+ if (opt_index < 0)
+ return EXIT_FAILURE;
if (input_file_name) {
batch = TRUE;
@@ -161,23 +159,23 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
if (input == NULL) {
fprintf (stderr, "Error opening %s for reading: %s\n",
input_file_name, strerror (errno));
- return 1;
+ return EXIT_FAILURE;
}
}
if (batch && opt_index != argc) {
fprintf (stderr, "--batch and query string are not compatible\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_str = query_string_from_args (config, argc-opt_index, argv+opt_index);
if (query_str == NULL) {
fprintf (stderr, "Out of memory.\n");
- return 1;
+ return EXIT_FAILURE;
}
if (exclude == EXCLUDE_TRUE) {
@@ -197,5 +195,5 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
if (input != stdin)
fclose (input);
- return ret;
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
}