Move openconnect_SSL_printf() to ssl.c
authorDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 31 May 2012 21:38:43 +0000 (22:38 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 31 May 2012 21:38:45 +0000 (22:38 +0100)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
gnutls.c
openssl.c
ssl.c

index e5dce59..9cdab8d 100644 (file)
--- a/gnutls.c
+++ b/gnutls.c
@@ -124,21 +124,6 @@ int openconnect_SSL_read(struct openconnect_info *vpninfo, char *buf, size_t len
        return done;
 }
 
-int  __attribute__ ((format (printf, 2, 3)))
-    openconnect_SSL_printf(struct openconnect_info *vpninfo, const char *fmt, ...)
-{
-       char buf[1024];
-       va_list args;
-
-       buf[1023] = 0;
-
-       va_start(args, fmt);
-       vsnprintf(buf, 1023, fmt, args);
-       va_end(args);
-       return openconnect_SSL_write(vpninfo, buf, strlen(buf));
-
-}
-
 int openconnect_SSL_gets(struct openconnect_info *vpninfo, char *buf, size_t len)
 {
        int i = 0;
index 61366bf..0c16264 100644 (file)
--- a/openssl.c
+++ b/openssl.c
@@ -161,21 +161,6 @@ int openconnect_SSL_read(struct openconnect_info *vpninfo, char *buf, size_t len
        return done;
 }
 
-int  __attribute__ ((format (printf, 2, 3)))
-    openconnect_SSL_printf(struct openconnect_info *vpninfo, const char *fmt, ...)
-{
-       char buf[1024];
-       va_list args;
-
-       buf[1023] = 0;
-
-       va_start(args, fmt);
-       vsnprintf(buf, 1023, fmt, args);
-       va_end(args);
-       return openconnect_SSL_write(vpninfo, buf, strlen(buf));
-
-}
-
 static int print_err(const char *str, size_t len, void *ptr)
 {
        struct openconnect_info *vpninfo = ptr;
diff --git a/ssl.c b/ssl.c
index 10a4fbc..b9759ba 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <stdarg.h>
 #if defined(__linux__)
 #include <sys/vfs.h>
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__APPLE__)
@@ -264,6 +265,21 @@ int connect_https_socket(struct openconnect_info *vpninfo)
        return ssl_sock;
 }
 
+int  __attribute__ ((format (printf, 2, 3)))
+    openconnect_SSL_printf(struct openconnect_info *vpninfo, const char *fmt, ...)
+{
+       char buf[1024];
+       va_list args;
+
+       buf[1023] = 0;
+
+       va_start(args, fmt);
+       vsnprintf(buf, 1023, fmt, args);
+       va_end(args);
+       return openconnect_SSL_write(vpninfo, buf, strlen(buf));
+
+}
+
 #if defined(__sun__) || defined(__NetBSD__) || defined(__DragonFly__)
 int openconnect_passphrase_from_fsid(struct openconnect_info *vpninfo)
 {