format.icn: Program to word wrap a range of text

March 26, 2002; Robert J. Alexander
This file is in the public domain.
Filter to word wrap a range of text.

A number of options are available, including full  justification (see
usage text,  below).  All lines that have the same indentation as the
first  line (or same  comment leading character format if  -c option)
are wrapped.  Other lines are left as is.

This  program  is useful in conjunction with editors  that can invoke
filters on a range of selected text.

The -c option attempts to establish the form of a comment based on the
first  line, then does its best to deal  properly  with the following
lines.   The  types of  comment lines that  are handled  are those in
which  each  line starts with a "comment" character string  (possibly
preceded  by  spaces).  While formatting  comment  lines, text  lines
following the prototype line that don't match the  prototype  but are
flush with  the  left margin are also  formatted  as  comments.  This
feature simplifies  initially entering  lengthy  comments  or  making
major modifications, since  new  text can  be entered without concern
for comment formatting, which will be done automatically later.

Source code | Program Library Page | Icon Home Page