Category : UNIX Files
Archive   : WP.ZIP
Filename : WP.1

Output of file : WP.1 contained in archive : WP.ZIP

'\" SCCS id: @(#)wp.1 1.2
'\" page setup for European paper
.nr )O 1.5c
.nr )L 12i
.nr LL 6.5i
.pl \n()Lu
.ll \n(LLu
.lt \n(LLu
.po \n()Ou
'\" actual manual page
.TH WP 1
wp \- reformat text to even right margin
.B wp
.RB [ \-c " commentstring [" \-bBfs "] ]"
.I Wp
filters standard input to standard output reformatting the text to
lines approximately equal to
.I linelength
(default 67).
The text is regarded as "paragraphs", defined to be sections of text
separated by one or more empty lines (including lines containing only
white space - that is, spaces and tabs). The output paragraphs are indented
such that the first line indentation is the same as that of the first
line of the input paragraph, and
second and subsequent lines are indented to the level of the second
input line of the paragraph. The indentation of the third and
subsequent lines of the input paragraph is thus ignored.
Since text lines rarely begin with the character ".", such a line will
have the same effect on the line counting as does a blank line [ie,
like fmt(1), wp can be used to reformat nroff input].
A "word" is defined to be all characters between white space.
The lines are "turned" at word boundaries - no hyphenation is
attempted. The characters ".", "!", and "?" are regarded as sentence
endings, and will be followed by two spaces instead of the normal one
space between words.
The option
.B \-c
specifies that the following argument is to be treated as a comment
prefix. This prefix is stripped off input lines before reformatting.
The prefix is then added to the beginning of
.I all
non blank output lines, regardless of whether they originally started with the
comment prefix or not. This facility is intended to ease the inclusion or
reformatting of comments in programs and shell procedures.
Any indentation preceding a comment symbol on the
.I first
line of a paragraph will be retained for all the output lines. This

is reset only by a genuine blank line in the text.
The text
indentation within the comment symbols is controlled as for normal
text paragraphs, with indentations relative to the comment symbol if
it is present in the input text, otherwise relative to the beginning
of the line.
.B \-b
is specified in addition, then "block commenting" is used. The
specified comment prefix with the character order reversed and
"paired" characters
.BR [ "(), [], {}" ]
inverted is assumed to be a comment suffix.
Any existing suffix is removed from input lines before reformatting. All
output lines, including blank lines, will be preceded by the comment
prefix, and terminated by the comment suffix after padding with spaces
.IR linelength .
.B \-B
also produces block commenting, but no linelength padding is
done, and blank lines remain blank.
It can be difficult to understand the exact interplay of comment
indentations and text indentations. The basic rule is to make the
indentations and comment prefix correct on the first two lines of your
paragraph - wp will handle the rest.
.B \-f
will "frame" paragraphs with lines of dashes, inside comment
symbols. This option implies
.BR \-b .
The behaviour is currently rather unsatisfactory on more than single
paragraphs, but extremely useful for those!
.B \-s
may be used to strip off comment symbols (including dashed lines if -f
is specified), without replacing them after reformatting. Either
leading or both leading and trailing comments are stripped, depending
on the absence or presence of a block comment option.
.I wp
is typically used within vi(1) to reformat text while editing. The
replaces the paragraph starting at the cursor with a reformatted
!}wp -c '\e#\ ' 55
replaces the paragraph with a version reformatted to lines of not more
than 55 characters, each line commencing with "#\ ". Observe the
necessity to use both quotes and the backslash in the case of the "#" character,
because this character is special to both vi(1) and to sh(1).
!}wp -c '(* ' -b
replaces the paragraph with a reformatted version,
with preceding and trailing comment markers (* and *) -
Pascal block commenting.
.I wp
can also be used with INed. The command:
wp -c '(* ' -b
has the same effect as the previous example.
Input lines are silently limited to 512 characters.
If the first line of a paragraph is long enough to create more than
one line in the output, then the indentation of the second input line
is ignored. Workaround: divide the first line!
Others, probably - mail kvvax6!pete