aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Winston2024-05-09 21:19:28 -0400
committerBen Winston2024-05-09 21:19:28 -0400
commitaee9bc91b51c34a96acbcd1d36c1374bf3ec8312 (patch)
tree2961b6097d1010c10b80fdee66e1385e74bf56b6
parent96427d927477e5b6327ecb479d9722ca3ed5b571 (diff)
populate language
-rw-r--r--booki.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/booki.c b/booki.c
index fd2f212..7613495 100644
--- a/booki.c
+++ b/booki.c
@@ -112,6 +112,10 @@ struct Book parse_book(char* current_pos) {
struct es author = parse_string(current_pos, &new_pos);
book.author = author;
current_pos = new_pos;
+ } else if (strncmp(attr, "language", 8) == 0) {
+ struct es language = parse_string(current_pos, &new_pos);
+ book.language = language;
+ current_pos = new_pos;
}
// go to (and then past) the newline
@@ -306,6 +310,9 @@ char** search(int argc, char* argv[]) {
} else if (strcmp(field, "author") == 0) {
if (!regex_match(search_opts.args[i], book.author))
break;
+ } else if (strcmp(field, "language") == 0) {
+ if (!regex_match(search_opts.args[i], book.language))
+ break;
} else {
printf("unsupported field: %s\n", field);
break;