diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-02-27 09:39:20 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2014-04-02 09:03:42 +0200 |
commit | c8519003a34dc7db44854a3d844d1c7432d52a78 (patch) | |
tree | 4a7126b77e0ec69dc189be276e022ed0e5531e75 /examples/libsmbclient/testbrowse.c | |
parent | 0b757c9bcfbe1e8db2c3f33f1a57d02d75c3186a (diff) | |
download | samba-c8519003a34dc7db44854a3d844d1c7432d52a78.tar.gz samba-c8519003a34dc7db44854a3d844d1c7432d52a78.tar.xz samba-c8519003a34dc7db44854a3d844d1c7432d52a78.zip |
examples/libsmbclient: avoid some compiler warnings
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'examples/libsmbclient/testbrowse.c')
-rw-r--r-- | examples/libsmbclient/testbrowse.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c index 2ae7ca1c49..0629653ef8 100644 --- a/examples/libsmbclient/testbrowse.c +++ b/examples/libsmbclient/testbrowse.c @@ -25,8 +25,7 @@ get_auth_data_with_context_fn(SMBCCTX * context, char * pPassword, int maxLenPassword); -int -main(int argc, char * argv[]) +int main(int argc, const char *argv[]) { int debug = 0; int debug_stderr = 0; @@ -73,7 +72,7 @@ main(int argc, char * argv[]) setbuf(stdout, NULL); - pc = poptGetContext("opendir", argc, (const char **)argv, long_options, 0); + pc = poptGetContext("opendir", argc, argv, long_options, 0); poptSetOtherOptionHelp(pc, ""); @@ -100,7 +99,7 @@ main(int argc, char * argv[]) if (context_auth) { smbc_setFunctionAuthDataWithContext(context, get_auth_data_with_context_fn); - smbc_setOptionUserData(context, (void *)"hello world"); + smbc_setOptionUserData(context, strdup("hello world")); } else { smbc_setFunctionAuthData(context, get_auth_data_fn); } @@ -126,20 +125,22 @@ main(int argc, char * argv[]) if (scan) { - for (; - iterations == -1 || iterations > 0; - iterations = (iterations == -1 ? iterations : --iterations)) - { + for (; iterations != 0;) { + if (iterations > 0) { + iterations--; + } + snprintf(buf, sizeof(buf), "smb://"); browse(buf, scan, 0); } } else { - for (; - iterations == -1 || iterations > 0; - iterations = (iterations == -1 ? iterations : --iterations)) - { + for (; iterations != 0;) { + if (iterations > 0) { + iterations--; + } + fputs("url: ", stdout); p = fgets(buf, sizeof(buf), stdin); if (! p) |