aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/wc.c
diff options
context:
space:
mode:
authorFelix Janda <felix.janda@posteo.de>2012-11-21 20:38:29 +0100
committerFelix Janda <felix.janda@posteo.de>2012-11-21 20:38:29 +0100
commit250e0055fe0596f0f13d6e30f0bfe086702f5a25 (patch)
tree287e906cfd510fbc9fa52c47829814d4e4cba3e8 /toys/posix/wc.c
parentde51192c854d20b19d25daedca9e7ecdc72e13f1 (diff)
downloadtoybox-250e0055fe0596f0f13d6e30f0bfe086702f5a25.tar.gz
Make internalization support optional
Diffstat (limited to 'toys/posix/wc.c')
-rw-r--r--toys/posix/wc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/toys/posix/wc.c b/toys/posix/wc.c
index 19ba4b8b..63128d67 100644
--- a/toys/posix/wc.c
+++ b/toys/posix/wc.c
@@ -48,7 +48,6 @@ static void show_lengths(unsigned long *lengths, char *name)
static void do_wc(int fd, char *name)
{
int i, len, clen=1, space;
- wchar_t wchar;
unsigned long word=0, lengths[]={0,0,0};
for (;;) {
@@ -59,6 +58,8 @@ static void do_wc(int fd, char *name)
}
if (len<1) break;
for (i=0; i<len; i+=clen) {
+#ifdef CFG_TOYBOX_I18N
+ wchar_t wchar;
if(toys.optflags&8) {
clen = mbrtowc(&wchar, toybuf+i, len-i, 0);
if(clen==(size_t)(-1)) {
@@ -70,7 +71,9 @@ static void do_wc(int fd, char *name)
if(clen==(size_t)(-2)) break;
if(clen==0) clen=1;
space = iswspace(wchar);
- } else space = isspace(toybuf[i]);
+ } else
+#endif
+ space = isspace(toybuf[i]);
if (toybuf[i]==10) lengths[0]++;
if (space) word=0;
@@ -87,7 +90,6 @@ static void do_wc(int fd, char *name)
void wc_main(void)
{
- setlocale(LC_ALL, "");
toys.optflags |= (toys.optflags&8)>>1;
loopfiles(toys.optargs, do_wc);
if (toys.optc>1) show_lengths(TT.totals, "total");