diff options
| author | Ben Winston | 2024-05-23 21:39:28 -0400 |
|---|---|---|
| committer | Ben Winston | 2024-05-23 21:39:28 -0400 |
| commit | ae8913bfd92ad4eaaa7bfcf2b2819277568faa59 (patch) | |
| tree | ff971af436f62d6f1b541609bd5dbdf32263dbad | |
| parent | dbe56773532d8adaf547af91899978990984e853 (diff) | |
only write to temp file when asking to edit
| -rw-r--r-- | booki.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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++; } } |
