summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2009-12-25 17:40:29 +0000
committerChristian Pointner <equinox@anylike.org>2009-12-25 17:40:29 +0000
commit9a08f38f2fd176308870c3f08c0f08045c85f3f9 (patch)
tree94a7f9fcd134546a29d8c675a0e60fb26d5d7595
parentoptions get passed to main_loop lua function (diff)
added log targets string list to opt tables as well
-rw-r--r--src/anylike.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/anylike.c b/src/anylike.c
index 3eb91cc..223eef5 100644
--- a/src/anylike.c
+++ b/src/anylike.c
@@ -33,6 +33,7 @@
#include "datatypes.h"
#include "options.h"
+#include "string_list.h"
#include "log.h"
#include "l_log.h"
#include "l_crypt.h"
@@ -142,6 +143,26 @@ void push_opt_value_boolean(lua_State* L, const int tidx, const char* key, const
lua_settable(L, tidx);
}
+void push_opt_string_list(lua_State* L, const int tidx, string_list_t* lst)
+{
+ if(!lst)
+ return;
+
+ string_list_element_t* tmp = lst->first_;
+ if(tmp) {
+ lua_pushstring(L, "log_targets");
+ lua_newtable(L);
+ int i = 1;
+ while(tmp) {
+ lua_pushinteger(L, i++);
+ lua_pushstring(L, tmp->string_);
+ lua_settable(L, -3);
+ tmp = tmp->next_;
+ }
+ lua_settable(L, tidx);
+ }
+}
+
void push_opt_table(lua_State* L, options_t* opt)
{
lua_newtable(L);
@@ -152,8 +173,7 @@ void push_opt_table(lua_State* L, options_t* opt)
push_opt_value_string(L, -3, "groupname", opt->groupname_);
push_opt_value_string(L, -3, "chroot_dir", opt->chroot_dir_);
push_opt_value_string(L, -3, "pid_file", opt->pid_file_);
-
-// string_list_t log_targets_;
+ push_opt_string_list(L, -3, &(opt->log_targets_));
}
int call_main_loop(lua_State* L, options_t* opt)