blob: e4a0f8de839cd07acdff605aa868a1f9b7c523b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
#! /bin/sh
# $XFree86$
set -x
# @(#)mmdoc 1.21 /doccenter/tmadm/src/shell/s.mmdoc
# general documentation generator
#
# Files begining with a ".TH" macro are treated as manual pages.
# Files whose first line is
# '\" x
# where "x" is a string begining with "c", "e", "t" are also treated as
# manual pages.
# Files whose first line is
# '\"! text
# are processed by the command line "text" with the file provided
# as the standard input.
# Files whose first line is
# '\"macro name
# where "name" is the name of a file in TMMACRO will be run off with
# that macro package. "name"s begining "-" will be flag arguments
# to nroff.
# All others are handed to nroff with -cm and mmdoc
#
# Assumes mdate.pl will be found by the current search path.
#
umask 0 # nroff must be able to write into files it closes
while [ -n "$1" ]
do
case $1 in
-D )
DrafT=-rC3
export DrafT
;;
-T* )
TERM=`expr $1 : '-T\(.*\)'`
case ${TERM} in
eps)
post="|deps"
flavor=troff
;;
aps)
post="|apsend b=m305"
flavor=troff
;;
Aps) # This is a fake out so that collections
# can be sent as a unit to APS-5
# instead of series of calls. Used only by
# collection routine 'tcol_final'
post=
flavor=troff
TERM=aps
;;
image)
post="|apsend b=m305 d=i"
flavor=troff
TERM=aps
;;
i300)
post="|dimpress"
flavor=troff
;;
8300)
post="|dimpress"
flavor=troff
TERM=aps
;;
psc)
post="|psdit |lp -oh"
flavor=troff
export TERM
;;
PS)
post="|psdit"
flavor=troff
TERM=psc
export TERM
;;
X100)
post=""
flavor=troff
TERM=X100
export TERM
;;
*)
post=
flavor=nroff
;;
esac
export post flavor
;;
-r[ymd]* )
DocdatE="$DocdatE $1"
export DocdatE
dateset=yes
;;
-?* )
flags="$flags $1"
export flags
;;
- | * )
break
esac
shift
done
if [ $# = 0 ]
then
set -- -
fi
for i
{
if [ "$i" != "-" -a ! -s "$i" ]
then
echo "Cannot input file: $i"
continue
fi
case $i in
- )
;;
* )
Line1=`line <$i`
if [ ! "${dateset}" ]
then
# DocdatE is intentionally capitalized that way
# to cut the possibility of env name collision.
DocdatE=`mdate.pl $i`
export DocdatE
fi
esac
MacrO=${TMMACRO}
case "${Line1}" in
.TH* | "'\\\" "[cet]* )
man -T${TERM} -d ${DocdatE} $*
;;
"'\\\"!"* )
cmd=`echo "${Line1}" | sed 's/^....//'`
if [ "$flavor" != troff ]
then
cmd=`echo " ${cmd} " | sed 's/ eqn / neqn /'`
fi
Line1=`sed -n -e 2p -e 2q ${i}`
export Line1
if [ "$flavor" = troff ]
then
eval '<$i' $cmd
#eval `parse "$cmd" ${i}`
else
TERM=lp
eval '<$i' $cmd
fi
;;
"'\\\"macro"* )
cmd=`echo "${Line1}" |
sed ' s/.."macro//'"
s:[ ]\([^- ]\): ${TMMACRO?}/\1:g"`
cmd=`echo $cmd|sed "s;[ ]*.*/stdmacro;${MacrO?}/strings.mm ${MacrO?}/stdmacro;"`
cmd="$cmd $OTHERFILES"
if [ "$flavor" = troff ]
then
case "$cmd" in
*stdmacro*)
case "$flags" in
*-rs[0-9]*)
;;
*)
flags="${flags} -rs1"
esac
esac
eval troff -T${TERM} ${DrafT} ${DocdatE} ${flags} ${cmd} $i ${post}
else
eval nroff ${DrafT} ${DocdatE} ${flags} ${cmd} $i
fi
;;
"'\\\"text"* )
cmd=`echo "${Line1}" |
sed ' s/.."text//'"
s:[ ]\([^- ]\): ${TMMACRO?}/\1:g"`
cmd=`echo $cmd|sed "s;[ ]*.*/docmacs;${MacrO?}/docmacs;"`
if [ "$flavor" = troff ]
then
eval troff -T${TERM} ${DrafT} ${DocdatE} ${flags} ${cmd} $i ${post}
else
eval nroff ${DrafT} ${DocdatE} ${flags} ${cmd} $i
fi
;;
.tH* )
# Right now 2/12/85 this stuff not used for DSG work.
# No enhancements to do troff done yet.
# Will do as necessary
if [ -r ${TMMACRO}/mandocvar ]
then
. ${TMMACRO}/mandocvar
fi
nroff -T${TERM} ${DocdatE} ${flags} \
-can ${MacrO?}/mandoc ${i} |
col
;;
.pH* | '' | * )
if [ -r ${TMMACRO}/mmdocvar ]
then
. ${TMMACRO}/mmdocvar
fi
if [ "$flavor" = troff ]
then
eval troff -T${TERM} -rW${Width:-5}i \
-rL${Length:-8.5}i \
${DocdatE} ${DrafT} ${flags} \
/usr/bin/mmt $i ${post}
else
TERM=lp
nroff -T${TERM} -u${Overstrike:-1} -rW${Width:-79} \
-rO${Offset:-0} -rL${Length:-66} \
${DocdatE} ${DrafT} ${flags} \
${MacrO?}/newmm \
${MacrO?}/mmdoc ${TMMACRO}/custom $i |
col
fi
;;
esac
}
|