aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--booki.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/booki.c b/booki.c
index 83858e9..96d42a9 100644
--- a/booki.c
+++ b/booki.c
@@ -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;