summaryrefslogtreecommitdiff
path: root/l_cmd.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2013-09-16 13:43:01 (GMT)
committerChristian Pointner <equinox@helsinki.at>2013-09-16 13:43:01 (GMT)
commit549acaede7b62e4fcbb7c0bbc8b5e8f5ac420d9b (patch)
tree6639cea4b96bea4261fe40882f472b03a0f76b5e /l_cmd.c
parentba9fe029984b9b1614bdfc81072a3e95675bd74a (diff)
code cleanups and fixes (new gcc and clang)
Diffstat (limited to 'l_cmd.c')
-rw-r--r--l_cmd.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/l_cmd.c b/l_cmd.c
index 2d2a139..338b377 100644
--- a/l_cmd.c
+++ b/l_cmd.c
@@ -22,6 +22,7 @@
#include <lua.h>
#include <lauxlib.h>
+#include <unistd.h>
#include <sys/socket.h>
#include <errno.h>
@@ -33,6 +34,7 @@
#include "command_queue.h"
#include "client_list.h"
#include "log.h"
+#include "utils.h"
int cmd_fd;
read_buffer_t cmd_buffer;
@@ -43,7 +45,7 @@ static int l_cmd_getfd(lua_State *L)
luaL_error(L, "can't retreive signal fd");
lua_pushliteral(L, "fd");
- lua_gettable(L, -2);
+ lua_gettable(L, -2);
return 1;
}
@@ -84,7 +86,7 @@ static int cmd_recv_data(lua_State* L)
if(cmd_buffer.buf[cmd_buffer.offset] == '\n') {
cmd_buffer.buf[cmd_buffer.offset] = 0;
- lua_pushstring(L, cmd_buffer.buf);
+ lua_pushstring(L, (char *)(cmd_buffer.buf));
ret = lua_pcall(L, 1, 1, 0);
if(ret) {
@@ -96,7 +98,7 @@ static int cmd_recv_data(lua_State* L)
}
return -1;
}
-
+
ret = lua_tointeger(L, 1);
cmd_buffer.offset = 0;
break;
@@ -130,20 +132,20 @@ static int l_cmd_send_string(lua_State* L)
if(ret > 0)
ret = 0;
-
+
lua_pushinteger(L, ret);
return 1;
}
static const struct luaL_reg cmd_funcs [] = {
- { "init", l_cmd_init },
+ { "init", l_cmd_init },
{ "recv_data", l_cmd_recv_data },
{ "send_string", l_cmd_send_string },
{ NULL, NULL }
};
-LUALIB_API int luaopen_cmd(lua_State *L)
+LUALIB_API int luaopen_cmd(lua_State *L)
{
luaL_register(L, LUA_CMDLIBNAME, cmd_funcs);
return 1;