summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-11-29 11:55:24 (GMT)
committer John Mark Bell <jmb@netsurf-browser.org>2008-11-29 11:55:24 (GMT)
commitd1e53d9835133bb145c7230107ad2d6b3766db55 (patch)
tree3edaef720f677372032061da5cc09dc562eb5305
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
-rw-r--r--module/module.c14
-rw-r--r--test/data/utf8-ilseq.txt2
2 files changed, 10 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);
diff --git a/test/data/utf8-ilseq.txt b/test/data/utf8-ilseq.txt
new file mode 100644
index 0000000..a3f6d55
--- a/dev/null
+++ b/test/data/utf8-ilseq.txt
@@ -0,0 +1,2 @@
+This side-scroller is plenty of fun if you can deal with all the clichés. Spiderman is your typical, old-fashioned, jump-kick-punch game.
+