diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-12-08 01:00:46 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-12-08 01:00:46 +0000 |
commit | 124e67113db228290a9a8ff903f6eb4ab3b34e60 (patch) | |
tree | 06f2f646a56694fbb5b783476d4f3e78e09da0f5 /usr.bin/wc/wc.1 | |
parent | b3a3e2b011bd394f7c9576bedfaa0f498ced56f3 (diff) |
UTF-8 support: implement -m for character counting
and use iswspace(3) for word counting.
Requires using getline(3) rather than read(2)
to make sure that characters aren't chopped to pieces.
Using feedback from millert@ on an earlier version.
Feedback and OK tedu@.
Diffstat (limited to 'usr.bin/wc/wc.1')
-rw-r--r-- | usr.bin/wc/wc.1 | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/usr.bin/wc/wc.1 b/usr.bin/wc/wc.1 index 2e9525e3caa..afd78b00567 100644 --- a/usr.bin/wc/wc.1 +++ b/usr.bin/wc/wc.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: wc.1,v 1.25 2015/04/21 10:46:48 schwarze Exp $ +.\" $OpenBSD: wc.1,v 1.26 2015/12/08 01:00:44 schwarze Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" from: @(#)wc.1 8.2 (Berkeley) 4/19/94 .\" -.Dd $Mdocdate: April 21 2015 $ +.Dd $Mdocdate: December 8 2015 $ .Dt WC 1 .Os .Sh NAME @@ -72,9 +72,10 @@ using powers of 2 for sizes (K=1024, M=1048576, etc.). The number of lines in each input file is written to the standard output. .It Fl m -Intended to count characters instead of bytes; -currently an alias for -.Fl c . +Count characters instead of bytes, and use +.Xr iswspace 3 +instead of +.Xr isspace 3 . .It Fl w The number of words in each input file is written to the standard output. @@ -102,6 +103,20 @@ lines words bytes file_name The counts for lines, words, and bytes .Pq or characters are integers separated by spaces. +.Sh ENVIRONMENT +.Bl -tag -width LC_CTYPE +.It Ev LC_CTYPE +The character set +.Xr locale 1 , +defining which byte sequences form characters. +If unset or set to +.Qq C , +.Qq POSIX , +or an unsupported value, +.Fl m +has the same effect as +.Fl c . +.El .Sh EXIT STATUS .Ex -std wc .Sh SEE ALSO @@ -111,7 +126,7 @@ The .Nm utility is compliant with the .St -p1003.1-2008 -specification, except that it ignores the locale. +specification. .Pp The flag .Op Fl h @@ -121,7 +136,3 @@ A .Nm utility appeared in .At v1 . -.Sh BUGS -The -.Fl m -option counts bytes instead of characters. |