summaryrefslogtreecommitdiff
path: root/backends/man.in
diff options
context:
space:
mode:
Diffstat (limited to 'backends/man.in')
-rw-r--r--backends/man.in27
1 files changed, 27 insertions, 0 deletions
diff --git a/backends/man.in b/backends/man.in
new file mode 100644
index 0000000..e95d3c6
--- /dev/null
+++ b/backends/man.in
@@ -0,0 +1,27 @@
+# Backend to convert a DocBook file into a man page
+# Send any comments to Jochem Huhmann <joh@revier.com>
+# This program is under GPL license. See LICENSE file for details.
+
+# Convert to *roff
+HELPER=$SGML_BASE_DIR/docbook/utils-@VERSION@/helpers/docbook2man-spec.pl
+TMPDIR=`mktemp -d /tmp/man.XXXXXX` || \
+ { echo >&2 "man backend: could not create secure temporary directory"; exit 1;}
+trap 'rm -rf "${TMPDIR}"' EXIT
+nsgmls $SGML_FILE > "${TMPDIR}/nsgmls.tmp"
+sgmlspl $HELPER <"${TMPDIR}/nsgmls.tmp" 2>"${TMPDIR}/errs"
+if [ $? -ne 0 ]
+then
+ cat "${TMPDIR}/errs"
+ exit 1
+fi
+
+if grep unresolved "${TMPDIR}/errs" >/dev/null 2>&1
+then
+ echo "Resolving references.."
+ sgmlspl $HELPER <"${TMPDIR}/nsgmls.tmp"
+ if [ $? -ne 0 ]
+ then exit 1
+ fi
+fi
+
+exit 0