aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--booki.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/booki.c b/booki.c
index a2a6084..a1215ec 100644
--- a/booki.c
+++ b/booki.c
@@ -493,7 +493,7 @@ char** search(int argc, char* argv[], char* booki_file) {
char* field;
int i;
- bool print = true;
+ bool match = true;
for (i = 0; i < search_opts.count; i++) {
field = search_opts.opts[i];
@@ -525,11 +525,13 @@ char** search(int argc, char* argv[], char* booki_file) {
break;
}
}
- print = i == search_opts.count;
+ match = i == search_opts.count;
- if (print) {
- print_book(*book, search_opts.show);
- write_book(*book, output);
+ if (match) {
+ if (search_opts.edit)
+ write_book(*book, output);
+ else
+ print_book(*book, search_opts.show);
book_count++;
}
}