#!/bin/sh

# This is a script which can be used to generate a contiguous
# Postscript-manual for HylaFAX containing all of the man pages
# The layout of the HylaFAX man pages makes this a non-trivial
# matter.
#
# This script requires HylaFAX and mpage to be installed.

MANPAGES="choptest \
	cid \
	cqtest \
	destctrls \
	dialrules \
	dialtest \
	doneq \
	fax2ps \
	faxabort \
	faxaddmodem \
	faxadduser \
	faxalter \
	faxanswer \
	faxconfig \
	faxcover \
	faxcron \
	faxdeluser \
	faxgetty \
	faxinfo \
	faxmail \
	faxmodem \
	faxq \
	faxqclean \
	faxquit \
	faxrcvd \
	faxrm \
	faxsend \
	faxsetup \
	faxstat \
	faxstate \
	faxwatch \
	hfaxd \
	hosts.hfaxd \
	hylafax-client \
	hylafax-config \
	hylafax-info \
	hylafax-log \
	hylafax-server \
	hylafax-shutdown \
	mkcover \
	notify \
	pagermap \
	pagesend \
	pagesizes \
	pdf2fax \
	pollrcvd \
	ps2fax \
	recvq \
	recvstats \
	sendfax \
	sendpage \
	sendq \
	sgi2fax \
	status \
	tagtest \
	textfmt \
	tiff2fax \
	tiffcheck \
	tsi \
	tsitest \
	typerules \
	wedged \
	xferfaxlog \
	xferfaxstats"

rm -rf manualmaker.tmp
mkdir manualmaker.tmp

for manpage in $MANPAGES; do
	CLEANMAN=`echo $manpage | sed 's/.*\/\(.*\)/\1/g'`
	man -t $manpage > manualmaker.tmp/$CLEANMAN.ps
done

if [ -n "$1" ]; then
	mpage -o -P- -1 -c manualmaker.tmp/*.ps > $1
else
	mpage -o -P- -1 -c manualmaker.tmp/*.ps -
fi

rm -rf manualmaker.tmp
