#! /bin/sh
:
#$Id: mansed,v 1.24 1994/08/23 14:47:18 berg Exp $

if test -z "$IFS"
then IFS=" \
	\

"
  export IFS
fi

test 5 != $# &&
 echo "Don't start this script directly, use \`make'" && exit 1

SHELL=$1
SRC="$2"
DEST="$3"
RM="$4"
DEVNULL=$5
export SHELL SRC DEST RM DEVNULL

if test ! -f "$DEST"
then
 trap "$RM \"$DEST\";exit 1" 1 2 3 15
fi

(cat <<\HERE
.\"if n .pl +(135i-\n(.pu)
.de Id
.ds Rv \\$3
.ds Dt \\$4
..
HERE
sed -e '1,/^.ex/ d' -e '/^\.TH/ q' <$SRC
cat <<\HERE
.rn SH Sh
.de SH
.br
.ne 11
.Sh "\\$1"
..
.rn SS Ss
.de SS
.br
.ne 10
.Ss "\\$1"
..
.rn TP Tp
.de TP
.br
.ne 9
.Tp \\$1
..
.rn RS Rs
.de RS
.na
.nf
.Rs
..
.rn RE Re
.de RE
.Re
.fi
.ad
..
.de Sx
.PP
.ne \\$1
.RS
..
.de Ex
.RE
.PP
..
HERE
sed -e '1,/^\.TH/ d' <$SRC
expr "X$DEST" : '.*[18]$' >$DEVNULL && cat <<HERE
.Sh SOURCE
This program is part of the
.I procmail mail-processing-package
(@PM_VERSION@) available at your nearest USENET comp.sources.misc archive, or
at ftp.informatik.rwth-aachen.de as
.BR pub/packages/procmail/procmail.tar.gz .
.Sh MAILINGLIST
There exists a mailinglist for questions relating to any program in the
procmail package:
.RS
@PM_MAILINGLIST@
.RS
for submitting questions/answers.
.RE
@PM_MAILINGLISTR@
.RS
for subscription requests.
.RE
.RE
HERE
cat <<HERE
.Sh AUTHOR
Stephen R. van den Berg at RWTH-Aachen, Germany
.Rs
@MY_MAIL_ADDR@
.\" @MY_ALT_MAIL_ADDR@
.Re
.\".if n .pl -(\n(.tu-1i)
HERE
 )| sed -f man.sed |
 if test -f man.sed.1
 then
   sed -f man.sed.0 | sed -f man.sed.1
 else
   sed -f man.sed.0
 fi >"$DEST"

if test -f "$DEST"
then
 exit 0
else
 exit 1
fi
