1#! /bin/sh
2:
3#$Id: mansed,v 1.30 2000/09/28 01:23:07 guenther Exp $
4
5if test -z "$IFS"
6then IFS=" \
7	\
8
9"
10  export IFS
11fi
12
13test 5 != $# &&
14 echo "Don't start this script directly, use \`make'" && exit 1
15
16SHELL=$1
17SRC="$2"
18DEST="$3"
19RM="$4"
20DEVNULL=$5
21export SHELL SRC DEST RM DEVNULL
22TMPF0=/tmp/_mansed.0.$$
23TMPF1=/tmp/_mansed.1.$$
24
25if test ! -f "$DEST"
26then
27 trap "$RM \"$DEST\" $TMPF0 $TMPF1;exit 1" 1 2 3 15
28fi
29
30(cat <<\HERE
31.\"if n .pl +(135i-\n(.pu)
32.de Id
33.ds Rv \\$3
34.ds Dt \\$4
35..
36HERE
37sed -e '1,/^.ex/ d' -e '/^\.TH/ q' <$SRC
38cat <<\HERE
39.rn SH Sh
40.de SH
41.br
42.ne 11
43.Sh "\\$1"
44..
45.rn SS Ss
46.de SS
47.br
48.ne 10
49.Ss "\\$1"
50..
51.rn TP Tp
52.de TP
53.br
54.ne 9
55.Tp \\$1
56..
57.rn RS Rs
58.de RS
59.na
60.nf
61.Rs
62..
63.rn RE Re
64.de RE
65.Re
66.fi
67.ad
68..
69.de Sx
70.PP
71.ne \\$1
72.RS
73..
74.de Ex
75.RE
76.PP
77..
78HERE
79sed -e '1,/^\.TH/ d' <$SRC
80expr "X$DEST" : '.*[18]$' >$DEVNULL && cat <<HERE
81.Sh SOURCE
82This program is part of the
83.I procmail mail-processing-package
84(v@PM_VERSION@) available at http://www.procmail.org/ or
85ftp.procmail.org in
86.BR pub/procmail/ .
87.Sh MAILINGLIST
88There exists a mailinglist for questions relating to any program in the
89procmail package:
90.RS
91@PM_MAILINGLIST@
92.RS
93for submitting questions/answers.
94.RE
95@PM_MAILINGLISTR@
96.RS
97for subscription requests.
98.RE
99.PP
100.RE
101If you would like to stay informed about new versions and official patches send
102a subscription request to
103.RS
104procmail-announce-request@procmail.org
105.RE
106(this is a readonly list).
107HERE
108cat <<HERE
109.SH AUTHORS
110@AUTHORS@
111.\".if n .pl -(\n(.tu-1i)
112.rm SH
113.rn Sh SH
114.rm SS
115.rn Ss SS
116.rm TP
117.rn Tp TP
118.rm RS
119.rn Rs RS
120.rm RE
121.rn Re RE
122HERE
123 )| sed -f man.sed.0000 >$TMPF0
124
125if test $? != 0
126then
127  $RM $TMPF0
128  exit 1
129fi
130
131for a in man.sed.[0-9]*
132do
133  case $a in
134     man.sed.0000) ;;
135     man.sed.????)
136	mv $TMPF0 $TMPF1
137	if sed -f $a <$TMPF1 >$TMPF0
138	then
139	:
140	else
141	   $RM $TMPF1 $TMPF0
142	   exit 1
143	fi
144  esac
145done
146
147cat $TMPF0 >"$DEST"
148result=$?
149
150$RM $TMPF0 $TMPF1
151exit $result
152