diff options
| author | Ben Winston | 2024-05-07 20:59:53 -0400 |
|---|---|---|
| committer | Ben Winston | 2024-05-07 20:59:53 -0400 |
| commit | ec4545806552880edad3e1e609060b93652bb925 (patch) | |
| tree | 89bec450f272507d6645d2dbe7ac1e701be09b87 | |
| parent | 7dad53094ebb5406bc4fb7dbdf77b30e3e190510 (diff) | |
initialize the struct
| -rw-r--r-- | booki.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -17,6 +17,8 @@ struct es { char* ptr; }; +struct es default_es = { 0, NULL }; + struct Book { struct es id; struct es title; @@ -32,6 +34,20 @@ struct Book { //struct es translators[MAX_TRANSLATORS]; }; +struct Book new_book() { + struct Book book; + book.id = default_es; + book.title = default_es; + book.author = default_es; + book.pages = 0; + book.isbn = default_es; + struct es language = { 7, "English" }; // default language + book.language = language; + book.translator = default_es; + book.published = 0; + return book; +} + char* BOOKI_FILE; int PARSE_LINE = 1; @@ -45,7 +61,7 @@ const char* get_last_word(const char* str) { } struct Book parse_book(char* current_pos) { - struct Book book; + struct Book book = new_book(); char* attr; char* value; char c = *current_pos; |
