From 3634d987840bd3ea3e679e02500fc76bb974818f Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 11 Mar 2008 19:49:08 +0100 Subject: The attached patch removes some global variables, and make them local to main(). (This used to be commit 50cab87d3ee6d701dd8847f4e0a058f5e2d80e0f) --- source3/utils/smbget.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c index e8fd6be6e6..1b284c1725 100644 --- a/source3/utils/smbget.c +++ b/source3/utils/smbget.c @@ -29,7 +29,7 @@ static int columns = 0; -static int _resume, _recursive, debuglevel, update; +static int debuglevel, update; static char *outputfile; @@ -540,13 +540,14 @@ int main(int argc, const char **argv) const char *file = NULL; char *rcfile = NULL; bool smb_encrypt = false; + int resume = 0, recursive = 0; TALLOC_CTX *frame = talloc_stackframe(); struct poptOption long_options[] = { {"guest", 'a', POPT_ARG_NONE, NULL, 'a', "Work as user guest" }, {"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" }, - {"resume", 'r', POPT_ARG_NONE, &_resume, 0, "Automatically resume aborted files" }, + {"resume", 'r', POPT_ARG_NONE, &resume, 0, "Automatically resume aborted files" }, {"update", 'U', POPT_ARG_NONE, &update, 0, "Download only when remote file is newer than local file or local file is missing"}, - {"recursive", 'R', POPT_ARG_NONE, &_recursive, 0, "Recursively download files" }, + {"recursive", 'R', POPT_ARG_NONE, &recursive, 0, "Recursively download files" }, {"username", 'u', POPT_ARG_STRING, &username, 'u', "Username to use" }, {"password", 'p', POPT_ARG_STRING, &password, 'p', "Password to use" }, {"workgroup", 'w', POPT_ARG_STRING, &workgroup, 'w', "Workgroup to use (optional)" }, @@ -595,11 +596,11 @@ int main(int argc, const char **argv) } } - if((send_stdout || _resume || outputfile) && update) { + if((send_stdout || resume || outputfile) && update) { fprintf(stderr, "The -o, -R or -O and -U options can not be used together.\n"); return 1; } - if((send_stdout || outputfile) && _recursive) { + if((send_stdout || outputfile) && recursive) { fprintf(stderr, "The -o or -O and -R options can not be used together.\n"); return 1; } @@ -626,10 +627,10 @@ int main(int argc, const char **argv) total_start_time = time(NULL); while ( (file = poptGetArg(pc)) ) { - if (!_recursive) - return smb_download_file(file, "", _recursive, _resume, outputfile); + if (!recursive) + return smb_download_file(file, "", recursive, resume, outputfile); else - return smb_download_dir(file, "", _resume); + return smb_download_dir(file, "", resume); } clean_exit(); -- cgit