# Generate manual pages for COHERENT.
# Redirect the output of this script into a file, so you can massage it into
# a form that can be read by the "man" command.
#
# copyright (c) 1991-1994 by Mark Williams Company, Northbrook Ill.
#
# must su to "bin" before running.

if [ `whoami` != "bin" ] ; then
	echo "Sorry, only user 'bin' can run this program"
	exit
fi

INPUT=/v/doc/coherent
OUTPUT=/usr/man
INDEX=/usr/man/man.index

rm $INDEX
touch $INDEX
rm $OUTPUT/COHERENT.1/*
rm $OUTPUT/COHERENT.1/*

cd $INPUT/lx

# to keep file system from jumping the rails, we split the man pages into
# two directories.  Note that suffixes '1' and '2' have *nothing* to do
# with the goofy UNIX documentation categories.

# create first batch
echo ".ds OD COHERENT.1" > /tmp/coherent.r
mkdir $OUTPUT/COHERENT.1
for i in `ls [_-l]*`
do
	nroff -x -mcohman $INPUT/manual/top.r /tmp/coherent.r $i \
		> $OUTPUT/COHERENT.1/$i 2>> $INDEX
done

# create second batch
echo ".ds OD COHERENT.2" > /tmp/coherent.r
mkdir $OUTPUT/COHERENT.2
for i in `ls [m-z]*`
do
	nroff -x -mcohman $INPUT/manual/top.r /tmp/coherent.r $i \
		> $OUTPUT/COHERENT.2/$i 2>> $INDEX
done

rm /tmp/coherent.r
touch $INPUT/man.pages/updated.coh
