]> www.average.org Git - psmb.git/blob - examples/psmb.c
wip send/recv
[psmb.git] / examples / psmb.c
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include <poll.h>
4 #include <psmb.h>
5
6 static void logprt(void *log_priv, int priority, const char *format, ...)
7 {
8         va_list ap;
9         va_start(ap, format);
10         (void)vfprintf(stderr, format, ap);
11         (void)fprintf(stderr, "\n");
12         va_end(ap);
13 }
14
15 int main(int argc, char *argv[], char *envp[])
16 {
17         psmb_result_t res;
18         psmb_ctx_t *ctx = psmb_new();
19
20         printf("created psmb at %p\n", ctx);
21         res = psmb_set_logf(ctx, logprt, NULL);
22         res = psmb_open(ctx);
23         res = psmb_subscribe(ctx, "test-channel");
24         res = psmb_unsubscribe(ctx, "test-channel");
25         psmb_destroy(ctx);
26         return psmb_success(res);
27 }