add examples directory with initial example
authorEugene Crosser <evgenii.cherkashin@cloud.ionos.com>
Wed, 13 Mar 2019 15:04:00 +0000 (16:04 +0100)
committerEugene Crosser <evgenii.cherkashin@cloud.ionos.com>
Wed, 13 Mar 2019 15:04:00 +0000 (16:04 +0100)
Signed-off-by: Eugene Crosser <evgenii.cherkashin@profitbricks.com>
examples/Makefile [new file with mode: 0644]
examples/psmb.c [new file with mode: 0644]

diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644 (file)
index 0000000..ac20e88
--- /dev/null
@@ -0,0 +1,3 @@
+CFLAGS = -Wall -I../include
+LDLIBS = -L../src -lpsmb
+
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;
+}