[net.general] text justify code posted to net.sources

silver (02/16/83)

As per several requests I have posted some original code.
"justify.c" may be compiled standalone, but the main program is but a 
crude driver for testing (tabs are not expanded, etc.).  I merged this
code into fmt.c (from UCB) for use from vi.  If anyone wants I could send
or post my modified version of fmt.c; it's much longer and not especially
clean.  It does have some bugs fixed and the new "-j" option to invoke
the code in justify.c.

Note that the algorithm using to justify is not simple.  It gives fairly
nice results (by inserting blanks between the longest words), but other,
simpler algorithms might be just as nice (such as insert from the left
then right on alternating lines).  Have fun!

Alan Silverstein
csu-cs!hp-esd!ajs