From 3534b428629be185e096be99e3bd5fdfe32d5544 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 18 Sep 2014 18:55:44 +0000 Subject: initial commit with rc for skalibs-2.0.0.0 --- src/libunixonacid/unixmessage_handle.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/libunixonacid/unixmessage_handle.c (limited to 'src/libunixonacid/unixmessage_handle.c') diff --git a/src/libunixonacid/unixmessage_handle.c b/src/libunixonacid/unixmessage_handle.c new file mode 100644 index 0000000..ad5789c --- /dev/null +++ b/src/libunixonacid/unixmessage_handle.c @@ -0,0 +1,19 @@ +/* ISC license. */ + +#include + +int unixmessage_handle (unixmessage_receiver_t *b, unixmessage_handler_func_t *f, void *p) +{ + unsigned int n = UNIXMESSAGE_MAXREADS ; + int count = 0 ; + while (n--) + { + unixmessage_t m ; + register int r = unixmessage_receive(b, &m) ; + if (r < 0) return -1 ; + if (!r) break ; + if (!(*f)(&m, p)) return -2 ; + count++ ; + } + return count ; +} -- cgit v1.3.1