diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/src/LuaSL_utilities.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/LuaSL/src/LuaSL_utilities.c b/LuaSL/src/LuaSL_utilities.c index ab4ea65..e43bdeb 100644 --- a/LuaSL/src/LuaSL_utilities.c +++ b/LuaSL/src/LuaSL_utilities.c | |||
@@ -66,20 +66,36 @@ char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) | |||
66 | return (dateTime); | 66 | return (dateTime); |
67 | } | 67 | } |
68 | 68 | ||
69 | void sendBack(gameGlobals *game, Ecore_Con_Client *client, const char *SID, const char *message) | 69 | void sendBack(gameGlobals *game, Ecore_Con_Client *client, const char *SID, const char *message, ...) |
70 | { | 70 | { |
71 | va_list args; | ||
71 | char buf[PATH_MAX]; | 72 | char buf[PATH_MAX]; |
72 | 73 | int length = strlen(SID); | |
73 | sprintf(buf, "%s.%s\n", SID, message); | 74 | |
75 | strncpy(buf, SID, length); | ||
76 | buf[length++] = '.'; | ||
77 | va_start(args, message); | ||
78 | length += vsprintf(&buf[length], message, args); | ||
79 | va_end(args); | ||
80 | buf[length++] = '\n'; | ||
81 | buf[length++] = '\0'; | ||
74 | ecore_con_client_send(client, buf, strlen(buf)); | 82 | ecore_con_client_send(client, buf, strlen(buf)); |
75 | ecore_con_client_flush(client); | 83 | ecore_con_client_flush(client); |
76 | } | 84 | } |
77 | 85 | ||
78 | void sendForth(gameGlobals *game, const char *SID, const char *message) | 86 | void sendForth(gameGlobals *game, const char *SID, const char *message, ...) |
79 | { | 87 | { |
88 | va_list args; | ||
80 | char buf[PATH_MAX]; | 89 | char buf[PATH_MAX]; |
81 | 90 | int length = strlen(SID); | |
82 | snprintf(buf, sizeof(buf), "%s.%s\n", SID, message); | 91 | |
92 | strncpy(buf, SID, length); | ||
93 | buf[length++] = '.'; | ||
94 | va_start(args, message); | ||
95 | length += vsprintf(&buf[length], message, args); | ||
96 | va_end(args); | ||
97 | buf[length++] = '\n'; | ||
98 | buf[length++] = '\0'; | ||
83 | ecore_con_server_send(game->server, buf, strlen(buf)); | 99 | ecore_con_server_send(game->server, buf, strlen(buf)); |
84 | ecore_con_server_flush(game->server); | 100 | ecore_con_server_flush(game->server); |
85 | } | 101 | } |