r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
[tprouty/samba.git] / source3 / torture / smbiconv.c
index 3524136fb1e786c99f9732f70e88ed133d13e100..05a8c3d8159cd9b78a54e6c809c2ea348fd952c8 100644 (file)
@@ -8,7 +8,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,
    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"
 
 static int
-process_block (smb_iconv_t cd, char *addr, size_t len, FILE *output)
+process_block (smb_iconv_t cd, const char *addr, size_t len, FILE *output)
 {
 #define OUTBUF_SIZE    32768
   const char *start = addr;
@@ -37,7 +36,7 @@ process_block (smb_iconv_t cd, char *addr, size_t len, FILE *output)
     {
       outptr = outbuf;
       outlen = OUTBUF_SIZE;
-      n = smb_iconv (cd, &addr, &len, &outptr, &outlen);
+      n = smb_iconv (cd,  &addr, &len, &outptr, &outlen);
 
       if (outptr != outbuf)
        {
@@ -171,7 +170,7 @@ int main(int argc, char *argv[])
        char *from = "";
        char *to = "";
        char *output = NULL;
-       char *preload = NULL;
+       const char *preload_modules[] = {NULL, NULL};
        FILE *out = stdout;
        int fd;
        smb_iconv_t cd;
@@ -184,7 +183,7 @@ int main(int argc, char *argv[])
                { "from-code", 'f', POPT_ARG_STRING, &from, 0, "Encoding of original text" },
                { "to-code", 't', POPT_ARG_STRING, &to, 0, "Encoding for output" },
                { "output", 'o', POPT_ARG_STRING, &output, 0, "Write output to this file" },
-               { "preload-modules", 'p', POPT_ARG_STRING, &preload, 0, "Modules to load" },
+               { "preload-modules", 'p', POPT_ARG_STRING, &preload_modules[0], 0, "Modules to load" },
                POPT_COMMON_SAMBA
                POPT_TABLEEND
        };
@@ -202,12 +201,12 @@ int main(int argc, char *argv[])
           facilities.  See lib/debug.c */
        setup_logging("smbiconv", True);
 
-       if(preload)smb_load_modules(str_list_make(preload, NULL));
+       if (preload_modules[0]) smb_load_modules(preload_modules);
 
        if(output) {
-               output = fopen(output, "w");
+               out = fopen(output, "w");
 
-               if(!output) {
+               if(!out) {
                        DEBUG(0, ("Can't open output file '%s': %s, exiting...\n", output, strerror(errno)));
                        return 1;
                }
@@ -231,7 +230,7 @@ int main(int argc, char *argv[])
                }
 
                /* Loop thru all arguments */
-               process_fd(cd, fd, stdout);
+               process_fd(cd, fd, out);
 
                close(fd);
        }