summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-29 11:55:24 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-11-29 11:55:24 +0000
commitd1e53d9835133bb145c7230107ad2d6b3766db55 (patch)
tree3edaef720f677372032061da5cc09dc562eb5305 /module
parentc4ba0b69a823dfcce6b6fac4783abbdab2050245 (diff)
downloadiconv-d1e53d9835133bb145c7230107ad2d6b3766db55.tar.gz
iconv-d1e53d9835133bb145c7230107ad2d6b3766db55.tar.bz2
Test data for illegal utf-8 byte sequence.
Fix command line argument parsing somewhat. Ensure we output all the converted data, even if we're aborting because of an illegal byte sequence. svn path=/trunk/iconv/; revision=5818
Diffstat (limited to 'module')
-rw-r--r--module/module.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/module/module.c b/module/module.c
index f50d64a..591a721 100644
--- a/module/module.c
+++ b/module/module.c
@@ -228,8 +228,6 @@ _kernel_oserror *do_iconv(int argc, const char *args)
p++;
}
*f = '\0';
- while (*p == ' ')
- p++;
argc--;
break;
case 't':
@@ -246,8 +244,6 @@ _kernel_oserror *do_iconv(int argc, const char *args)
p++;
}
*t = '\0';
- while (*p == ' ')
- p++;
argc--;
break;
case 'l':
@@ -269,8 +265,6 @@ _kernel_oserror *do_iconv(int argc, const char *args)
p++;
}
*o = '\0';
- while (*p == ' ')
- p++;
argc--;
break;
case 'v':
@@ -290,6 +284,9 @@ _kernel_oserror *do_iconv(int argc, const char *args)
"Iconv: invalid option -- %c", *(p+1));
return &ErrorGeneric;
}
+
+ while (*p == ' ')
+ p++;
}
if (list) {
@@ -388,7 +385,12 @@ _kernel_oserror *do_iconv(int argc, const char *args)
"character sequence: "
"'%10s'\n", in);
}
+
if (stop_on_invalid) {
+ /* Flush through any output */
+ fwrite(output, 1,
+ sizeof(output) - outlen,
+ ofp);
iconv_close(cd);
fclose(ofp);
fclose(inf);