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;
{
outptr = outbuf;
outlen = OUTBUF_SIZE;
- n = smb_iconv (cd, &addr, &len, &outptr, &outlen);
+ n = smb_iconv (cd, &addr, &len, &outptr, &outlen);
if (outptr != outbuf)
{
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;
{ "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
};
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;
}
}
/* Loop thru all arguments */
- process_fd(cd, fd, stdout);
+ process_fd(cd, fd, out);
close(fd);
}