home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-09 | 60.0 KB | 1,637 lines |
- Newsgroups: comp.sources.misc
- From: amc@wuecl.wustl.edu (Adam Costello)
- Subject: v40i124: par - paragraph reformatter, v1.41, Part01/03
- Message-ID: <csm-v40i124=par.112700@sparky.Sterling.COM>
- X-Md4-Signature: 0a1584bccf46f27009323ca5f11dbd57
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Tue, 9 Nov 1993 17:27:25 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: amc@wuecl.wustl.edu (Adam Costello)
- Posting-number: Volume 40, Issue 124
- Archive-name: par/part01
- Environment: ANSI-C
- Supersedes: par131: Volume 39, Issue 83-85
-
- Par 1.41 is a package containing documentation and ANSI C source code
- for the filter "par".
-
- par is a paragraph reformatter, vaguely similar to fmt, but better.
-
- For example, the command "par 44gqr", given the input:
-
- John Q. Public writes:
- > Jane Doe writes:
- > >
- > > May I remind people that this newsgroup
- > > is for posting binaries only. Please keep
- > > all discussion in .d where it belongs.
- > Who appointed you net.god?
- > I'll discuss things here if I feel like it.
- Could you two please take this to e-mail?
-
- **********************************************
- ** Main's Law: For every action there is an **
- ** equal and opposite government program. **
- **********************************************
-
- Would produce the output:
-
- John Q. Public writes:
-
- > Jane Doe writes:
- >
- > > May I remind people that this
- > > newsgroup is for posting
- > > binaries only. Please keep
- > > all discussion in .d where it
- > > belongs.
- >
- > Who appointed you net.god? I'll
- > discuss things here if I feel like
- > it.
-
- Could you two please take this to
- e-mail?
-
- ************************************
- ** Main's Law: For every action **
- ** there is an equal and opposite **
- ** government program. **
- ************************************
-
- Be sure to read "par.doc".
-
- AMC
- amc@ecl.wustl.edu (Adam M. Costello)
- ------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: Par141 Par141/errmsg.c Par141/errmsg.h Par141/buffer.c
- # Par141/par.doc
- # Wrapped by amc@siesta on Sun Oct 31 01:25:10 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test ! -d 'Par141' ; then
- echo shar: Creating directory \"'Par141'\"
- mkdir 'Par141'
- fi
- if test -f 'Par141/errmsg.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Par141/errmsg.c'\"
- else
- echo shar: Extracting \"'Par141/errmsg.c'\" \(400 characters\)
- sed "s/^X//" >'Par141/errmsg.c' <<'END_OF_FILE'
- X/*********************/
- X/* errmsg.c */
- X/* for Par 1.41 */
- X/* Copyright 1993 by */
- X/* Adam M. Costello */
- X/*********************/
- X
- X/* This is ANSI C code. */
- X
- X
- X#include "errmsg.h" /* Makes sure we're consistent with the declarations. */
- X
- X
- Xconst char * const outofmem =
- X "Out of memory.\n";
- X
- Xconst char * const impossibility =
- X "Impossibility #%d has occurred. Please report it.\n";
- END_OF_FILE
- if test 400 -ne `wc -c <'Par141/errmsg.c'`; then
- echo shar: \"'Par141/errmsg.c'\" unpacked with wrong size!
- fi
- # end of 'Par141/errmsg.c'
- fi
- if test -f 'Par141/errmsg.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Par141/errmsg.h'\"
- else
- echo shar: Extracting \"'Par141/errmsg.h'\" \(977 characters\)
- sed "s/^X//" >'Par141/errmsg.h' <<'END_OF_FILE'
- X/*********************/
- X/* errmsg.h */
- X/* for Par 1.41 */
- X/* Copyright 1993 by */
- X/* Adam M. Costello */
- X/*********************/
- X
- X/* This is ANSI C code. */
- X
- X
- X#ifndef ERRMSG_H
- X#define ERRMSG_H
- X
- X
- X#define errmsg_size 163
- X
- X/* This is the maximum number of characters that will */
- X/* fit in an errmsg_t, including the terminating '\0'. */
- X/* It will never decrease, but may increase in future */
- X/* versions of this header file. */
- X
- X
- Xtypedef char errmsg_t[errmsg_size];
- X
- X/* Any function which takes the argument errmsg_t errmsg must, before */
- X/* returning, either set errmsg[0] to '\0' (indicating success), or */
- X/* write an error message string into errmsg, (indicating failure), */
- X/* being careful not to overrun the space. */
- X
- X
- Xextern const char * const outofmem;
- X /* "Out of memory.\n" */
- X
- Xextern const char * const impossibility;
- X /* "Impossibility #%d has occurred. Please report it.\n" */
- X
- X
- X#endif
- END_OF_FILE
- if test 977 -ne `wc -c <'Par141/errmsg.h'`; then
- echo shar: \"'Par141/errmsg.h'\" unpacked with wrong size!
- fi
- # end of 'Par141/errmsg.h'
- fi
- if test -f 'Par141/buffer.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Par141/buffer.c'\"
- else
- echo shar: Extracting \"'Par141/buffer.c'\" \(4554 characters\)
- sed "s/^X//" >'Par141/buffer.c' <<'END_OF_FILE'
- X/*********************/
- X/* buffer.c */
- X/* for Par 1.41 */
- X/* Copyright 1993 by */
- X/* Adam M. Costello */
- X/*********************/
- X
- X/* This is ANSI C code. */
- X
- X
- X/* additem(), copyitems(), and nextitem() rely on the fact that */
- X/* sizeof (char) is 1. See section A7.4.8 of The C Programming */
- X/* Language, Second Edition, by Kerninghan and Ritchie. */
- X
- X
- X#include "buffer.h" /* Makes sure we're consistent with the prototypes. */
- X /* Also includes <stddef.h> and "errmsg.h". */
- X
- X#include <stdlib.h>
- X#include <string.h>
- X
- X#undef NULL
- X#define NULL ((void *) 0)
- X
- X#ifdef DONTFREE
- X#define free(ptr)
- X#endif
- X
- X
- Xstruct buffer {
- X struct block *firstblk, /* The first block. */
- X *current, /* The last non-empty block, or */
- X /* firstblk if all are empty. */
- X *nextblk; /* The block containing the item to be */
- X /* returned by nextitem(), or NULL. */
- X int nextindex; /* Index of item in nextblock->items. */
- X size_t itemsize; /* The size of an item. */
- X};
- X
- Xtypedef struct block {
- X struct block *next; /* The next block, or NULL if none. */
- X void *items; /* Storage for the items in this block. */
- X int maxhere, /* Number of items that fit in *items. */
- X numprevious, /* Total of numhere for all previous blocks. */
- X numhere; /* The first numhere slots in *items are filled. */
- X} block;
- X
- X
- Xbuffer *newbuffer(size_t itemsize, errmsg_t errmsg)
- X{
- X buffer *buf;
- X block *blk;
- X void *items;
- X int maxhere;
- X
- X maxhere = 124 / itemsize;
- X if (maxhere < 4) maxhere = 4;
- X
- X buf = (buffer *) malloc(sizeof (buffer));
- X blk = (block *) malloc(sizeof (block));
- X items = malloc(maxhere * itemsize);
- X if (!buf || !blk || !items) {
- X strcpy(errmsg,outofmem);
- X goto nberror;
- X }
- X
- X buf->itemsize = itemsize;
- X buf->firstblk = buf->current = buf->nextblk = blk;
- X buf->nextindex = 0;
- X blk->next = NULL;
- X blk->numprevious = blk->numhere = 0;
- X blk->maxhere = maxhere;
- X blk->items = items;
- X
- X *errmsg = '\0';
- X return buf;
- X
- Xnberror:
- X
- X if (buf) free(buf);
- X if (blk) free(blk);
- X if (items) free(items);
- X return NULL;
- X}
- X
- X
- Xvoid freebuffer(buffer *buf)
- X{
- X block *blk, *tmp;
- X
- X blk = buf->firstblk;
- X while (blk) {
- X tmp = blk;
- X blk = blk->next;
- X if (tmp->items) free(tmp->items);
- X free(tmp);
- X }
- X
- X free(buf);
- X}
- X
- X
- Xvoid clearbuffer(buffer *buf)
- X{
- X block *blk;
- X
- X for (blk = buf->firstblk; blk; blk = blk->next)
- X blk->numhere = 0;
- X
- X buf->current = buf->firstblk;
- X}
- X
- X
- Xvoid additem(buffer *buf, const void *item, errmsg_t errmsg)
- X{
- X block *blk, *new;
- X void *items;
- X int maxhere;
- X size_t itemsize = buf->itemsize;
- X
- X blk = buf->current;
- X
- X if (blk->numhere == blk->maxhere) {
- X new = blk->next;
- X if (!new) {
- X maxhere = 2 * blk->maxhere;
- X new = (block * ) malloc(sizeof (block));
- X items = malloc(maxhere * itemsize);
- X if (!new || !items) {
- X strcpy(errmsg,outofmem);
- X goto aierror;
- X }
- X blk->next = new;
- X new->next = NULL;
- X new->maxhere = maxhere;
- X new->numprevious = blk->numprevious + blk->numhere;
- X new->numhere = 0;
- X new->items = items;
- X }
- X blk = buf->current = new;
- X }
- X
- X memcpy( ((char *) blk->items) + (blk->numhere * itemsize), item, itemsize );
- X
- X ++blk->numhere;
- X
- X *errmsg = '\0';
- X return;
- X
- Xaierror:
- X
- X if (new) free(new);
- X if (items) free(items);
- X}
- X
- X
- Xint numitems(buffer *buf)
- X{
- X block *blk = buf->current;
- X return blk->numprevious + blk->numhere;
- X}
- X
- X
- Xvoid *copyitems(buffer *buf, errmsg_t errmsg)
- X{
- X int n;
- X void *r;
- X block *blk, *b;
- X size_t itemsize = buf->itemsize;
- X
- X b = buf->current;
- X n = b->numprevious + b->numhere;
- X if (!n) return NULL;
- X
- X r = malloc(n * itemsize);
- X if (!r) {
- X strcpy(errmsg,outofmem);
- X return NULL;
- X }
- X
- X b = b->next;
- X
- X for (blk = buf->firstblk; blk != b; blk = blk->next)
- X memcpy( ((char *) r) + (blk->numprevious * itemsize),
- X blk->items, blk->numhere * itemsize);
- X
- X *errmsg = '\0';
- X return r;
- X}
- X
- X
- Xvoid rewindbuffer(buffer *buf)
- X{
- X buf->nextblk = buf->firstblk;
- X buf->nextindex = 0;
- X}
- X
- X
- Xvoid *nextitem(buffer *buf)
- X{
- X void *r;
- X
- X if (!buf->nextblk || buf->nextindex >= buf->nextblk->numhere)
- X return NULL;
- X
- X r = ((char *) buf->nextblk->items) + (buf->nextindex * buf->itemsize);
- X
- X if (++buf->nextindex >= buf->nextblk->maxhere) {
- X buf->nextblk = buf->nextblk->next;
- X buf->nextindex = 0;
- X }
- X
- X return r;
- X}
- END_OF_FILE
- if test 4554 -ne `wc -c <'Par141/buffer.c'`; then
- echo shar: \"'Par141/buffer.c'\" unpacked with wrong size!
- fi
- # end of 'Par141/buffer.c'
- fi
- if test -f 'Par141/par.doc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Par141/par.doc'\"
- else
- echo shar: Extracting \"'Par141/par.doc'\" \(49605 characters\)
- sed "s/^X//" >'Par141/par.doc' <<'END_OF_FILE'
- X *********************
- X * par.doc *
- X * for Par 1.41 *
- X * Copyright 1993 by *
- X * Adam M. Costello *
- X *********************
- X
- X
- X Par 1.41 is a package containing:
- X
- X + This doc file.
- X + A man page based on this doc file.
- X + The ANSI C source for the filter "par".
- X
- X
- XContents
- X
- X Contents
- X File List
- X Rights and Responsibilities
- X Compilation
- X Synopsis
- X Description
- X *Quick Start
- X Terminology
- X Options
- X Environment
- X Details
- X Diagnostics
- X Examples
- X Limitations
- X Bugs
- X
- X
- XFile List
- X
- X The Par 1.41 package is always distributed with at least the following
- X files:
- X
- X buffer.c
- X buffer.h
- X charset.c
- X charset.h
- X failf.c
- X failf.h
- X par.1
- X par.c
- X par.doc
- X protoMakefile
- X reformat.c
- X reformat.h
- X releasenotes
- X
- X Each file is a text file which identifies itself on the second line, and
- X identifies the version of Par to which it belongs on the third line,
- X so you can always tell which file is which, even if the files have been
- X renamed.
- X
- X The file "par.1" is a man page for the filter par (not to be confused
- X with the package Par, which contains the source code for par). "par.1"
- X is based on this doc file, and conveys much (not all) of the same
- X information, but "par.doc" is the definitive documentation for both par
- X and Par.
- X
- X
- XRights and Responsibilities
- X
- X The files listed in the Files List section above are each Copyright 1993
- X by Adam M. Costello (henceforth "I").
- X
- X I grant everyone permission to use these files in any way, subject to
- X the following two restrictions:
- X
- X 1) No one may distribute modifications of any of the files unless I am
- X the one who modified them.
- X
- X 2) No one may distribute any one of the files unless it is accompanied
- X by all of the other files.
- X
- X I cannot disallow the distribution of patches, but I would prefer that
- X users send me suggestions for changes so that I can incorporate them
- X into future versions of Par. See the Bugs section for my addresses.
- X
- X All official versions of Par will have version numbers that fit the
- X pattern "<digits>.<digits>". Those who distribute patches should, as a
- X courtesy, make sure that the patch alters all instances of the version
- X number (except in the releasenotes file) to something that doesn't fit
- X the pattern, to avoid confusion between official versions and patched
- X versions.
- X
- X Though I have tried to make sure that Par is free of bugs, I make no
- X guarantees about its soundness. Therefore, I am not responsible for any
- X damage resulting from the use of these files.
- X
- X
- XCompilation
- X
- X To compile par, you need an ANSI C compiler. Follow the instructions in
- X the comments in protoMakefile.
- X
- X If your compiler warns you about a pointer to a constant being converted
- X to a pointer to a non-constant in line 521 of reformat.c, ignore it.
- X Your compiler (like mine) is in error. What it thinks is a pointer to
- X a constant is actually a pointer to a pointer to a constant, which is
- X something quite different. The conversion is legal, and I don't think a
- X correct ANSI C compiler would complain.
- X
- X If your compiler generates any other warnings that you think are
- X legitimate, please tell me about them (see the Bugs section).
- X
- X Note that all variables in par are either constant or automatic (or
- X both), which means that par can be made reentrant (if your compiler
- X supports it). Given the right operating system, it should be possible
- X for several par processes to share the same code space and the same data
- X space (but not the same stack, of course) in memory.
- X
- X
- XSynopsis
- X par [help] [version] [B<op><set>] [P<op><set>] [Q<op><set>] [h[<hang>]]
- X [p[<prefix>]] [r[<repeat>]] [s[<suffix>]] [w[<width>]] [c[<cap>]]
- X [d[<div>]] [E[<Err>]] [e[<expel>]] [f[<fit>]] [g[<guess>]]
- X [i[<invis>]] [j[<just>]] [l[<last>]] [q[<quote>]] [R[<Report>]]
- X [t[<touch>]]
- X
- X Things enclosed in [square brackets] are optional. Things enclosed in
- X <angle brackets> are parameters.
- X
- X
- XDescription
- X
- X par is a filter which copies its input to its output, changing all white
- X characters (except newlines) to spaces, and reformatting each paragraph.
- X Paragraphs are separated by protected, blank, and bodiless lines (see
- X the Terminology section for definitions), and optionally delimited by
- X indentation (see the d option in the Options section).
- X
- X Each output paragraph is generated from the corresponding input
- X paragraph as follows:
- X
- X 1) An optional prefix and/or suffix is removed from each input line.
- X 2) The remainder is divided into words (separated by spaces).
- X 3) The words are joined into lines to make an eye-pleasing paragraph.
- X 4) The prefixes and suffixes are reattached.
- X
- X If there are suffixes, spaces are inserted before them so that they all
- X end in the same column.
- X
- X
- XQuick Start
- X
- X par is necessarily complex. For those who wish to use it immediately
- X and understand it later, assign the following environment variables:
- X
- X PARBODY = ._A_a
- X
- X PARINIT = Rgqr
- X
- X PARQUOTE = _s>|
- X
- X The greater-than sign and the vertical bar in the value of PARQUOTE
- X will probably have to be escaped or quoted to prevent your shell from
- X interpreting them.
- X
- X
- XTerminology
- X
- X Miscellaneous terms:
- X
- X charset syntax
- X A way of representing a set of characters as a string. The set
- X includes exactly those characters which appear in the string,
- X except that the underscore (_) is an escape character. Whenever
- X it appears, it must begin one of the following escape sequences:
- X
- X __ = an underscore
- X _s = a space
- X _b = a backslash (\)
- X _q = a single quote (')
- X _Q = a double quote (")
- X _A = all upper case letters
- X _a = all lower case letters
- X _0 = all decimal digits
- X _xhh = the character represented by the two hexadecimal
- X digits hh (which may be upper or lower case)
- X
- X The NUL character must not appear in the string but it may be
- X included in the set with the _x00 sequence.
- X
- X error
- X A condition which causes par to abort. See the Diagnostics
- X section.
- X
- X IP Input paragraph.
- X
- X OP Output paragraph.
- X
- X parameter
- X A symbol which may take on unsigned integral values. There are
- X several parameters whose values affect the behavior of par.
- X Parameters can be assigned values using command line options.
- X
- X
- X Types of characters:
- X
- X alphanumeric character
- X An upper case letter, lower case letter, or decimal digit.
- X
- X body character
- X A member of the set of characters defined by the PARBODY
- X environment variable (see the Environment section).
- X
- X protective character
- X A member of the set of characters defined by the PARPROTECT
- X environment variable (see the Environment section).
- X
- X quote character
- X A member of the set of characters defined by the PARQUOTE
- X environment variable (see the Environment section).
- X
- X terminal character
- X A period, question mark, exclamation point, or colon.
- X
- X white character
- X A space, formfeed, newline, carriage return, tab, or vertical
- X tab.
- X
- X Functions:
- X
- X comprelen
- X The comprelen of a non-empty sequence of lines is the length
- X of the longest string of non-body characters appearing at the
- X beginning of every line in the set.
- X
- X comsuflen
- X Given a non-empty sequence <S> of lines, let <p> be the
- X comprelen of <S>. Let <T> be the set of lines which result from
- X stripping the first <p> characters from each line in <S>. Let
- X <c> be the longest string of non-body characters appearing at
- X the end of every line in <T>. Strip <c> of all initial spaces
- X except the last. The length of <c> is the comsuflen of <S>.
- X
- X fallback prelen (suflen)
- X The fallback prelen (suflen) of an IP is: the comprelen
- X (comsuflen) of the IP, if the IP contains at least two lines;
- X otherwise, the comprelen (comsuflen) of the block containing the
- X IP, if the block contains at least two lines; otherwise, the
- X length of the longer of the prefixes (suffixes) of the bodiless
- X lines just above and below the block, if the segment containing
- X the block has any bodiless lines; otherwise, 0. (See below for
- X the definitions of block, segment, and bodiless line.)
- X
- X augmented fallback prelen
- X Let <fp> be the fallback prelen of an IP. If the IP contains
- X more than one line, or if <quote> is 0, then the augmented
- X fallback prelen of the IP is simply <fp>. Otherwise, it is <fp>
- X plus the number of quote characters immediately following the
- X first <fp> characters of the line.
- X
- X quoteprefix
- X The quoteprefix of a line is the longest string of quote
- X characters appearing at the beginning of the line, after this
- X string has been stripped of any trailing spaces.
- X
- X Types of lines:
- X
- X blank line
- X An empty line, or a line whose first character is not protective
- X and which contains only spaces.
- X
- X protected line
- X An input line whose first character is protective.
- X
- X bodiless line
- X A line which is order <k> bodiless for some <k>.
- X
- X order <k> bodiless line
- X There is no such thing as an order 0 bodiless line. Suppose
- X <S> is a a contiguous subsequence of a segment (see below)
- X containing at least two lines, containing no order <k>-1
- X bodiless lines, bounded above and below by order <k>-1 bodiless
- X lines and/or the beginning/end of the segment. Let <p> and <s>
- X be the comprelen and comsuflen of <S>. Any member of <S> which,
- X if stripped of its first <p> and last <s> characters, would be
- X blank (or, if the parameter <repeat> is non-zero, would consist
- X of the same character repeated at least <repeat> times), is
- X order <k> bodiless. The first <p> characters of the bodiless
- X line comprise its prefix; the last <s> characters comprise its
- X suffix. The character which repeats in the middle is called its
- X repeat character. If the middle is empty, the space is taken to
- X be its repeat character.
- X
- X vacant line
- X A bodiless line whose repeat character is the space.
- X
- X superfluous line
- X Only blank and vacant lines may be superfluous. If contiguous
- X vacant lines lie at the beginning or end of a segment, they are
- X all superfluous. But if they lie between two non-vacant lines
- X within a segment, then all are superfluous except one--the one
- X which contains the fewest non-spaces. In case of a tie, the
- X first of the tied lines is chosen. Similarly, if contiguous
- X blank lines lie outside of any segments at the beginning or end
- X of the input, they are all superfluous. But if they lie between
- X two segments and/or protected lines, then all are superfluous
- X except the first.
- X
- X Groups of lines:
- X
- X segment
- X A contiguous sequence of input lines containing no protected or
- X blank lines, bounded above and below by protected lines, blank
- X lines, and/or the beginning/end of the input.
- X
- X block
- X A contiguous subsequence of a segment containing no bodiless
- X lines, bounded above and below by bodiless lines and/or the
- X beginning/end of the segment.
- X
- X Types of words:
- X
- X capitalized word
- X If the parameter <cap> is 0, a capitalized word is one which
- X contains at least one alphanumeric character, whose first
- X alphanumeric character is not a lower case letter. If <cap>
- X is 1, every word is considered a capitalized word. (See the c
- X option in the Options section.)
- X
- X curious word
- X A word which contains a terminal character <c> such that there
- X are no alphanumeric characters in the word after <c>, but there
- X is at least one alphanumeric character in the word before <c>.
- X
- X
- XOptions
- X
- X Any command line argument may begin with one minus sign (-) which is
- X ignored. Generally, more than one option may appear in a single command
- X line argument, but there are exceptions: The help, version, B, P, and Q
- X options must have whole arguments all to themselves.
- X
- X help Causes all remaining arguments to be ignored. No input
- X is read. A usage message is printed on the output briefly
- X describing the options used by par.
- X
- X version Causes all remaining arguments to be ignored. No input is
- X read. "par 1.41" is printed on the output. Of course, this
- X will change in future releases of Par.
- X
- X B<op><set> <op> is a single character, either an equal sign (=), a
- X plus sign (+), or a minus sign (-). <set> is a string using
- X charset syntax. If <op> is an equal sign, the set of body
- X characters is set to the character set defined by <set>. If
- X <op> is a plus/minus sign, the characters in the set defined
- X by <set> are added/removed to/from the existing set of body
- X characters defined by the PARBODY environment variable and
- X any previous B options. It is okay to add characters that
- X are already in the set or to remove characters that are not
- X in the set.
- X
- X P<op><set> Just like the B option, except that it applies to the set of
- X protective characters.
- X
- X Q<op><set> Just like the B option, except that it applies to the set of
- X quote characters.
- X
- X All remaining options are used to set values of parameters. Values set
- X by command line options hold for all paragraphs. Unset parameters are
- X given default values. Any parameters whose default values depend on
- X the IP (namely <prefix> and <suffix>), if left unset, are recomputed
- X separately for each paragraph.
- X
- X The approximate role of each parameter is described here. See the
- X Details section for the rest of the story.
- X
- X The first five parameters, <hang>, <prefix>, <repeat>, <suffix>, and
- X <width>, may be set to any unsigned decimal integer less than 10000.
- X
- X h[<hang>] Mainly affects the default values of <prefix> and <suffix>.
- X Defaults to 0. If the h option is given without a number,
- X the value 1 is inferred. (See also the p and s options.)
- X
- X p[<prefix>] The first <prefix> characters of each line of the OP
- X are copied from the first <prefix> characters of the
- X corresponding line of the IP. If there are more than
- X <hang>+1 lines in the IP, the default value is the comprelen
- X of all the lines in the IP except the first <hang> of them.
- X Otherwise, the default value is the augmented fallback
- X prelen of the IP. If the p option is given without a
- X number, <prefix> is unset, even if it had been set earlier.
- X (See also the h and q options.)
- X
- X r[<repeat>] If <repeat> is non-zero, bodiless lines have the number of
- X instances of their repeat characters increased or decreased
- X until the length of the line is <width>. The exact value of
- X <repeat> affects the definition of bodiless line. Defaults
- X to 0. If the r option is given without a number, the value
- X 3 is inferred. (See also the w option.)
- X
- X s[<suffix>] The last <suffix> characters of each line of the OP
- X are copied from the last <suffix> characters of the
- X corresponding line of the IP. If there are more than
- X <hang>+1 lines in the IP, the default value is the comsuflen
- X of all the lines in the IP except the first <hang> of them.
- X Otherwise, the default value is the fallback suflen of the
- X IP. If the s option is given without a number, <suffix> is
- X unset, even if it had been set earlier. (See also the h
- X option.)
- X
- X w[<width>] No line in the OP may contain more than <width> characters,
- X not including the trailing newlines. Defaults to 72. If
- X the w option is given without a number, the value 79 is
- X inferred.
- X
- X The remaining twelve parameters, <cap>, <div>, <Err>, <expel>, <fit>,
- X <guess>, <invis>, <just>, <last>, <quote>, <Report>, and <touch>, may be
- X set to either 0 or 1. If the number is absent in the option, the value
- X 1 is inferred.
- X
- X c[<cap>] If <cap> is 1, all words are considered capitalized. This
- X currently affects only the application of the g option.
- X Defaults to 0.
- X
- X d[<div>] If <div> is 0, each block becomes an IP. If <div> is 1,
- X each block is subdivided into IPs as follows: Let <p> be
- X the comprelen of the block. Let a line's status be 1 if its
- X (<p>+1)st character is a space, 0 otherwise. Every line
- X in the block whose status is the same as the status of the
- X first line will begin a new paragraph. Defaults to 0.
- X
- X E[<Err>] If <Err> is 1, messages to the user (caused by the help and
- X version options, or by errors) are sent to the error stream
- X instead of the output stream. Defaults to 0.
- X
- X e[<expel>] If <expel> is 1, superfluous lines withheld from the output.
- X Defaults to 0.
- X
- X f[<fit>] If <fit> is 1 and <just> is 0, par tries to make the lines
- X in the OP as nearly the same length as possible, even if it
- X means making the OP narrower. Defaults to 0. (See also the
- X j option.)
- X
- X g[<guess>] If <guess> is 1, then when par is choosing line breaks,
- X whenever it encounters a curious word followed by a
- X capitalized word, it takes one of two special actions.
- X If the two words are separated by a single space in the
- X input, they will be merged into one word with an embedded
- X non-breaking space. If the two words are separated by more
- X than one space, or by a line break, par will insure that
- X they are separated by two spaces, or by a line break, in the
- X output. Defaults to 0.
- X
- X i[<invis>] If <invis> is 1, then vacant lines inserted because <quote>
- X is 1 are invisible; that is, they are not output. If
- X <quote> is 0, <invis> has no effect. Defaults to 0. (See
- X also the q option.)
- X
- X j[<just>] If <just> is 1, par justifies the OP, inserting spaces
- X between words so that all lines in the OP have length
- X <width> (except the last, if <last> is 0). Defaults to 0.
- X (See also the w, l, and f options.)
- X
- X l[<last>] If <last> is 1, par tries to make the last line of the OP
- X about the same length as the others. Defaults to 0.
- X
- X q[<quote>] If <quote> is 1, then before each segment is scanned for
- X bodiless lines, par supplies vacant lines between different
- X quotation nesting levels as follows: For each pair of
- X adjacent lines in the segment (scanned from the top down)
- X which have different quoteprefixes, one of two actions is
- X taken. If <invis> is 0, and either line consists entirely
- X of quote characters and spaces (or is empty), that line is
- X truncated to the longest common prefix of the two lines
- X (both are truncated if both qualify). Otherwise, a line
- X consisting of the longest common prefix of the two lines is
- X inserted between them. <quote> also affects the default
- X value of <prefix>. Defaults to 0. (See also the p and i
- X options.)
- X
- X R[<Report>] If <Report> is 1, it is considered an error for an input
- X word to contain more than <L> = (<width> - <prefix> -
- X <suffix>) characters. Otherwise, such words are chopped
- X after each <L>th character into shorter words. Defaults
- X to 0. It is recommended that this option be included in
- X PARINIT (see the Environment section).
- X
- X t[<touch>] Has no effect if <suffix> is 0 or <just> is 1. Otherwise,
- X if <touch> is 0, all lines in the OP have length <width>.
- X If <touch> is 1, the length of the lines is decreased until
- X the suffixes touch the body of the OP. Defaults to the
- X logical OR of <fit> and <last>. (See also the s, j, w, f,
- X and l options.)
- X
- X If the value of any parameter is set more than once, the last value is
- X used. When unset parameters are assigned default values, <hang> and
- X <quote> are assigned before <prefix>, and <fit> and <last> are assigned
- X before <touch> (because of the dependencies).
- X
- X It is an error if <width> <= <prefix> + <suffix>.
- X
- X
- XEnvironment
- X
- X PARBODY Determines the initial set of body characters (which are
- X used for determining comprelens and comsuflens), using
- X charset syntax. If PARBODY is not set, the set of body
- X characters is initially empty.
- X
- X PARINIT If set, par will read command line arguments from PARINIT
- X before it reads them from the command line. Within
- X the value of PARINIT, arguments are separated by white
- X characters.
- X
- X PARPROTECT Determines the set of protective characters, using charset
- X syntax. If PARPROTECT is not set, the set of protective
- X characters is initially empty.
- X
- X PARQUOTE Determines the set of quote characters, using charset
- X syntax. If PARQUOTE is not set, the set of quote characters
- X initially contains only the greater-than sign (>) and the
- X space.
- X
- X If a NUL character appears in the value of an environment variable, it
- X and the rest of the string will not be seen by par.
- X
- X
- XDetails
- X
- X Lines are terminated by newline characters, but the newlines are not
- X considered to be included in the lines. If the last character of the
- X input is a non-newline, a newline will be inferred immediately after
- X it (but if the input is empty, no newline will be inferred; the number
- X of input lines will be 0). Thus, the input can always be viewed as a
- X sequence of lines.
- X
- X Protected lines are copied unchanged from the input to the output. All
- X other input lines, as they are read, have any NUL characters removed,
- X and every white character (except newlines) turned into a space.
- X
- X Blank lines in the input are transformed into empty lines in the output.
- X
- X If <repeat> is 0, all bodiless lines are vacant, and they are all simply
- X stripped of trailing spaces before being output. If <repeat> is 1, only
- X vacant lines whose suffixes have length 0 are treated that way; other
- X bodiless lines have the number of instances of their repeat characters
- X increased or decreased until the length of the line is <width>.
- X
- X If <expel> is 1, superfluous lines are not output. If <quote> and
- X <invis> are both 1, there may be invisible lines; they are not output.
- X
- X The input is divided into segments, which are divided into blocks,
- X which are divided into IPs. The exact process depends on the values of
- X <quote> and <div> (see q and d in the Options section). The remainder
- X of this section describes the process which is applied independently to
- X each IP to construct the corresponding OP.
- X
- X After the values of the parameters are determined (see the Options
- X section), the first <prefix> characters and the last <suffix> characters
- X of each input line are removed and remembered. It is an error for any
- X line to contain fewer than <prefix> + <suffix> characters.
- X
- X The remaining text is treated as a sequence of characters, not lines.
- X The text is broken into words, which are separated by spaces. That is,
- X a word is a maximal sub-sequence of non-spaces. If <guess> is 1, some
- X words might be merged (see g in the Options section). The first word
- X includes any spaces that preceed it on the same line.
- X
- X Let <L> = <width> - <prefix> - <suffix>.
- X
- X If <Report> is 0, some words may get chopped up at this point (see R in
- X the Options section).
- X
- X The words are reassembled, preserving their order, into lines. If
- X <just> is 0, adjacent words within a line are separated by a single
- X space (or sometimes two if <guess> is 1), and line breaks are chosen so
- X that the paragraph satisfies the following properties:
- X
- X 1) No line contains more than <L> characters.
- X
- X 2) If <fit> is 1, the difference between the lengths of the
- X shortest and longest lines is as small as possible.
- X
- X 3) The shortest line is as long as possible, subject to properties
- X 1 and 2.
- X
- X 4) Let <target> be <L> if <fit> is 0, or the length of the longest
- X line if <fit> is 1. The sum of the squares of the differences
- X between <target> and the lengths of the lines is as small as
- X possible, subject to properties 1, 2, and 3.
- X
- X If <last> is 0, the last line does not count as a line for the
- X purposes of properties 2, 3, and 4 above.
- X
- X If all the words fit on a single line, the properties as worded
- X above don't make much sense. In that case, no line breaks are
- X inserted.
- X
- X If <just> is 1, adjacent words within a line are separated by one space
- X (or sometimes two if <guess> is 1) plus zero or more extra spaces. The
- X value of <fit> is disregarded, and line breaks are chosen so that the
- X paragraph satisfies the following properties:
- X
- X 1) Every line contains exactly <L> characters.
- X
- X 2) The largest inter-word gap is as small as possible, subject
- X to property 1. (An inter-word gap consists only of the extra
- X spaces, not the regular spaces.)
- X
- X 3) The sum of the squares of the lengths of the inter-word gaps is
- X as small as possible, subject to properties 1 and 2.
- X
- X If <last> is 0, the last line does not count as a line for the
- X purposes of property 1, and it does not require or contain any extra
- X spaces.
- X
- X Extra spaces are distributed as uniformly as possible among the
- X inter-word gaps in each line.
- X
- X In a justified paragraph, every line must contain at least two
- X words, but that's not always possible to accomplish. If the
- X paragraph cannot be justified, it is considered an error.
- X
- X If the number of lines in the resulting paragraph is less than <hang>,
- X empty lines are added at the end to bring the number of lines up to
- X <hang>.
- X
- X If <just> is 0 and <touch> is 1, <L> is changed to be the length of the
- X longest line.
- X
- X If <suffix> is not 0, each line is padded at the end with spaces to
- X bring its length up to <L>.
- X
- X To each line is prepended <prefix> characters. Let <n> be the number of
- X lines in the IP, let <afp> be the augmented fallback prelen of the IP,
- X and let <fs> be the fallback suflen of the IP. The characters which are
- X prepended to the <i>th line are chosen as follows:
- X
- X 1) If <i> <= <n>, the characters are copied from the ones that were
- X removed from the beginning of the <n>th input line.
- X
- X 2) If <i> > <n> > <hang>, the characters are copied from the ones that
- X were removed from the beginning of the last input line.
- X
- X 3) If <i> > <n> and <n> <= <hang>, the first min(<afp>,<prefix>) of
- X the characters are copied from the ones that were removed from the
- X beginning of the last input line, and the rest are all spaces.
- X
- X Then to each line is appended <suffix> characters. The characters which
- X are appended to the <i>th line are chosen as follows:
- X
- X 1) If <i> <= <n>, the characters are copied from the ones that were
- X removed from the end of the nth input line.
- X
- X 2) If <i> > <n> > <hang>, the characters are copied from the ones that
- X were removed from the end of the last input line.
- X
- X 3) If <i> > <n> and <n> <= <hang>, the first min(<fs>,<suffix>) of
- X the characters are copied from the ones that were removed from the
- X beginning of the last input line, and the rest are all spaces.
- X
- X Finally, the lines are printed to the output as the OP.
- X
- X
- XDiagnostics
- X
- X If there are no errors, par returns EXIT_SUCCESS (see <stdlib.h>).
- X
- X If there is an error, an error message will be printed to the output,
- X and par will return EXIT_FAILURE. If the error is local to a single
- X paragraph, the preceeding paragraphs will have been output before
- X the error was detected. Line numbers in error messages are local to
- X the IP in which the error occurred. All error messages begin with
- X "par error:" on a line by itself. Error messages concerning command
- X line or environment variable syntax are accompanied by the same usage
- X message that the help option produces.
- X
- X Of course, trying to print an error message would be futile if an error
- X resulted from an output function, so par doesn't bother doing any error
- X checking on output functions.
- X
- X
- XExamples
- X
- X The superiority of par's dynamic programming algorithm over a greedy
- X algorithm (such as the one used by fmt) can be seen in the following
- X example:
- X
- X Original paragraph:
- X
- X We the people of the United States,
- X in order to form a more perfect union,
- X establish justice,
- X insure domestic tranquility,
- X provide for the common defense,
- X promote the general welfare,
- X and secure the blessing of liberty
- X to ourselves and our posterity,
- X do ordain and establish the Constitution
- X of the United States of America.
- X
- X After a greedy algorithm with width = 39:
- X
- X We the people of the United
- X States, in order to form a more
- X perfect union, establish
- X justice, insure domestic
- X tranquility, provide for the
- X common defense, promote the
- X general welfare, and secure the
- X blessing of liberty to
- X ourselves and our posterity, do
- X ordain and establish the
- X Constitution of the United
- X States of America.
- X
- X After "par 39":
- X
- X We the people of the United
- X States, in order to form a
- X more perfect union, establish
- X justice, insure domestic
- X tranquility, provide for the
- X common defense, promote the
- X general welfare, and secure
- X the blessing of liberty to
- X ourselves and our posterity,
- X do ordain and establish the
- X Constitution of the United
- X States of America.
- X
- X The line breaks chosen by par are clearly more eye-pleasing.
- X
- X par is most useful in conjunction with the text-filtering features of an
- X editor, such as the ! commands of vi.
- X
- X The rest of this section is a series of before-and-after pictures
- X showing some typical uses of par. In all cases, no environment
- X variables are set.
- X
- X Before:
- X
- X /* We the people of the United States, */
- X /* in order to form a more perfect union, */
- X /* establish justice, */
- X /* insure domestic tranquility, */
- X /* provide for the common defense, */
- X /* promote the general welfare, */
- X /* and secure the blessing of liberty */
- X /* to ourselves and our posterity, */
- X /* do ordain and establish the Constitution */
- X /* of the United States of America. */
- X
- X After "par 59":
- X
- X /* We the people of the United States, in */
- X /* order to form a more perfect union, establish */
- X /* justice, insure domestic tranquility, provide */
- X /* for the common defense, promote the general */
- X /* welfare, and secure the blessing of liberty */
- X /* to ourselves and our posterity, do ordain */
- X /* and establish the Constitution of the United */
- X /* States of America. */
- X
- X Or after "par 59f":
- X
- X /* We the people of the United States, */
- X /* in order to form a more perfect union, */
- X /* establish justice, insure domestic */
- X /* tranquility, provide for the common */
- X /* defense, promote the general welfare, */
- X /* and secure the blessing of liberty to */
- X /* ourselves and our posterity, do ordain */
- X /* and establish the Constitution of the */
- X /* United States of America. */
- X
- X Or after "par 59l":
- X
- X /* We the people of the United States, in */
- X /* order to form a more perfect union, establish */
- X /* justice, insure domestic tranquility, */
- X /* provide for the common defense, promote */
- X /* the general welfare, and secure the */
- X /* blessing of liberty to ourselves and our */
- X /* posterity, do ordain and establish the */
- X /* Constitution of the United States of America. */
- X
- X Or after "par 59lf":
- X
- X /* We the people of the United States, */
- X /* in order to form a more perfect union, */
- X /* establish justice, insure domestic */
- X /* tranquility, provide for the common */
- X /* defense, promote the general welfare, */
- X /* and secure the blessing of liberty */
- X /* to ourselves and our posterity, do */
- X /* ordain and establish the Constitution */
- X /* of the United States of America. */
- X
- X Or after "par 59lft0":
- X
- X /* We the people of the United States, */
- X /* in order to form a more perfect union, */
- X /* establish justice, insure domestic */
- X /* tranquility, provide for the common */
- X /* defense, promote the general welfare, */
- X /* and secure the blessing of liberty */
- X /* to ourselves and our posterity, do */
- X /* ordain and establish the Constitution */
- X /* of the United States of America. */
- X
- X Or after "par 59j":
- X
- X /* We the people of the United States, in */
- X /* order to form a more perfect union, establish */
- X /* justice, insure domestic tranquility, provide */
- X /* for the common defense, promote the general */
- X /* welfare, and secure the blessing of liberty */
- X /* to ourselves and our posterity, do ordain and */
- X /* establish the Constitution of the United */
- X /* States of America. */
- X
- X Or after "par 59jl":
- X
- X /* We the people of the United States, */
- X /* in order to form a more perfect */
- X /* union, establish justice, insure domestic */
- X /* tranquility, provide for the common defense, */
- X /* promote the general welfare, and secure */
- X /* the blessing of liberty to ourselves and */
- X /* our posterity, do ordain and establish the */
- X /* Constitution of the United States of America. */
- X
- X Before:
- X
- X Preamble We the people of the United States,
- X to the US in order to form
- X Constitution a more perfect union,
- X establish justice,
- X insure domestic tranquility,
- X provide for the common defense,
- X promote the general welfare,
- X and secure the blessing of liberty
- X to ourselves and our posterity,
- X do ordain and establish
- X the Constitution
- X of the United States of America.
- X
- X After "par 52h3":
- X
- X Preamble We the people of the United
- X to the US States, in order to form a
- X Constitution more perfect union, establish
- X justice, insure domestic
- X tranquility, provide for the
- X common defense, promote the
- X general welfare, and secure
- X the blessing of liberty to
- X ourselves and our posterity,
- X do ordain and establish the
- X Constitution of the United
- X States of America.
- X
- X Before:
- X
- X 1 We the people of the United States,
- X 2 in order to form a more perfect union,
- X 3 establish justice,
- X 4 insure domestic tranquility,
- X 5 provide for the common defense,
- X 6 promote the general welfare,
- X 7 and secure the blessing of liberty
- X 8 to ourselves and our posterity,
- X 9 do ordain and establish the Constitution
- X 10 of the United States of America.
- X
- X After "par 59p12l":
- X
- X 1 We the people of the United States, in order to
- X 2 form a more perfect union, establish justice,
- X 3 insure domestic tranquility, provide for the
- X 4 common defense, promote the general welfare,
- X 5 and secure the blessing of liberty to ourselves
- X 6 and our posterity, do ordain and establish the
- X 7 Constitution of the United States of America.
- X
- X Before:
- X
- X > > We the people
- X > > of the United States,
- X > > in order to form a more perfect union,
- X > > establish justice,
- X > > ensure domestic tranquility,
- X > > provide for the common defense,
- X >
- X > Promote the general welfare,
- X > and secure the blessing of liberty
- X > to ourselves and our posterity,
- X > do ordain and establish
- X > the Constitution of the United States of America.
- X
- X After "par 52":
- X
- X > > We the people of the United States, in
- X > > order to form a more perfect union,
- X > > establish justice, ensure domestic
- X > > tranquility, provide for the common
- X > > defense,
- X >
- X > Promote the general welfare, and secure
- X > the blessing of liberty to ourselves and
- X > our posterity, do ordain and establish
- X > the Constitution of the United States of
- X > America.
- X
- X Before:
- X
- X > We the people
- X > of the United States,
- X > in order to form a more perfect union,
- X > establish justice,
- X > ensure domestic tranquility,
- X > provide for the common defense,
- X > Promote the general welfare,
- X > and secure the blessing of liberty
- X > to ourselves and our posterity,
- X > do ordain and establish
- X > the Constitution of the United States of America.
- X
- X After "par 52d":
- X
- X > We the people of the United States,
- X > in order to form a more perfect union,
- X > establish justice, ensure domestic
- X > tranquility, provide for the common
- X > defense,
- X > Promote the general welfare, and secure
- X > the blessing of liberty to ourselves and
- X > our posterity, do ordain and establish
- X > the Constitution of the United States of
- X > America.
- X
- X Before:
- X
- X # 1. We the people of the United States.
- X # 2. In order to form a more perfect union.
- X # 3. Establish justice, ensure domestic
- X # tranquility.
- X # 4. Provide for the common defense
- X # 5. Promote the general welfare.
- X # 6. And secure the blessing of liberty
- X # to ourselves and our posterity.
- X # 7. Do ordain and establish the Constitution.
- X # 8. Of the United States of America.
- X
- X After "par 37p13dh":
- X
- X # 1. We the people of the
- X # United States.
- X # 2. In order to form a more
- X # perfect union.
- X # 3. Establish justice,
- X # ensure domestic
- X # tranquility.
- X # 4. Provide for the common
- X # defense
- X # 5. Promote the general
- X # welfare.
- X # 6. And secure the blessing
- X # of liberty to ourselves
- X # and our posterity.
- X # 7. Do ordain and establish
- X # the Constitution.
- X # 8. Of the United States of
- X # America.
- X
- X Before:
- X
- X /*****************************************/
- X /* We the people of the United States, */
- X /* in order to form a more perfect union, */
- X /* establish justice, insure domestic */
- X /* tranquility, */
- X /* */
- X /* */
- X /* [ provide for the common defense, ] */
- X /* [ promote the general welfare, ] */
- X /* [ and secure the blessing of liberty ] */
- X /* [ to ourselves and our posterity, ] */
- X /* [ ] */
- X /* */
- X /* do ordain and establish the Constitution */
- X /* of the United States of America. */
- X /******************************************/
- X
- X After "par 42r":
- X
- X /********************************/
- X /* We the people of the */
- X /* United States, in order to */
- X /* form a more perfect union, */
- X /* establish justice, insure */
- X /* domestic tranquility, */
- X /* */
- X /* */
- X /* [ provide for the common ] */
- X /* [ defense, promote the ] */
- X /* [ general welfare, and ] */
- X /* [ secure the blessing of ] */
- X /* [ liberty to ourselves ] */
- X /* [ and our posterity, ] */
- X /* [ ] */
- X /* */
- X /* do ordain and establish the */
- X /* Constitution of the United */
- X /* States of America. */
- X /********************************/
- X
- X Or after "par 42re":
- X
- X /********************************/
- X /* We the people of the */
- X /* United States, in order to */
- X /* form a more perfect union, */
- X /* establish justice, insure */
- X /* domestic tranquility, */
- X /* */
- X /* [ provide for the common ] */
- X /* [ defense, promote the ] */
- X /* [ general welfare, and ] */
- X /* [ secure the blessing of ] */
- X /* [ liberty to ourselves ] */
- X /* [ and our posterity, ] */
- X /* */
- X /* do ordain and establish the */
- X /* Constitution of the United */
- X /* States of America. */
- X /********************************/
- X
- X Before:
- X
- X Joe Public writes:
- X > Jane Doe writes:
- X > >
- X > >
- X > > I can't find the source for uncompress.
- X > Oh no, not again!!!
- X >
- X >
- X > Isn't there a FAQ for this?
- X >
- X >
- X That wasn't very helpful, Joe. Jane,
- X just make a link from uncompress to compress.
- X
- X After "par 40q":
- X
- X Joe Public writes:
- X
- X > Jane Doe writes:
- X >
- X >
- X > > I can't find the source for
- X > > uncompress.
- X >
- X > Oh no, not again!!!
- X >
- X >
- X > Isn't there a FAQ for this?
- X >
- X
- X That wasn't very helpful, Joe.
- X Jane, just make a link from
- X uncompress to compress.
- X
- X Or after "par 40qe":
- X
- X Joe Public writes:
- X
- X > Jane Doe writes:
- X >
- X > > I can't find the source for
- X > > uncompress.
- X >
- X > Oh no, not again!!!
- X >
- X > Isn't there a FAQ for this?
- X
- X That wasn't very helpful, Joe.
- X Jane, just make a link from
- X uncompress to compress.
- X
- X Or after "par 40qi":
- X
- X Joe Public writes:
- X > Jane Doe writes:
- X > >
- X > >
- X > > I can't find the source for
- X > > uncompress.
- X > Oh no, not again!!!
- X >
- X >
- X > Isn't there a FAQ for this?
- X >
- X >
- X That wasn't very helpful, Joe.
- X Jane, just make a link from
- X uncompress to compress.
- X
- X Or after "par 40qie":
- X
- X Joe Public writes:
- X > Jane Doe writes:
- X > > I can't find the source for
- X > > uncompress.
- X > Oh no, not again!!!
- X >
- X > Isn't there a FAQ for this?
- X That wasn't very helpful, Joe.
- X Jane, just make a link from
- X uncompress to compress.
- X
- X Before:
- X
- X I sure hope there's still room
- X in Dr. Jones' section of archaeology.
- X I've heard he's the bestest. [sic]
- X
- X After "par 50g":
- X
- X I sure hope there's still room in
- X Dr. Jones' section of archaeology. I've
- X heard he's the bestest. [sic]
- X
- X Or after "par 50gc":
- X
- X I sure hope there's still room in
- X Dr. Jones' section of archaeology. I've
- X heard he's the bestest. [sic]
- X
- X Before:
- X
- X John writes:
- X : Mary writes:
- X : + Anastasia writes:
- X : + > Hi all!
- X : + Hi Ana!
- X : Hi Ana & Mary!
- X Please unsubscribe me from alt.hello.
- X
- X After "par Q+:+ q":
- X
- X John writes:
- X
- X : Mary writes:
- X :
- X : + Anastasia writes:
- X : +
- X : + > Hi all!
- X : +
- X : + Hi Ana!
- X :
- X : Hi Ana & Mary!
- X
- X Please unsubscribe me from alt.hello.
- X
- X
- XLimitations
- X
- X The <guess> feature guesses wrong in cases like the following:
- X
- X I calc'd the approx.
- X Fermi level to 3 sig. digits.
- X
- X With <guess> = 1, par will incorrectly assume that "approx." ends a
- X sentence. If the input were:
- X
- X I calc'd the approx. Fermi
- X level to 3 sig. digits.
- X
- X then par would refuse to put a line break between "approx." and "Fermi"
- X in the output, mainly to avoid creating the first situation (in case the
- X paragraph were to be fed back through par again). This non-breaking
- X space policy does come in handy for cases like "Mr. Johnson" and
- X "Jan. 1", though.
- X
- X The <guess> feature only goes one way. par can preserve wide sentence
- X breaks in a paragraph, or remove them, but it can't insert them if they
- X aren't already in the input.
- X
- X If you use tabs, you probably won't like the way par handles (or doesn't
- X handle) them. It turns them into spaces. I didn't bother trying to
- X make sense of tabs because they don't make sense to begin with. Not
- X everyone's terminal has the same tab settings, so text files containing
- X tabs are sometimes mangled. In fact, almost every text file containing
- X tabs gets mangled when something is inserted at the beginning of each
- X line (when quoting e-mail or commenting out a section of a shell script,
- X for example), making them a pain to edit. In my opinion, the world
- X would be a nicer place if everyone stopped using tabs (so I'm doing my
- X part by not supporting them in par). If you find yourself editing a
- X file containing tabs, the first thing you should do is run the whole
- X file through expand, a standard UNIX command (if there is such a thing)
- X that replaces tabs with spaces while preserving the appearance of the
- X file. If you're not in a UNIX environment, then hopefully someone
- X has ported expand to your system. (Thanks to ets1@cs.wustl.edu (Eric
- X T. Stuebe) for showing me the light about tabs.)
- X
- X There is currently no way for the length of the output prefix to differ
- X from the length of the input prefix. Ditto for the suffix. I may
- X consider adding this capability in a future release, but right now I'm
- X not sure how I'd want it to work.
- X
- X
- XBugs
- X
- X If I knew of any bugs, I wouldn't release the package. Of course, there
- X may be bugs that I haven't yet discovered.
- X
- X If you find any bugs (in the program or in the documentation), or if you
- X have any suggestions, please send e-mail to:
- X
- X amc@ecl.wustl.edu
- X
- X or send paper mail to:
- X
- X Adam M. Costello
- X Campus Box 1045
- X Washington University
- X One Brookings Dr.
- X St. Louis, MO 63130
- X USA
- X
- X Note that both addresses could change anytime after June 1994.
- X
- X When reporting a bug, please include the exact input and command line
- X options used, and the version number of par, so that I can reproduce it.
- END_OF_FILE
- if test 49605 -ne `wc -c <'Par141/par.doc'`; then
- echo shar: \"'Par141/par.doc'\" unpacked with wrong size!
- fi
- # end of 'Par141/par.doc'
- fi
- echo shar: End of shell archive.
- exit 0
-
- exit 0 # Just in case...
-