sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 27a682be81444450b683da2be33e5b66e64e36f4
parent f4847603ef900ca74ecb62557d8c5665c6c777c9
Author: Dionysis Grigoropoulos <info@erethon.com>
Date:   Sun Apr  5 01:57:30 +0300

wc: Print number of bytes by default

According to POSIX, wc should by default print the number of bytes and
not the number of chars

Diffstat:
wc.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wc.c b/wc.c @@ -32,7 +32,7 @@ wc(FILE *fp, const char *str) size_t nc = 0, nl = 0, nw = 0; while ((rlen = efgetrune(&c, fp, str))) { - nc += (cmode == 'c') ? rlen : + nc += (cmode == 'c' || !cmode) ? rlen : (c != Runeerror) ? 1 : 0; if (c == '\n') nl++;