more fiddling around with ctdlsh
[citadel.git] / ctdlsh / src / sockets.c
index f949fe0eb89ae99ef5581ef9968922cc2c972515..0d914b6ab4f52f3ea0f1004d158d3f1ed558b04c 100644 (file)
@@ -2,19 +2,7 @@
  *
  */
 
-#include <config.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
+#include "ctdlsh.h"
 
 #ifndef INADDR_NONE
 #define INADDR_NONE 0xffffffff
@@ -167,3 +155,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));
+}