skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit 4280d43e83deb0a9ed00ce362d3f01f273f24630
parent 7fe720f95ca1ce1cdd2c752d70edcbc0cf1836fc
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Fri, 28 Oct 2022 23:13:15 +0000

 Prepare for 2.12.1.0; add buffer_timed_put(s)

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
MNEWS | 3++-
Mdoc/index.html | 2+-
Mdoc/license.html | 2+-
Mdoc/upgrade.html | 4++--
Mpackage/deps.mak | 6++++--
Mpackage/info | 2+-
Msrc/include/skalibs/disize.h | 2+-
Msrc/include/skalibs/unix-timed.h | 4++++
Asrc/libunixonacid/buffer_timed_put.c | 17+++++++++++++++++
Asrc/libunixonacid/buffer_timed_puts.c | 10++++++++++
10 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS @@ -1,9 +1,10 @@ Changelog for skalibs. -In 2.12.0.2 +In 2.12.1.0 ----------- - Bugfixes. + - New functions: buffer_timed_put(), buffer_timed_puts(). In 2.12.0.1 diff --git a/doc/index.html b/doc/index.html @@ -60,7 +60,7 @@ with a standard C development environment </li> <h3> Download </h3> <ul> - <li> The current released version of skalibs is <a href="skalibs-2.12.0.2.tar.gz">2.12.0.2</a>. </li> + <li> The current released version of skalibs is <a href="skalibs-2.12.1.0.tar.gz">2.12.1.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/skalibs/">skalibs git repository</a>: diff --git a/doc/license.html b/doc/license.html @@ -74,7 +74,7 @@ color, or different text font. </li> <p> <em>I am aware that the previous restrictions sound completely ridiculous while the official skalibs documentation is incomplete. -As of 2.12.0.2, I'm not going to enforce those restrictions, but if you're +As of 2.12.1.0, I'm not going to enforce those restrictions, but if you're going to provide documentation for skalibs, don't keep it to yourself, please send it to me instead. :-) </em> </p> diff --git a/doc/upgrade.html b/doc/upgrade.html @@ -16,10 +16,10 @@ <a href="//skarnet.org/">skarnet.org</a> </p> -<h2> in 2.12.0.2 </h2> +<h2> in 2.12.1.0 </h2> <ul> - <li> No functional changes. </li> + <li> New functions: <tt>buffer_timed_put()</tt>, <tt>buffer_timed_puts()</tt>. </li> </ul> <h2> in 2.12.0.1 </h2> diff --git a/package/deps.mak b/package/deps.mak @@ -468,13 +468,13 @@ src/libstddjb/selfpipe_init.o src/libstddjb/selfpipe_init.lo: src/libstddjb/self src/libstddjb/selfpipe_internal.o src/libstddjb/selfpipe_internal.lo: src/libstddjb/selfpipe_internal.c src/include/skalibs/allreadwrite.h src/libstddjb/selfpipe-internal.h src/include/skalibs/sysdeps.h src/libstddjb/selfpipe_read.o src/libstddjb/selfpipe_read.lo: src/libstddjb/selfpipe_read.c src/include/skalibs/allreadwrite.h src/libstddjb/selfpipe-internal.h src/include/skalibs/selfpipe.h src/include/skalibs/sysdeps.h src/libstddjb/selfpipe_trap.o src/libstddjb/selfpipe_trap.lo: src/libstddjb/selfpipe_trap.c src/libstddjb/selfpipe-internal.h src/include/skalibs/selfpipe.h src/include/skalibs/sig.h src/include/skalibs/sysdeps.h -src/libstddjb/selfpipe_trapset.o src/libstddjb/selfpipe_trapset.lo: src/libstddjb/selfpipe_trapset.c src/include/skalibs/bsdsnowflake.h src/include/skalibs/nonposix.h src/include/skalibs/nsig.h src/libstddjb/selfpipe-internal.h src/include/skalibs/selfpipe.h src/include/skalibs/sig.h src/include/skalibs/sysdeps.h +src/libstddjb/selfpipe_trapset.o src/libstddjb/selfpipe_trapset.lo: src/libstddjb/selfpipe_trapset.c src/include/skalibs/nonposix.h src/include/skalibs/nsig.h src/libstddjb/selfpipe-internal.h src/include/skalibs/selfpipe.h src/include/skalibs/sig.h src/include/skalibs/sysdeps.h src/libstddjb/sgetopt.o src/libstddjb/sgetopt.lo: src/libstddjb/sgetopt.c src/include/skalibs/buffer.h src/include/skalibs/sgetopt.h src/libstddjb/sig0_scan.o src/libstddjb/sig0_scan.lo: src/libstddjb/sig0_scan.c src/include/skalibs/sig.h src/include/skalibs/types.h src/libstddjb/sig_altignore.o src/libstddjb/sig_altignore.lo: src/libstddjb/sig_altignore.c src/include/skalibs/sig.h src/libstddjb/sig_block.o src/libstddjb/sig_block.lo: src/libstddjb/sig_block.c src/include/skalibs/sig.h src/libstddjb/sig_blocknone.o src/libstddjb/sig_blocknone.lo: src/libstddjb/sig_blocknone.c src/include/skalibs/sig.h -src/libstddjb/sig_catch.o src/libstddjb/sig_catch.lo: src/libstddjb/sig_catch.c src/include/skalibs/functypes.h src/include/skalibs/sig.h +src/libstddjb/sig_catch.o src/libstddjb/sig_catch.lo: src/libstddjb/sig_catch.c src/include/skalibs/functypes.h src/include/skalibs/nonposix.h src/include/skalibs/nsig.h src/include/skalibs/sig.h src/libstddjb/sig_name.o src/libstddjb/sig_name.lo: src/libstddjb/sig_name.c src/libstddjb/sig-internal.h src/include/skalibs/sig.h src/libstddjb/sig_number.o src/libstddjb/sig_number.lo: src/libstddjb/sig_number.c src/libstddjb/sig-internal.h src/include/skalibs/sig.h src/libstddjb/sig_restoreto.o src/libstddjb/sig_restoreto.lo: src/libstddjb/sig_restoreto.c src/include/skalibs/sig.h @@ -708,6 +708,8 @@ src/libunixonacid/bufalloc_timed_flush.o src/libunixonacid/bufalloc_timed_flush. src/libunixonacid/buffer_timed_fill.o src/libunixonacid/buffer_timed_fill.lo: src/libunixonacid/buffer_timed_fill.c src/include/skalibs/allreadwrite.h src/include/skalibs/buffer.h src/include/skalibs/functypes.h src/include/skalibs/unix-timed.h src/libunixonacid/buffer_timed_flush.o src/libunixonacid/buffer_timed_flush.lo: src/libunixonacid/buffer_timed_flush.c src/include/skalibs/buffer.h src/include/skalibs/functypes.h src/include/skalibs/unix-timed.h src/libunixonacid/buffer_timed_get.o src/libunixonacid/buffer_timed_get.lo: src/libunixonacid/buffer_timed_get.c src/include/skalibs/buffer.h src/include/skalibs/functypes.h src/include/skalibs/unix-timed.h +src/libunixonacid/buffer_timed_put.o src/libunixonacid/buffer_timed_put.lo: src/libunixonacid/buffer_timed_put.c src/include/skalibs/buffer.h src/include/skalibs/unix-timed.h +src/libunixonacid/buffer_timed_puts.o src/libunixonacid/buffer_timed_puts.lo: src/libunixonacid/buffer_timed_puts.c src/include/skalibs/unix-timed.h src/libunixonacid/ipc_timed_recv.o src/libunixonacid/ipc_timed_recv.lo: src/libunixonacid/ipc_timed_recv.c src/include/skalibs/allreadwrite.h src/include/skalibs/functypes.h src/include/skalibs/socket.h src/include/skalibs/unix-timed.h src/libunixonacid/ipc_timed_send.o src/libunixonacid/ipc_timed_send.lo: src/libunixonacid/ipc_timed_send.c src/include/skalibs/error.h src/include/skalibs/iopause.h src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/unix-timed.h src/libunixonacid/ipc_timed_sendv.o src/libunixonacid/ipc_timed_sendv.lo: src/libunixonacid/ipc_timed_sendv.c src/include/skalibs/error.h src/include/skalibs/iopause.h src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/siovec.h src/include/skalibs/unix-timed.h diff --git a/package/info b/package/info @@ -1,4 +1,4 @@ package=skalibs -version=2.12.0.2 +version=2.12.1.0 category=prog package_macro_name=SKALIBS diff --git a/src/include/skalibs/disize.h b/src/include/skalibs/disize.h @@ -3,7 +3,7 @@ #ifndef SKALIBS_DISIZE_H #define SKALIBS_DISIZE_H -#include <sys/types.h> +#include <stddef.h> typedef struct disize_s disize, *disize_ref ; struct disize_s diff --git a/src/include/skalibs/unix-timed.h b/src/include/skalibs/unix-timed.h @@ -28,6 +28,10 @@ extern int buffer_timed_flush (buffer *, tain const *, tain *) ; #define buffer_timed_flush_g(b, deadline) buffer_timed_flush(b, (deadline), &STAMP) extern size_t buffer_timed_get (buffer *, char *, size_t, tain const *, tain *) ; #define buffer_timed_get_g(b, buf, buflen, deadline) buffer_timed_get(b, buf, buflen, (deadline), &STAMP) +extern size_t buffer_timed_put (buffer *, char const *, size_t, tain const *, tain *) ; +#define buffer_timed_put_g(b, s, len, deadline) buffer_timed_put(b, s, len, (deadline), &STAMP) +extern size_t buffer_timed_puts (buffer *, char const *, tain const *, tain *) ; +#define buffer_timed_puts_g(b, s, deadline) buffer_timed_puts(b, s, (deadline), &STAMP) extern int timed_getln (buffer *, stralloc *, char, tain const *, tain *) ; #define timed_getln_g(b, sa, sep, deadline) timed_getln(b, sa, sep, (deadline), &STAMP) diff --git a/src/libunixonacid/buffer_timed_put.c 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 ; +} diff --git a/src/libunixonacid/buffer_timed_puts.c b/src/libunixonacid/buffer_timed_puts.c @@ -0,0 +1,10 @@ +/* ISC license. */ + +#include <string.h> + +#include <skalibs/unix-timed.h> + +size_t buffer_timed_puts (buffer *b, char const *s, tain const *deadline, tain *stamp) +{ + return buffer_timed_put(b, s, strlen(s), deadline, stamp) ; +}