X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-restore.c;h=09dd6918e8d45ab5ff1696d4f08c5975dbf4f74b;hp=d3b9246237c54ee2561eecf4cba24499d2577d4e;hb=fe13a55421da077ceee3fb0def1db1154d152717;hpb=7400e18fb5f532524146f7083bf964c7e501bdc8 diff --git a/notmuch-restore.c b/notmuch-restore.c index d3b92462..09dd6918 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -115,15 +115,14 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) if (config == NULL) return 1; - notmuch = notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_WRITE); - if (notmuch == NULL) + if (notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much)) return 1; synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config); notmuch_opt_desc_t options[] = { - { NOTMUCH_OPT_POSITION, &input_file_name, 0, 0, 0 }, + { NOTMUCH_OPT_STRING, &input_file_name, "input", 'i', 0 }, { NOTMUCH_OPT_BOOLEAN, &accumulate, "accumulate", 'a', 0 }, { 0, 0, 0, 0, 0 } }; @@ -142,7 +141,6 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) input_file_name, strerror (errno)); return 1; } - optind++; } if (opt_index < argc) { @@ -192,7 +190,7 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) if (line) free (line); - notmuch_database_close (notmuch); + notmuch_database_destroy (notmuch); if (input != stdin) fclose (input);