Move send_buffer() and send_va_buffer() from net.c to fd.c.
[paraslash.git] / fd.c
diff --git a/fd.c b/fd.c
index 429960cc0ab3d822811a1702c56c99a9e4c1ff10..6f487c410020795a73476fa79ba552c2ad29e4fd 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -42,6 +42,25 @@ int write_all(int fd, const char *buf, size_t len)
        return len;
 }
 
+/**
+ * Send a buffer given by a format string.
+ *
+ * \param fd The file descriptor.
+ * \param fmt A format string.
+ *
+ * \return Standard.
+ */
+__printf_2_3 int write_va_buffer(int fd, const char *fmt, ...)
+{
+       char *msg;
+       int ret;
+
+       PARA_VSPRINTF(fmt, msg);
+       ret = write_buffer(fd, msg);
+       free(msg);
+       return ret;
+}
+
 /**
  * Write a buffer to a non-blocking file descriptor.
  *