summaryrefslogtreecommitdiff
path: root/l_cmd.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-01-11 22:07:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-01-11 22:07:08 (GMT)
commitac5234abe456612ac617a218675e926fa45879eb (patch)
treeab80b537e788da550c6a455a0e9584f0ec959fb6 /l_cmd.c
parent37ccdda9932a28ca4b974760978f6d6234007059 (diff)
luaclient send to cmd fd works now
Diffstat (limited to 'l_cmd.c')
-rw-r--r--l_cmd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/l_cmd.c b/l_cmd.c
index baf8db7..2d2a139 100644
--- a/l_cmd.c
+++ b/l_cmd.c
@@ -122,7 +122,17 @@ static int l_cmd_recv_data(lua_State* L)
static int l_cmd_send_string(lua_State* L)
{
- return 0;
+ int ret = send_string(cmd_fd, luaL_checkstring(L,1));
+ if (ret > 0)
+ do {
+ ret = write(cmd_fd, "\n", 1);
+ } while(!ret || (ret == -1 && errno == EINTR));
+
+ if(ret > 0)
+ ret = 0;
+
+ lua_pushinteger(L, ret);
+ return 1;
}
static const struct luaL_reg cmd_funcs [] = {