add POSIX/IEEE contribution notice
[unix-history] / usr / src / usr.bin / wc / wc.1
index 30c27e5..b67ca21 100644 (file)
@@ -1,33 +1,88 @@
-.\" Copyright (c) 1980 Regents of the University of California.
-.\" All rights reserved.  The Berkeley software License Agreement
-.\" specifies the terms and conditions for redistribution.
+.\" Copyright (c) 1991 Regents of the University of California.
+.\" All rights reserved.
 .\"
 .\"
-.\"    @(#)wc.1        5.1 (Berkeley) %G%
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
 .\"
 .\"
-.TH WC 1  "1 June 1983"
-.UC 4
-.SH NAME
-wc \- word count
-.SH SYNOPSIS
-.B wc
-[
-.B \-lwc
-] 
-[ name ... ]
-.SH DESCRIPTION
-.PP
-.I Wc
-counts lines, words and characters 
-in the named files, or in the standard input if no name appears.
-A word is a maximal string of characters delimited by spaces, tabs or newlines.
-.PP
-If an argument beginning with one of ``lwc'' is present,
-the specified counts (lines, words, or characters)
-are selected by the letters
-.BR l ,
-.BR w ,
-or
-.BR c .
-The default is
-.BR \-lwc .
-.SH BUGS
+.\" %sccs.include.redist.man%
+.\"
+.\"     @(#)wc.1       6.4 (Berkeley) %G%
+.\"
+.Dd 
+.Dt WC 1
+.Os
+.Sh NAME
+.Nm wc
+.Nd word, line, and byte count
+.Sh SYNOPSIS
+.Nm wc
+.Op Fl clw
+.Op Ar file ...
+.Sh DESCRIPTION
+The
+.Nm wc
+utility reads one or more input text files, and, by
+default, writes the number of lines, words, and bytes
+contained in each input file to the standard output.
+If more than one input file is specified,
+a line of cumulative count(s) for all named files is output on a
+separate line
+following the last file count.
+.Nm Wc
+considers a word to be a maximal string of
+characters delimited by white space.
+.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.
+.It Fl l
+The number of lines in each input file
+is written to the standard output.
+.It Fl w
+The number of words in each input file
+is written to the standard output.
+.El
+.Pp
+When an option is specified,
+.Nm wc
+only
+reports the
+information requested by that option. The
+default action is equivalent to all the
+flags
+.Fl clw
+having been specified.
+.Pp
+The following operands are available:
+.Bl -tag -width Ds
+.It Ar file
+A pathname of an input file.
+.El
+.Pp
+If no file names
+are specified, the standard input is used and
+a file name is not output. The resulting output is one
+line of the requested count(s) with the cumulative sum
+of all files read in via standard input.
+.Pp
+By default, the standard output contains a line for each
+input file of the form:
+.Bd -literal -offset indent
+lines   words  bytes   file_name
+.Ed
+.Pp
+The counts for lines, words and bytes are integers separated
+by spaces.
+The ordering of the display of the number of lines, words,
+and/or bytes is the order in which the options were specified.
+.Pp
+The
+.Nm wc
+utility exits 0 on success, and >0 if an error occurs.
+.Sh STANDARDS
+The
+.Nm wc
+function conforms to
+.St -p1003.2 .