aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;