projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
42c5188
)
add uci.unload to the lua plugin
author
Felix Fietkau
<nbd@openwrt.org>
Sun, 13 Apr 2008 11:32:16 +0000
(13:32 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Sun, 13 Apr 2008 11:32:16 +0000
(13:32 +0200)
lua/uci.c
patch
|
blob
|
history
diff --git
a/lua/uci.c
b/lua/uci.c
index
026569f
..
0a751d6
100644
(file)
--- a/
lua/uci.c
+++ b/
lua/uci.c
@@
-63,7
+63,7
@@
done:
}
static int
}
static int
-uci_lua_load(lua_State *L)
+uci_lua_
un
load(lua_State *L)
{
struct uci_package *p;
const char *s;
{
struct uci_package *p;
const char *s;
@@
-73,8
+73,23
@@
uci_lua_load(lua_State *L)
p = find_package(s);
if (p) {
uci_unload(ctx, p);
p = find_package(s);
if (p) {
uci_unload(ctx, p);
- p = NULL;
+ lua_pushboolean(L, 1);
+ } else {
+ lua_pushboolean(L, 0);
}
}
+ return 1;
+}
+
+static int
+uci_lua_load(lua_State *L)
+{
+ struct uci_package *p = NULL;
+ const char *s;
+
+ uci_lua_unload(L);
+ lua_pop(L, 1); /* bool ret value of unload */
+ s = lua_tostring(L, -1);
+
if (uci_load(ctx, s, &p)) {
uci_lua_perror(L, "uci.load");
lua_pushboolean(L, 0);
if (uci_load(ctx, s, &p)) {
uci_lua_perror(L, "uci.load");
lua_pushboolean(L, 0);
@@
-150,6
+165,7
@@
error:
static const luaL_Reg uci[] = {
{ "load", uci_lua_load },
static const luaL_Reg uci[] = {
{ "load", uci_lua_load },
+ { "unload", uci_lua_unload },
{ "get", uci_lua_get },
{ NULL, NULL },
};
{ "get", uci_lua_get },
{ NULL, NULL },
};