Vi

Mike Lee mikey at ontek.UUCP
Wed Jun 14 03:16:33 AEST 1989


I got tired of ragged edges in my  paragraphs,  so  here  is  yet
another  shell script to invoke nroff.  It done in the C-shell. A
possible portability problem is that it uses "shift_lines"  which
I know is a  given  with  SunOS 4.0, but other OS's may not be so
generous.  If I get some complaints, I could probably make a  few
lines  of   C  code  do  the  same  thing.  These paragraphs were
adjusted using this script.

To use the script, go !}<name of script> N, where you,  YES  YOU,
get to choose the name of the script.  N is the number of columns
to shift the paragraph to the right.  The default  is   currently
two   columns.  If  the  paragraph  is already indented to column
two, the script won't keep on indenting it.  I suggest you change
the  default  to whatever suits you best.  Pass 0 to jam stuff up
against the left column.

NOTE: I know little or nothing about nroff.  Some other kind soul
may  see  fit  to  add  some  more echo statements to use some of
nroff's neater feature eaters.


Here goes.....................................................
# csh script to call up nroff on a paragraph
#
set temp_file = /tmp/foom.$$

# change default indentation to your liking
set columns = 2
if ( $1 != "" ) set columns = $1

echo ".hy 0" >! $temp_file
echo ".pl 1" >> $temp_file

cat | shift_lines -$columns >> $temp_file
nroff $temp_file | shift_lines $columns

rm $temp_file
.............................................................


Mike Lee
mikey at ontek.uucp
...uunet!ontek!mikey
1-714-768-0301



More information about the Comp.unix.questions mailing list