diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2011-04-25 17:08:14 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2011-04-25 17:08:14 +0200 |
commit | dcf4bcc2d95faac5d7c4844ca841359526601c69 (patch) | |
tree | bb696ead3dadb09234337c2c4e7461a3f7a7ce88 /buffer.c | |
parent | Update man page with info about --connect-timeout (diff) | |
parent | * ipv6-0.4.16: fix mingw32 build (diff) | |
download | openvpn-dcf4bcc2d95faac5d7c4844ca841359526601c69.tar.xz |
Merge branch 'feat_ipv6_transport'
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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. |