From: Eugene Crosser Date: Wed, 13 Mar 2019 15:04:00 +0000 (+0100) Subject: add examples directory with initial example X-Git-Url: http://www.average.org/gitweb/?p=psmb.git;a=commitdiff_plain;h=2af243319a90ce19a4ef35e7224fea80447ad68d add examples directory with initial example Signed-off-by: Eugene Crosser --- 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; +}