diff options
author | Jani Nikula <jani@nikula.org> | 2014-01-10 23:28:53 +0200 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2014-01-18 14:45:26 -0400 |
commit | c7453773064efbd0b2cd17b15ba483edbd28ce1e (patch) | |
tree | 00d526c4d671c4a793573fff423888d4b81beb05 /notmuch-setup.c | |
parent | 17e44cd584017c9187860e0dc80ea407940b8939 (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-setup.c')
-rw-r--r-- | notmuch-setup.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/notmuch-setup.c b/notmuch-setup.c index 475248b1..36a6171a 100644 --- a/notmuch-setup.c +++ b/notmuch-setup.c @@ -140,7 +140,7 @@ notmuch_setup_command (notmuch_config_t *config, fflush (stdout); \ if (getline (&response, &response_size, stdin) < 0) { \ printf ("Exiting.\n"); \ - exit (1); \ + exit (EXIT_FAILURE); \ } \ chomp_newline (response); \ } while (0) @@ -223,12 +223,11 @@ notmuch_setup_command (notmuch_config_t *config, g_ptr_array_free (tags, TRUE); } + if (notmuch_config_save (config)) + return EXIT_FAILURE; - if (! notmuch_config_save (config)) { - if (notmuch_config_is_new (config)) - welcome_message_post_setup (); - return 0; - } else { - return 1; - } + if (notmuch_config_is_new (config)) + welcome_message_post_setup (); + + return EXIT_SUCCESS; } |