r11833: fix build issues in smbget with the Sun compiler. Reported by Richard Bollinger
authorGerald Carter <jerry@samba.org>
Mon, 21 Nov 2005 15:52:10 +0000 (15:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:29 +0000 (11:05 -0500)
(This used to be commit d381c125b0ffc269fd8671a855c9b899966a2320)

source3/utils/smbget.c

index e8069802ca9e5fb8a6bafc498bfb08b5928150bd..eab5e5ac02f9591357ba6de2da798aa33c70febe 100644 (file)
 
 int columns = 0;
 
+static int _resume, _recursive, debuglevel;
+static char *outputfile;
+
+
 time_t total_start_time = 0;
 off_t total_bytes = 0;
 
@@ -507,16 +511,13 @@ int readrcfile(const char *name, const struct poptOption long_options[])
 
 int main(int argc, const char **argv)
 {
-       int resume = 0, recursive = 0;
        int c = 0;
-       int debuglevel = 0;
        const char *file = NULL;
        char *rcfile = NULL;
-       char *outputfile = NULL;
        struct poptOption long_options[] = {
                {"guest", 'a', POPT_ARG_NONE, NULL, 'a', "Work as user guest" },        
-               {"resume", 'r', POPT_ARG_NONE, &resume, 0, "Automatically resume aborted files" },
-               {"recursive", 'R',  POPT_ARG_NONE, &recursive, 0, "Recursively download files" },
+               {"resume", 'r', POPT_ARG_NONE, &_resume, 0, "Automatically resume aborted 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)" },
@@ -537,7 +538,8 @@ int main(int argc, const char **argv)
 
        /* only read rcfile if it exists */
        asprintf(&rcfile, "%s/.smbgetrc", getenv("HOME"));
-       if(access(rcfile, F_OK) == 0) readrcfile(rcfile, long_options);
+       if(access(rcfile, F_OK) == 0) 
+               readrcfile(rcfile, long_options);
        free(rcfile);
 
 #ifdef SIGWINCH
@@ -559,7 +561,7 @@ int main(int argc, const char **argv)
                }
        }
 
-       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;
        }
@@ -578,9 +580,11 @@ 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);
-               else return smb_download_dir(file, "", resume);
+       while ( (file = poptGetArg(pc)) ) {
+               if (!_recursive) 
+                       return smb_download_file(file, "", _recursive, _resume, outputfile);
+               else 
+                       return smb_download_dir(file, "", _resume);
        }
 
        clean_exit();