diff --git a/hooks.c b/hooks.c index 1e84bc9..d06adc9 100644 --- a/hooks.c +++ b/hooks.c @@ -221,5 +221,8 @@ static const EB_Hook s_hooks[] = { */ void hooks_install(EB_Hookset* hookset) { - (void)hookset; + const int count = sizeof(s_hooks) / sizeof(s_hooks[0]); + for (int i = 0; i < count; ++i) { + eb_set_hook(hookset, s_hooks + i); + } } diff --git a/hooks.h b/hooks.h index ed8fc0e..2741862 100644 --- a/hooks.h +++ b/hooks.h @@ -19,5 +19,8 @@ #ifndef HOOKS_H #define HOOKS_H +#include "eb/eb/eb.h" + +void hooks_install(EB_Hookset* hookset); #endif diff --git a/main.c b/main.c index b958f01..8b06573 100644 --- a/main.c +++ b/main.c @@ -23,8 +23,10 @@ #include "convert.h" #include "util.h" +#include "hooks.h" #include "eb/eb/eb.h" +#include "eb/text.h" #include "eb/eb/error.h" #define MAX_HITS 256 @@ -96,9 +98,14 @@ static void export_book(const char path[], Book* book) { EB_Book eb_book; eb_initialize_book(&eb_book); + EB_Hookset eb_hookset; + eb_initialize_hookset(&eb_hookset); + hooks_install(&eb_hookset); + if ((error = eb_bind(&eb_book, path)) != EB_SUCCESS) { fprintf(stderr, "Failed to bind book: %s\n", eb_error_message(error)); eb_finalize_book(&eb_book); + eb_finalize_hookset(&eb_hookset); eb_finalize_library(); break; } @@ -156,6 +163,7 @@ static void export_book(const char path[], Book* book) { } eb_finalize_book(&eb_book); + eb_finalize_hookset(&eb_hookset); eb_finalize_library(); } while(0);