summaryrefslogtreecommitdiff
path: root/examples/libsmbclient/testctx.c
blob: b5e6a63dd9b80b49893f1fefa425784b1b2b0376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <libsmbclient.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static void create_and_destroy_context (void)
{
	int i;
	SMBCCTX *ctx;
	char *option_name = strdup("debug_to_stderr");
	ctx = smbc_new_context ();
	/* Both should do the same thing */
	smbc_setOptionDebugToStderr(ctx, 1);
	smbc_option_set(ctx, option_name, 1);
	free(option_name);
	smbc_setDebug(ctx, 1);
	i = smbc_getDebug(ctx);
	if (i != 1) {
		printf("smbc_getDebug() did not return debug level set\n");
		exit(1);
	}
	if (!smbc_getOptionDebugToStderr(ctx)) {
		printf("smbc_setOptionDebugToStderr() did not stick\n");
		exit(1);
	}
	smbc_init_context (ctx);
	smbc_free_context (ctx, 1);
}

int main (int argc, char **argv)
{
	create_and_destroy_context ();
	create_and_destroy_context ();
	return 0;
}