]> www.average.org Git - psmb.git/blobdiff - examples/psmb.c
add examples directory with initial example
[psmb.git] / examples / psmb.c
diff --git a/examples/psmb.c b/examples/psmb.c
new file mode 100644 (file)
index 0000000..2f0d6ea
--- /dev/null
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <poll.h>
+#include <psmb.h>
+
+static void logprt(void *log_priv, int priority, const char *format, ...)
+{
+       va_list ap;
+       va_start(ap, format);
+       (void)vfprintf(stderr, format, ap);
+       (void)fprintf(stderr, "\n");
+       va_end(ap);
+}
+
+int main(int argc, char *argv[], char *envp[])
+{
+       psmb_result_t res;
+       psmb_ctx_t *ctx = psmb_new();
+
+       printf("created psmb at %p\n", ctx);
+       res = psmb_set_logf(ctx, logprt, NULL);
+       res = psmb_open(ctx);
+       psmb_destroy(ctx);
+       return 0;
+}