| 1 |
#!/bin/sh |
| 2 |
############################################################################# |
| 3 |
# |
| 4 |
# docbook-to-man.sh |
| 5 |
# |
| 6 |
############################################################################# |
| 7 |
# |
| 8 |
# Copyright (c) 1996 X Consortium |
| 9 |
# Copyright (c) 1996 Dalrymple Consulting |
| 10 |
# |
| 11 |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 12 |
# of this software and associated documentation files (the "Software"), to deal |
| 13 |
# in the Software without restriction, including without limitation the rights |
| 14 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 |
# copies of the Software, and to permit persons to whom the Software is |
| 16 |
# furnished to do so, subject to the following conditions: |
| 17 |
# |
| 18 |
# The above copyright notice and this permission notice shall be included in |
| 19 |
# all copies or substantial portions of the Software. |
| 20 |
# |
| 21 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 22 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 24 |
# X CONSORTIUM OR DALRYMPLE CONSULTING BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 25 |
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 26 |
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 27 |
# OTHER DEALINGS IN THE SOFTWARE. |
| 28 |
# |
| 29 |
# Except as contained in this notice, the names of the X Consortium and |
| 30 |
# Dalrymple Consulting shall not be used in advertising or otherwise to |
| 31 |
# promote the sale, use or other dealings in this Software without prior |
| 32 |
# written authorization. |
| 33 |
# |
| 34 |
############################################################################# |
| 35 |
# |
| 36 |
# Written 5/29/96 by Fred Dalrymple |
| 37 |
# |
| 38 |
############################################################################# |
| 39 |
|
| 40 |
# ***** change the following paths if your installation of nsgmls and / or |
| 41 |
# ***** DocBook isn't into the default places. |
| 42 |
|
| 43 |
ROOT=/usr/local |
| 44 |
SGMLS=$ROOT/lib/sgml |
| 45 |
DOCBOOK=$SGMLS/Davenport/dtd |
| 46 |
|
| 47 |
|
| 48 |
# ***** modify the following line (to "=false") if you're not using the |
| 49 |
# ***** Elan Documentor's Workbench |
| 50 |
|
| 51 |
doElanPSInclude=true |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
# Everything below this line should be pretty standard and not require |
| 56 |
# modification. |
| 57 |
|
| 58 |
#ulimit -c unlimited |
| 59 |
|
| 60 |
PARSER=nsgmls |
| 61 |
INSTANT=instant |
| 62 |
INSTANT_OPT=-d |
| 63 |
|
| 64 |
CATALOG=$DOCBOOK/docbook.cat |
| 65 |
DECL=$DOCBOOK/docbook.dcl |
| 66 |
#PROLOG=$DOCBOOK/docbook.prolog |
| 67 |
|
| 68 |
error=false |
| 69 |
|
| 70 |
if [ $# -eq 1 ] |
| 71 |
then INSTANCE=$1 |
| 72 |
else error=true |
| 73 |
fi |
| 74 |
|
| 75 |
if `$error` |
| 76 |
then echo "usage: docbook-to-man docbook-instance" |
| 77 |
exit 1 |
| 78 |
fi |
| 79 |
|
| 80 |
if `$doElanPSInclude` |
| 81 |
then cat > /tmp/dtm.$$.psinc <<\! |
| 82 |
...\" $Header: /aolnet/dev/src/CVS/sgml/docbook-to-man/cmd/docbook-to-man.sh,v 1.1.1.1 1998/11/13 21:31:59 db3l Exp $ |
| 83 |
...\" |
| 84 |
...\" transcript compatibility for postscript use. |
| 85 |
...\" |
| 86 |
...\" synopsis: .P! <file.ps> |
| 87 |
...\" |
| 88 |
.de P! |
| 89 |
\\&. |
| 90 |
.fl \" force out current output buffer |
| 91 |
\\!%PB |
| 92 |
\\!/showpage{}def |
| 93 |
...\" the following is from Ken Flowers -- it prevents dictionary overflows |
| 94 |
\\!/tempdict 200 dict def tempdict begin |
| 95 |
.fl \" prolog |
| 96 |
.sy cat \\$1\" bring in postscript file |
| 97 |
...\" the following line matches the tempdict above |
| 98 |
\\!end % tempdict % |
| 99 |
\\!PE |
| 100 |
\\!. |
| 101 |
.sp \\$2u \" move below the image |
| 102 |
.. |
| 103 |
! |
| 104 |
else cat > /tmp/dtm.$$.psinc <<\! |
| 105 |
...\" $Header: /aolnet/dev/src/CVS/sgml/docbook-to-man/cmd/docbook-to-man.sh,v 1.1.1.1 1998/11/13 21:31:59 db3l Exp $ |
| 106 |
...\" |
| 107 |
...\" transcript compatibility for postscript use. |
| 108 |
...\" |
| 109 |
...\" synopsis: .P! <file.ps> |
| 110 |
...\" |
| 111 |
.de P! |
| 112 |
.fl |
| 113 |
\!!1 setgray |
| 114 |
.fl |
| 115 |
\\&.\" |
| 116 |
.fl |
| 117 |
\!!0 setgray |
| 118 |
.fl \" force out current output buffer |
| 119 |
\!!save /psv exch def currentpoint translate 0 0 moveto |
| 120 |
\!!/showpage{}def |
| 121 |
.fl \" prolog |
| 122 |
.sy sed -e 's/^/!/' \\$1\" bring in postscript file |
| 123 |
\!!psv restore |
| 124 |
. |
| 125 |
! |
| 126 |
fi |
| 127 |
|
| 128 |
cat >> /tmp/dtm.$$.psinc <<\! |
| 129 |
.de pF |
| 130 |
.ie \\*(f1 .ds f1 \\n(.f |
| 131 |
.el .ie \\*(f2 .ds f2 \\n(.f |
| 132 |
.el .ie \\*(f3 .ds f3 \\n(.f |
| 133 |
.el .ie \\*(f4 .ds f4 \\n(.f |
| 134 |
.el .tm ? font overflow |
| 135 |
.ft \\$1 |
| 136 |
.. |
| 137 |
.de fP |
| 138 |
.ie !\\*(f4 \{\ |
| 139 |
. ft \\*(f4 |
| 140 |
. ds f4\" |
| 141 |
' br \} |
| 142 |
.el .ie !\\*(f3 \{\ |
| 143 |
. ft \\*(f3 |
| 144 |
. ds f3\" |
| 145 |
' br \} |
| 146 |
.el .ie !\\*(f2 \{\ |
| 147 |
. ft \\*(f2 |
| 148 |
. ds f2\" |
| 149 |
' br \} |
| 150 |
.el .ie !\\*(f1 \{\ |
| 151 |
. ft \\*(f1 |
| 152 |
. ds f1\" |
| 153 |
' br \} |
| 154 |
.el .tm ? font underflow |
| 155 |
.. |
| 156 |
.ds f1\" |
| 157 |
.ds f2\" |
| 158 |
.ds f3\" |
| 159 |
.ds f4\" |
| 160 |
! |
| 161 |
|
| 162 |
|
| 163 |
#if [ ! -f $PROLOG ] |
| 164 |
#then cat > $PROLOG <<! |
| 165 |
#<!DOCTYPE RefEntry PUBLIC "-//Davenport//DTD DocBook V2.4.1//EN" [ |
| 166 |
#<!ENTITY npzwc ""> |
| 167 |
#]> |
| 168 |
#! |
| 169 |
#fi |
| 170 |
|
| 171 |
(cat /tmp/dtm.$$.psinc; |
| 172 |
$PARSER -gl -m$CATALOG $DECL $INSTANCE | |
| 173 |
$INSTANT $INSTANT_OPT -croff.cmap -sroff.sdata -tdocbook-to-man.ts) |
| 174 |
|
| 175 |
rm -f /tmp/dtm.$$.psinc |