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:
4837364
)
typechecking, add set_confdir and set_savedir
author
Felix Fietkau
<nbd@openwrt.org>
Sun, 13 Apr 2008 12:42:48 +0000
(14:42 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Sun, 13 Apr 2008 12:42:48 +0000
(14:42 +0200)
lua/uci.c
patch
|
blob
|
history
diff --git
a/lua/uci.c
b/lua/uci.c
index
0a751d6
..
c69cf83
100644
(file)
--- a/
lua/uci.c
+++ b/
lua/uci.c
@@
-68,7
+68,7
@@
uci_lua_unload(lua_State *L)
struct uci_package *p;
const char *s;
struct uci_package *p;
const char *s;
- luaL_check
any
(L, 1);
+ luaL_check
string
(L, 1);
s = lua_tostring(L, -1);
p = find_package(s);
if (p) {
s = lua_tostring(L, -1);
p = find_package(s);
if (p) {
@@
-112,7
+112,7
@@
uci_lua_get(lua_State *L)
char *s;
int err = UCI_ERR_MEM;
char *s;
int err = UCI_ERR_MEM;
- luaL_check
any
(L, 1);
+ luaL_check
string
(L, 1);
s = strdup(lua_tostring(L, -1));
if (!s)
goto error;
s = strdup(lua_tostring(L, -1));
if (!s)
goto error;
@@
-163,10
+163,35
@@
error:
}
}
+static int
+uci_lua_set_confdir(lua_State *L)
+{
+ int ret;
+
+ luaL_checkstring(L, 1);
+ ret = uci_set_confdir(ctx, lua_tostring(L, -1));
+ lua_pushboolean(L, (ret == 0));
+ return 1;
+}
+
+static int
+uci_lua_set_savedir(lua_State *L)
+{
+ int ret;
+
+ luaL_checkstring(L, 1);
+ ret = uci_set_savedir(ctx, lua_tostring(L, -1));
+ lua_pushboolean(L, (ret == 0));
+
+ return 1;
+}
+
static const luaL_Reg uci[] = {
{ "load", uci_lua_load },
{ "unload", uci_lua_unload },
{ "get", uci_lua_get },
static const luaL_Reg uci[] = {
{ "load", uci_lua_load },
{ "unload", uci_lua_unload },
{ "get", uci_lua_get },
+ { "set_confdir", uci_lua_set_confdir },
+ { "set_savedir", uci_lua_set_savedir },
{ NULL, NULL },
};
{ NULL, NULL },
};