summaryrefslogtreecommitdiff
path: root/src/libunixonacid/buffer_timed_put.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libunixonacid/buffer_timed_put.c')
-rw-r--r--src/libunixonacid/buffer_timed_put.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libunixonacid/buffer_timed_put.c b/src/libunixonacid/buffer_timed_put.c
new file mode 100644
index 0000000..a645465
--- /dev/null
+++ b/src/libunixonacid/buffer_timed_put.c
@@ -0,0 +1,17 @@
+/* ISC license. */
+
+#include <stddef.h>
+
+#include <skalibs/buffer.h>
+#include <skalibs/unix-timed.h>
+
+size_t buffer_timed_put (buffer *b, char const *s, size_t len, tain const *deadline, tain *stamp)
+{
+ size_t w = 0 ;
+ for (;;)
+ {
+ w += buffer_putnoflush(b, s + w, len - w) ;
+ if (w >= len || !buffer_timed_flush(b, deadline, stamp)) break ;
+ }
+ return w ;
+}