From 2af243319a90ce19a4ef35e7224fea80447ad68d Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Wed, 13 Mar 2019 16:04:00 +0100 Subject: [PATCH 1/1] add examples directory with initial example Signed-off-by: Eugene Crosser --- examples/Makefile | 3 +++ examples/psmb.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 examples/Makefile create mode 100644 examples/psmb.c diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 0000000..ac20e88 --- /dev/null +++ b/examples/Makefile @@ -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 index 0000000..2f0d6ea --- /dev/null +++ b/examples/psmb.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include + +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; +} -- 2.39.2