From aee9bc91b51c34a96acbcd1d36c1374bf3ec8312 Mon Sep 17 00:00:00 2001 From: Ben Winston Date: Thu, 9 May 2024 21:19:28 -0400 Subject: populate language --- booki.c | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- cgit v1.2.3