[dev] [sbase][PATCH] wc: Print number of bytes by default

From: Dionysis Grigoropoulos <info_AT_erethon.com>
Date: Sun, 5 Apr 2015 01:57:30 +0300

According to POSIX, wc should by default print the number of bytes and
not the number of chars
---
 wc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/wc.c b/wc.c
index 0b196d8..a1d89d7 100644
--- a/wc.c
+++ b/wc.c
_AT_@ -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 == 0) ? rlen :
 		      (c != Runeerror) ? 1 : 0;
 		if (c == '\n')
 			nl++;
-- 
1.7.10.4
Received on Sun Apr 05 2015 - 00:57:30 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 05 2015 - 01:00:10 CEST