From c6369d3369fb11f408995948c8bef93549aba05c Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Thu, 21 Sep 2017 21:02:24 +0200 Subject: [PATCH] First build. --- src/Makefile.am | 4 ++-- src/commons.h | 6 ++++++ src/index.c | 14 +++++++------- src/main.c | 8 +++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index b03cec5..c2f2ddd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,7 @@ ctpldir = $(datadir)/$(PACKAGE)/ctpl formdir = $(datadir)/$(PACKAGE)/form imagesdir = $(datadir)/$(PACKAGE)/images -AM_CPPFLAGS = $(CONCORSIFE_CFLAGS) \ +AM_CPPFLAGS = $(ZAKJUKEBOX_CFLAGS) \ -DCONFIGDIR=\""$(configdir)"\" \ -DCTPLDIR=\""$(ctpldir)"\" \ -DFORMDIR=\""$(formdir)"\" \ @@ -15,7 +15,7 @@ LIBS = $(ZAKJUKEBOX_LIBS) \ bin_PROGRAMS = zakjukebox zakjukebox_SOURCES = \ - commons.c \ + commons.h \ index.c \ index.h \ main.c diff --git a/src/commons.h b/src/commons.h index 932502f..fe20ba0 100644 --- a/src/commons.h +++ b/src/commons.h @@ -36,6 +36,12 @@ typedef struct ZakConfi *confi; + ZakCgiMain *zcgi_main; + ZakCgiSession *zcgi_session; + + GString *header; + GString *out; + gchar *root; } Commons; diff --git a/src/index.c b/src/index.c index 7e47551..b28df34 100644 --- a/src/index.c +++ b/src/index.c @@ -25,23 +25,23 @@ void index_index (GMatchInfo *minfo, gpointer user_data) { - CtplEnviron *env; + /* CtplEnviron *env; */ gchar *filename; - gchar *contente; + gchar *content; Commons *commons = (Commons *)user_data; - env = ctpl_environ_new (); + /* env = ctpl_environ_new (); */ filename = g_build_filename (commons->ctpldir, "index_index.ctpl", NULL); /* content = solipa_ctpl_get_filled (commons->solipa_ctpl, filename, env); */ g_free (filename); - env = ctpl_environ_new (); - ctpl_environ_push_string (env, "head", ""); - ctpl_environ_push_string (env, "body_tag", ""); - ctpl_environ_push_string (env, "body", content); + /* env = ctpl_environ_new (); */ + /* ctpl_environ_push_string (env, "head", ""); */ + /* ctpl_environ_push_string (env, "body_tag", ""); */ + /* ctpl_environ_push_string (env, "body", content); */ filename = g_build_filename (commons->ctpldir, "template.ctpl", NULL); /* g_string_printf (commons->out, "%s", */ diff --git a/src/main.c b/src/main.c index 62695bb..31b8ec3 100644 --- a/src/main.c +++ b/src/main.c @@ -63,6 +63,8 @@ main (int argc, char *argv[]) commons->header = g_string_new (""); commons->out = g_string_new (""); + commons->zcgi_session = zak_cgi_session_new (commons->zcgi_main, "/zakjukebox", NULL); + /* Routing */ zcgi_url = zak_cgi_url_new (commons->zcgi_main); @@ -76,9 +78,9 @@ main (int argc, char *argv[]) if (g_strcmp0 (commons->header->str, "") == 0) { g_string_printf (commons->header, - "%s\n%s", - ZAK_CGI_STANDARD_HEADER_HTML, - zak_cgi_session_get_header (commons->zcgi_session)); + "%s\n%s", + ZAK_CGI_STANDARD_HEADER_HTML, + zak_cgi_session_get_header (commons->zcgi_session)); } zak_cgi_main_out_not_null_term (commons->header->str, commons->out->str, commons->out->len); -- 2.49.0