r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
[tprouty/samba.git] / source / utils / smbget.c
index 4a2670e0c169b5241c1a93c6c8ec25c3d1730277..5848fd4057ecc181b421f77b9db528a25ef5f189 100644 (file)
@@ -5,7 +5,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "includes.h"
 #include "libsmbclient.h"
@@ -50,9 +49,9 @@ const char *username = NULL, *password = NULL, *workgroup = NULL;
 int nonprompt = 0, quiet = 0, dots = 0, keep_permissions = 0, verbose = 0, send_stdout = 0;
 int blocksize = SMB_DEFAULT_BLOCKSIZE;
 
-int smb_download_file(const char *base, const char *name, int recursive, int resume, char *outfile);
+static int smb_download_file(const char *base, const char *name, int recursive, int resume, char *outfile);
 
-int get_num_cols(void)
+static int get_num_cols(void)
 {
 #ifdef TIOCGWINSZ
        struct winsize ws;
@@ -68,12 +67,12 @@ int get_num_cols(void)
 #endif
 }
 
-void change_columns(int sig)
+static void change_columns(int sig)
 {
        columns = get_num_cols();
 }
 
-void human_readable(off_t s, char *buffer, int l)
+static void human_readable(off_t s, char *buffer, int l)
 {
        if(s > 1024 * 1024 * 1024) snprintf(buffer, l, "%.2fGb", 1.0 * s / (1024 * 1024 * 1024));
        else if(s > 1024 * 1024) snprintf(buffer, l, "%.2fMb", 1.0 * s / (1024 * 1024));
@@ -81,7 +80,7 @@ void human_readable(off_t s, char *buffer, int l)
        else snprintf(buffer, l, OFF_T_FORMAT"b", (OFF_T_FORMAT_CAST)s);
 }
 
-void get_auth_data(const char *srv, const char *shr, char *wg, int wglen, char *un, int unlen, char *pw, int pwlen)
+static void get_auth_data(const char *srv, const char *shr, char *wg, int wglen, char *un, int unlen, char *pw, int pwlen)
 {
        static char hasasked = 0;
        char *wgtmp, *usertmp;
@@ -113,7 +112,7 @@ void get_auth_data(const char *srv, const char *shr, char *wg, int wglen, char *
        free(wgtmp); free(usertmp);
 }
 
-int smb_download_dir(const char *base, const char *name, int resume)
+static int smb_download_dir(const char *base, const char *name, int resume)
 {
        char path[SMB_MAXPATHLEN];
        int dirhandle;
@@ -199,7 +198,7 @@ int smb_download_dir(const char *base, const char *name, int resume)
        return 1;
 }
 
-char *print_time(long t)
+static char *print_time(long t)
 {
        static char buffer[100];
        int secs, mins, hours;
@@ -215,7 +214,7 @@ char *print_time(long t)
        return buffer;
 }
 
-void print_progress(const char *name, time_t start, time_t now, off_t start_pos, off_t pos, off_t total)
+static void print_progress(const char *name, time_t start, time_t now, off_t start_pos, off_t pos, off_t total)
 {
        double avg = 0.0;
        long  eta = -1; 
@@ -244,7 +243,7 @@ void print_progress(const char *name, time_t start, time_t now, off_t start_pos,
        free(filename); free(status);
 }
 
-int smb_download_file(const char *base, const char *name, int recursive, int resume, char *outfile) {
+static int smb_download_file(const char *base, const char *name, int recursive, int resume, char *outfile) {
        int remotehandle, localhandle;
        time_t start_time = time(NULL);
        const char *newpath;
@@ -388,7 +387,7 @@ int smb_download_file(const char *base, const char *name, int recursive, int res
                offset_check = 0;
        }
 
-       readbuf = SMB_MALLOC(blocksize);
+       readbuf = (char *)SMB_MALLOC(blocksize);
 
        /* Now, download all bytes from offset_download to the end */
        for(curpos = offset_download; curpos < remotestat.st_size; curpos+=blocksize) {
@@ -447,7 +446,7 @@ int smb_download_file(const char *base, const char *name, int recursive, int res
        return 1;
 }
 
-void clean_exit(void)
+static void clean_exit(void)
 {
        char bs[100];
        human_readable(total_bytes, bs, sizeof(bs));
@@ -455,12 +454,12 @@ void clean_exit(void)
        exit(0);
 }
 
-void signal_quit(int v)
+static void signal_quit(int v)
 {
        clean_exit();
 }
 
-int readrcfile(const char *name, const struct poptOption long_options[])
+static int readrcfile(const char *name, const struct poptOption long_options[])
 {
        FILE *fd = fopen(name, "r");
        int lineno = 0, i;