From c54d71e63b3b691e9dde5e0e053d2c04b09888a2 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 7 Mar 2003 14:57:36 +0000 Subject: [PATCH] Implement listing of all currently connected clients on a mountpoint svn path=/trunk/net/; revision=4434 --- net/sock.c | 9 +++++++++ net/sock.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/net/sock.c b/net/sock.c index f31491b..d5a8f51 100644 --- a/net/sock.c +++ b/net/sock.c @@ -314,6 +314,15 @@ int sock_write(sock_t sock, const char *fmt, ...) return sock_write_bytes(sock, buff, strlen(buff)); } +int sock_write_fmt(sock_t sock, char *fmt, va_list ap) +{ + char buff[1024]; + + vsnprintf(buff, 1024, fmt, ap); + + return sock_write_bytes(sock, buff, strlen(buff)); +} + int sock_read_bytes(sock_t sock, char *buff, const int len) { diff --git a/net/sock.h b/net/sock.h index 6944bd0..c4d78e7 100644 --- a/net/sock.h +++ b/net/sock.h @@ -22,6 +22,7 @@ #ifndef __SOCK_H #define __SOCK_H +#include #ifdef _WIN32 #include @@ -87,6 +88,7 @@ int sock_connected (int sock, unsigned timeout); /* Socket write functions */ int sock_write_bytes(sock_t sock, const void *buff, const size_t len); int sock_write(sock_t sock, const char *fmt, ...); +int sock_write_fmt(sock_t sock, char *fmt, va_list ap); int sock_write_string(sock_t sock, const char *buff); ssize_t sock_writev (int sock, const struct iovec *iov, const size_t count);