]> code.citadel.org Git - citadel.git/blobdiff - ctdlsh/src/sockets.c
* Fleshed out the ctdlsh interface a bit. Right now it's just a simple shell that...
[citadel.git] / ctdlsh / src / sockets.c
index f949fe0eb89ae99ef5581ef9968922cc2c972515..1f3ad78eacbcc159cb5a2997c8a8f9abdcffb68f 100644 (file)
@@ -15,6 +15,7 @@
 #include <pwd.h>
 #include <errno.h>
 #include <stdarg.h>
+#include "ctdlsh.h"
 
 #ifndef INADDR_NONE
 #define INADDR_NONE 0xffffffff
@@ -167,3 +168,15 @@ int sock_puts(int sock, char *buf)
 }
 
 
+void sock_printf(int sock, const char *format,...)
+{
+       va_list arg_ptr;
+       char buf[4096];
+       size_t len;
+
+       va_start(arg_ptr, format);
+       vsnprintf(buf, sizeof buf, format, arg_ptr);
+       va_end(arg_ptr);
+
+       sock_write(sock, buf, strlen(buf));
+}