From b0de699679e8f1e39af847ed172d1ba605b4370c Mon Sep 17 00:00:00 2001 From: Klaatu Date: Sun, 17 May 2015 15:33:21 +1200 Subject: bulk upload of source --- lib/errmsg_put.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/errmsg_put.c (limited to 'lib/errmsg_put.c') diff --git a/lib/errmsg_put.c b/lib/errmsg_put.c new file mode 100644 index 0000000..9afe0ce --- /dev/null +++ b/lib/errmsg_put.c @@ -0,0 +1,20 @@ +#include +#include "../ninitfeatures.h" + +#ifndef ERRMSG_PUTS_LEN +#define ERRMSG_PUTS_LEN 15 +#endif + +void errmsg_put(int fd, const char *buf, unsigned int len) /*EXTRACT_INCL*/ { + static struct iovec errmsg_iov[ERRMSG_PUTS_LEN]; + static int k; + if (buf==0 || k==ERRMSG_PUTS_LEN) { + if (fd>=0) writev(fd,errmsg_iov,k); + k = 0; + } + if (buf && len) { + errmsg_iov[k].iov_base = (char *)buf; + errmsg_iov[k].iov_len = len; + k++; + } +} -- cgit v1.2.3