source: branches/samba-3.2.x/examples/libsmbclient/testbrowse.c

Last change on this file was 138, checked in by Paul Smedley, 17 years ago

Update source to 3.2.0 GA level

File size: 8.7 KB
Line 
1#include <sys/types.h>
2#include <unistd.h>
3#include <dirent.h>
4#include <errno.h>
5#include <stdio.h>
6#include <string.h>
7#include <popt.h>
8#include <stdlib.h>
9#include <libsmbclient.h>
10#include "get_auth_data_fn.h"
11
12static void
13no_auth_data_fn(const char * pServer,
14 const char * pShare,
15 char * pWorkgroup,
16 int maxLenWorkgroup,
17 char * pUsername,
18 int maxLenUsername,
19 char * pPassword,
20 int maxLenPassword);
21
22static void browse(char * path,
23 int scan,
24 int indent);
25
26
27static void
28get_auth_data_with_context_fn(SMBCCTX * context,
29 const char * pServer,
30 const char * pShare,
31 char * pWorkgroup,
32 int maxLenWorkgroup,
33 char * pUsername,
34 int maxLenUsername,
35 char * pPassword,
36 int maxLenPassword);
37
38int
39main(int argc, char * argv[])
40{
41 int debug = 0;
42 int debug_stderr = 0;
43 int no_auth = 0;
44 int context_auth = 0;
45 int scan = 0;
46 int iterations = -1;
47 int again;
48 int opt;
49 char * p;
50 char * q;
51 char buf[1024];
52 poptContext pc;
53 SMBCCTX * context;
54 struct poptOption long_options[] =
55 {
56 POPT_AUTOHELP
57 {
58 "debug", 'd', POPT_ARG_INT, &debug,
59 0, "Set debug level", "integer"
60 },
61 {
62 "stderr", 'e', POPT_ARG_NONE, &debug_stderr,
63 0, "Debug log to stderr instead of stdout", "integer"
64 },
65 {
66 "scan", 's', POPT_ARG_NONE, &scan,