aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorJuanJo Ciarlante <jjo@google.com>2009-09-13 13:43:04 +0200
committerJuanJo Ciarlante <juanjosec@gmail.com>2011-03-25 13:30:28 +0100
commit8335caf929f21b317a0243a12285e1f04361db25 (patch)
treef5a13a5196bda5db8681614ad19f18f522e3dfaa /buffer.c
parentUse a version-less version identifier on the master branch (diff)
downloadopenvpn-8335caf929f21b317a0243a12285e1f04361db25.tar.xz
* rebased openvpn-2.1_rc1b.jjo.20061206.d.patch
* passes {udp,tcp}x{v4,v6} loopback tests * passes {udp,tcp}x{v6} remote tests
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index e2f8caa..c43cb47 100644
--- a/buffer.c
+++ b/buffer.c
@@ -214,6 +214,19 @@ buf_printf (struct buffer *buf, const char *format, ...)
return ret;
}
+void buf_puts(struct buffer *buf, const char *str)
+{
+ uint8_t *ptr = BEND (buf);
+ int cap = buf_forward_capacity (buf);
+ if (cap > 0)
+ {
+ strncpynt ((char *)ptr,str, cap);
+ *(buf->data + buf->capacity - 1) = 0; /* windows vsnprintf needs this */
+ buf->len += (int) strlen ((char *)ptr);
+ }
+}
+
+
/*
* This is necessary due to certain buggy implementations of snprintf,
* that don't guarantee null termination for size > 0.