From afd126e1d207c8fe7933562227f16684b00bfc7c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 13 May 2014 13:15:42 +1000 Subject: Finish separating out love. --- src/libraries/Runnr.c | 34 ++++++++++++++++++++++++++++++++++ src/libraries/Runnr.h | 4 ++++ 2 files changed, 38 insertions(+) (limited to 'src/libraries') diff --git a/src/libraries/Runnr.c b/src/libraries/Runnr.c index f316755..8109dd8 100644 --- a/src/libraries/Runnr.c +++ b/src/libraries/Runnr.c @@ -333,3 +333,37 @@ int push_lua(lua_State *L, char *params, ...) // Stack usage [-0, +n, em] free(f); return n; } + +void sendBack(Ecore_Con_Client *client, const char *SID, const char *message, ...) +{ + va_list args; + char buf[PATH_MAX]; + int length = strlen(SID); + + strncpy(buf, SID, length); + buf[length++] = '.'; + va_start(args, message); + length += vsprintf(&buf[length], message, args); + va_end(args); + buf[length++] = '\n'; + buf[length++] = '\0'; + ecore_con_client_send(client, buf, strlen(buf)); + ecore_con_client_flush(client); +} + +void sendForth(Ecore_Con_Server *server, const char *SID, const char *message, ...) +{ + va_list args; + char buf[PATH_MAX]; + int length = strlen(SID); + + strncpy(buf, SID, length); + buf[length++] = '.'; + va_start(args, message); + length += vsprintf(&buf[length], message, args); + va_end(args); + buf[length++] = '\n'; + buf[length++] = '\0'; + ecore_con_server_send(server, buf, strlen(buf)); + ecore_con_server_flush(server); +} diff --git a/src/libraries/Runnr.h b/src/libraries/Runnr.h index ac22039..d7386f6 100644 --- a/src/libraries/Runnr.h +++ b/src/libraries/Runnr.h @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -15,4 +16,7 @@ void dumpStack(lua_State *L, int i); int pull_lua(lua_State *L, int i, char *params, ...); int push_lua(lua_State *L, char *params, ...); +void sendBack(Ecore_Con_Client *client, const char *SID, const char *message, ...); +void sendForth(Ecore_Con_Server *server, const char *SID, const char *message, ...); + #endif -- cgit v1.1