if (config == NULL)
return 1;
- notmuch = notmuch_database_open (notmuch_config_get_database_path (config));
+ notmuch = notmuch_database_open (notmuch_config_get_database_path (config),
+ NOTMUCH_DATABASE_MODE_READONLY);
if (notmuch == NULL)
return 1;
query_str = query_string_from_args (ctx, argc, argv);
if (query_str == NULL) {
- fprintf (stderr, "Out of moemory.\n");
+ fprintf (stderr, "Out of memory.\n");
+ return 1;
+ }
+ if (*query_str == '\0') {
+ fprintf (stderr, "Error: notmuch search requires at least one search term.\n");
return 1;
}