diff options
author | Rob Landley <rob@landley.net> | 2012-11-26 14:14:29 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-11-26 14:14:29 -0600 |
commit | 6cf0a115451d6d5ead94860f0731040dc2293db0 (patch) | |
tree | f04a6b76ca8572fccf01f1dc0b8b71710bde439c /toys | |
parent | 471ce1b29933702bdd63bf27e4470898cb37b451 (diff) | |
download | toybox-6cf0a115451d6d5ead94860f0731040dc2293db0.tar.gz |
Cleanup i18n support (#ifdefectomy, move global init to process launch). Teach make.sh to emit "#define FLAG_x 0" for options inside disabled USE macros so we can unconditionally refer to them.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/wc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/toys/posix/wc.c b/toys/posix/wc.c index 63128d67..d2eb306d 100644 --- a/toys/posix/wc.c +++ b/toys/posix/wc.c @@ -4,7 +4,7 @@ * * See http://opengroup.org/onlinepubs/9699919799/utilities/wc.html -USE_WC(NEWTOY(wc, "mcwl", TOYFLAG_USR|TOYFLAG_BIN)) +USE_WC(NEWTOY(wc, USE_TOYBOX_I18N("m")"cwl", TOYFLAG_USR|TOYFLAG_BIN)) config WC bool "wc" @@ -58,9 +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) { + if (CFG_TOYBOX_I18N && (toys.optflags&FLAG_m)) { clen = mbrtowc(&wchar, toybuf+i, len-i, 0); if(clen==(size_t)(-1)) { if(i!=len-1) { @@ -71,9 +70,7 @@ static void do_wc(int fd, char *name) if(clen==(size_t)(-2)) break; if(clen==0) clen=1; space = iswspace(wchar); - } else -#endif - space = isspace(toybuf[i]); + } else space = isspace(toybuf[i]); if (toybuf[i]==10) lengths[0]++; if (space) word=0; |