Browse Source

Resolve conflict caused by 'rebase'

Stanislav Galabov 11 years ago
parent
commit
7b83ec7f7e

+ 13 - 0
plugins/lua/lua_fini.c

@@ -0,0 +1,13 @@
+#include <stdlib.h>
+
+#include "private.h"
+
+CLISH_HOOK_FINI(clish_plugin_lua_fini)
+{
+	clish_context_t *context = (clish_context_t *) clish_context;
+	lua_State *L = clish_shell__del_udata(context->shell, LUA_UDATA);
+
+	lua_close(L);
+
+	return (0);
+}

+ 17 - 0
plugins/lua/lua_init.c

@@ -6,8 +6,11 @@
 
 #include "private.h"
 
+<<<<<<< HEAD
 char *scripts_path = NULL;
 
+=======
+>>>>>>> b9e9072034ce6f652f230161cea580b52cf5a9b9
 static bool_t
 load_scripts(lua_State *L, char *path)
 {
@@ -62,6 +65,16 @@ load_scripts(lua_State *L, char *path)
 int clish_plugin_init_lua(clish_shell_t *shell)
 {
 	lua_State *L = NULL;
+<<<<<<< HEAD
+=======
+	char *scripts_path = getenv("CLISH_SCRIPTS_PATH");
+
+	if (!scripts_path)
+		if(!(scripts_path = getenv("CLISH_PATH"))) {
+			printf("%s: Lua scripts dir not specified\n", __func__);
+			return (-1);
+		}
+>>>>>>> b9e9072034ce6f652f230161cea580b52cf5a9b9
 
 	if (!(L = luaL_newstate())) {
 		printf("%s: Failed to instantiate Lua interpreter\n", __func__);
@@ -70,7 +83,11 @@ int clish_plugin_init_lua(clish_shell_t *shell)
 
 	luaL_openlibs(L);
 
+<<<<<<< HEAD
 	if (scripts_path && !load_scripts(L, scripts_path)) {
+=======
+	if (!load_scripts(L, scripts_path)) {
+>>>>>>> b9e9072034ce6f652f230161cea580b52cf5a9b9
 		return (-1);
 	}
 

+ 5 - 0
plugins/lua/module.am

@@ -20,7 +20,12 @@ nobase_include_HEADERS		+= \
 
 clish_plugin_lua_la_SOURCES	+= \
 	plugins/lua/plugin_init.c \
+<<<<<<< HEAD
 	plugins/lua/plugin_fini.c \
 	plugins/lua/lua_init.c \
+=======
+	plugins/lua/lua_init.c \
+	plugins/lua/lua_fini.c \
+>>>>>>> b9e9072034ce6f652f230161cea580b52cf5a9b9
 	plugins/lua/lua_action.c \
 	plugins/lua/lua_print_error.c

+ 8 - 0
plugins/lua/plugin_init.c

@@ -2,6 +2,7 @@
 
 CLISH_PLUGIN_INIT
 {
+<<<<<<< HEAD
 	char *conf = clish_plugin__get_conf(plugin);
 
 	if (conf)
@@ -11,6 +12,13 @@ CLISH_PLUGIN_INIT
 
 	clish_plugin__set_name(plugin, "lua_hooks");
 
+=======
+
+	clish_plugin_init_lua((clish_shell_t *)clish_shell);
+
+	clish_plugin_add_phook(plugin, clish_plugin_lua_fini, "hook_fini",
+			CLISH_SYM_TYPE_FINI);
+>>>>>>> b9e9072034ce6f652f230161cea580b52cf5a9b9
 	clish_plugin_add_sym(plugin, clish_plugin_lua_action, "hook_action");
 
 	return 0;

+ 7 - 0
plugins/lua/private.h

@@ -9,10 +9,17 @@
 
 #define LUA_UDATA	"lua state"
 
+<<<<<<< HEAD
 extern char *scripts_path;
 void l_print_error(lua_State *, const char *, const char *, int);
 int clish_plugin_init_lua(clish_shell_t *shell);
 
+=======
+void l_print_error(lua_State *, const char *, const char *, int);
+int clish_plugin_init_lua(clish_shell_t *shell);
+
+CLISH_HOOK_FINI(clish_plugin_lua_fini);
+>>>>>>> b9e9072034ce6f652f230161cea580b52cf5a9b9
 CLISH_PLUGIN_SYM(clish_plugin_lua_action);
 
 #endif /* _PLUGIN_H_ */

+ 6 - 0
xml-examples/lua/startup.xml

@@ -4,8 +4,14 @@
  xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
                      http://clish.sourceforge.net/XMLSchema/clish.xsd">
 
+<<<<<<< HEAD
      <PLUGIN name="lua_hooks"
 	     file="clish_plugin_lua.so">/usr2/klish-rw/xml-examples/lua</PLUGIN>
+=======
+	<PLUGIN name="lua_hooks" file="clish_plugin_lua.so"/>
+
+	<HOOK name="fini" builtin="hook_fini@lua_hooks"/>
+>>>>>>> b9e9072034ce6f652f230161cea580b52cf5a9b9
 
 	<!--
 	<STARTUP view="test-view"/>