aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2011-04-25 17:08:14 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2011-04-25 17:08:14 +0200
commitdcf4bcc2d95faac5d7c4844ca841359526601c69 (patch)
treebb696ead3dadb09234337c2c4e7461a3f7a7ce88 /buffer.c
parentUpdate man page with info about --connect-timeout (diff)
parent* ipv6-0.4.16: fix mingw32 build (diff)
downloadopenvpn-dcf4bcc2d95faac5d7c4844ca841359526601c69.tar.xz
Merge branch 'feat_ipv6_transport'
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 3fa0cd3..51cf7c1 100644
--- a/buffer.c
+++ b/buffer.c
@@ -214,6 +214,23 @@ buf_printf (struct buffer *buf, const char *format, ...)
return ret;
}
+bool
+buf_puts(struct buffer *buf, const char *str)
+{
+ int ret = false;
+ 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);
+ ret = true;
+ }
+ return ret;
+}
+
+
/*
* This is necessary due to certain buggy implementations of snprintf,
* that don't guarantee null termination for size > 0.