diff options
| author | Ben Winston | 2024-05-09 21:19:28 -0400 |
|---|---|---|
| committer | Ben Winston | 2024-05-09 21:19:28 -0400 |
| commit | aee9bc91b51c34a96acbcd1d36c1374bf3ec8312 (patch) | |
| tree | 2961b6097d1010c10b80fdee66e1385e74bf56b6 | |
| parent | 96427d927477e5b6327ecb479d9722ca3ed5b571 (diff) | |
populate language
| -rw-r--r-- | booki.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; |
