Hi, i'm certainly not known for enthusiasm with respect to multibyte character support, but wc(1) is one example of a program where respecting LC_CTYPE would really make sense even to me, so i consider it a bug that wc -m currently is an alias for wc -c.
I'm proposing the somewhat simpler patch below for now. * No need to change .Nd. Counting characters is among the standardized purposes of wc(1), knowing that is useful for people developing shell scripts on OpenBSD because their scripts might do that when run elsewhere, and hopefully one day, they will even on OpenBSD. * No need to change [-c | -m] to [-cm] in the SYNOPSIS. even though our implementation currently doesn't enforce it, you should code like that for portability. * No need to specifically state that -c and -m are mutually exclusive, it's already clear from the SYNOPSIS, POSIX doesn't stress it explicitly either, and at least as long as we don't enforce it, it seems counter-productive to over-emphasize it. * No need to remove "(or characters)" from the format description. In the (only supported) C/POSIX locale, bytes and characters are synonyms, so it isn't wrong, and it does no harm to hint at how character counts are supposed to be displayed. OK? Ingo Index: wc.1 =================================================================== RCS file: /cvs/src/usr.bin/wc/wc.1,v retrieving revision 1.23 diff -u -r1.23 wc.1 --- wc.1 15 Nov 2014 13:55:25 -0000 1.23 +++ wc.1 2 Jan 2015 10:48:23 -0000 @@ -72,8 +72,9 @@ The number of lines in each input file is written to the standard output. .It Fl m -The number of characters in each input file -is written to the standard output. +Intended to count characters instead of bytes; +currently an alias for +.Fl c . .It Fl w The number of words in each input file is written to the standard output. @@ -85,11 +86,6 @@ The default action is equivalent to the flags .Fl clw having been specified. -The -.Fl c -and -.Fl m -options are mutually exclusive. .Pp If no file names are specified, the standard input is used and a file name is not output. @@ -103,11 +99,6 @@ lines words bytes file_name .Ed .Pp -If the -.Fl m -option is specified, -the number of bytes is replaced by -the number of characters in the listing above. The counts for lines, words, and bytes .Pq or characters are integers separated by spaces. @@ -120,7 +111,7 @@ .Nm utility is compliant with the .St -p1003.1-2008 -specification. +specification, except that it ignores the locale. .Pp The flag .Op Fl h @@ -130,3 +121,7 @@ .Nm utility appeared in .At v1 . +.Sh BUGS +The +.Fl m +option counts bytes instead of characters.
