Skip site navigation (1)Skip section navigation (2)
Date:      30 Jan 2003 20:51:17 -0800
From:      "Gary W. Swearingen" <swear@attbi.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   docs/47705: wc(1) manpage has poor explanations.
Message-ID:  <lhn0lhj516.0lh@localhost.localdomain>

next in thread | raw e-mail | index | archive | help

>Number:         47705
>Category:       docs
>Synopsis:       wc(1) manpage has poor explanations.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 30 21:00:24 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Gary W. Swearingen
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
none
>Environment:
n/a
================
>Description:

1) The wc(1) manpage has poor explanations, particularly the definitions of
lines and words.

2) The manpage doesn't explain that only the latter of -c & -m is used.

3) The first paragraph is too big and unorganized. (Better to give
general description, then explanations of lines, words, chararacters.)

4) The manpage refers users to a programmer's manpage.  (Better to just
say what the command does, since it's not hard.  A second reference to
the programmer's manpage can be left in the COMPATIBILITY section and
there's no longer any need for a "See Also" section.)

5) There are several other minor problems. (See patch.)
================
>How-To-Repeat:
n/a
================
>Fix:

Patch this:
.\" $FreeBSD: src/usr.bin/wc/wc.1,v 1.6.2.4 2002/08/25 02:47:04 tjr Exp $
with this:

--- /pr/work/wc..orig.1	Thu Jan 30 18:40:13 2003
+++ /pr/work/wc.1	Thu Jan 30 20:28:54 2003
@@ -48,35 +48,47 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility displays the number of lines, words, and bytes contained in each
+utility displays the number of lines, words,
+bytes (or characters), and filename of each
 input
 .Ar file
-(or standard input, by default) to the standard output.
-A line is defined as a string of characters delimited by a <newline>
-character,
-and a word is defined as a string of characters delimited by white space
-characters.
-White space characters are the set of characters for which the
-.Xr isspace 3
-function returns true.
-If more than one input file is specified, a line of cumulative counts
-for all the files is displayed on a separate line after the output for
-the last file.
+to the standard output (on separate lines), except that if
+.Ar file
+is not specified,
+then standard input is counted and there is no filename output.
+If more than one input file is specified,
+a line of cumulative counts for all the files is displayed
+on a separate line after the output for the last file.
+.Pp
+A line is defined as a <newline> character.
+Beware that characters following the last <newline>
+are not included in the line count.
+A word is defined as a string of non-whitespace characters
+separated by whitespace characters.
+Whitespace characters are <space>, <horizontal-tab>, <carriage-return>,
+<newline>, <vertical-tab>, and <newpage>.
+A character is normally one byte but might be multiple bytes,
+depending upon the environment.
+(See the ENVIRONMENT section.)
 .Pp
 The following options are available:
 .Bl -tag -width Ds
 .It Fl c
 The number of bytes in each input file
 is written to the standard output.
+This cancels any prior
+.Fl w .
 .It Fl l
 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.
-If the current locale does not support multibyte characters, this
+If the environment does not support multi-byte characters, this
 is equivalent to the
 .Fl c
 option.
+This cancels any prior
+.Fl c .
 .It Fl w
 The number of words in each input file
 is written to the standard output.
@@ -85,15 +97,13 @@
 When an option is specified,
 .Nm
 only reports the information requested by that option.
+The order of output is always: line, word, byte/character, filename.
 The default action is equivalent to specifying the
 .Fl c ,
 .Fl l
 and
 .Fl w
 options.
-.Pp
-If no files are specified, the standard input is used and no
-file name is displayed.
 .Sh ENVIRONMENT
 The
 .Ev LANG ,
@@ -104,18 +114,18 @@
 .Nm
 as described in
 .Xr environ 7 .
+For more information,
+see the FreeBSD Handbook's discussion of locale setting.
 .Sh EXAMPLES
-Count the number of characters, words and lines in each of the files
+Count the number of lines, words, and characters in each of the files
 .Pa report1
 and
 .Pa report2
 as well as the totals for both:
 .Pp
-.Dl "wc -mlw report1 report2"
+.Dl "wc -lwm report1 report2"
 .Sh DIAGNOSTICS
 .Ex -std
-.Sh SEE ALSO
-.Xr isspace 3
 .Sh COMPATIBILITY
 Historically, the
 .Nm
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?lhn0lhj516.0lh>