Fixed a couple of bugs in _except_handler3.
[wine/multimedia.git] / documentation / db2html-winehq
blob8d2e681e948fd3fc8216ae688b4c32a6baec8cc7
1 #! /bin/sh
3 ## Customized version of db2html to make it easier to use alternate
4 ## stylesheets. Some versions of db2html support a '-d' option to
5 ## specify this, but not all. We'll explicitly specify that here.
6 ##
7 ## John R. Sheets <jsheets@codeweavers.com>
9 ## The DocBook installations behave differently for the various Linux
10 ## distributions. Try to make some sense out of it all....
12 ## $LINUXDIST holds the name of the distribution
13 ## $JADETAG adds "/#html" to the stylesheet-specification in the Jade
14 ## command line (see comments below), if necessary for that dist.
15 if [ -a /etc/debian_version ]; then
16 LINUXDIST="Debian"
17 JADETAG=\#html
20 if [ -a /etc/redhat_release ]; then
21 LINUXDIST="Redhat"
22 JADETAG=
25 ## FIXME: Add more distributions here...
27 if [ -n "$LINUXDIST" ]; then
28 echo "Using db2html parameters for a $LINUXDIST Linux distribution..."
31 ## Use included default.dsl DSSSL stylesheet unless explicitly overridden with
32 ## the $WINEDOC_STYLESHEET envar.
34 ## NOTE: The invoked DSSSL stylesheet *MUST* have an HTML-specific section
35 ## in it; otherwise, jade will spew everything to stdout and fail to use
36 ## the stated stylesheet. Something like this:
38 ## <style-specification id="html" use="docbook">
39 if [ -z "$WINEDOC_STYLESHEET" ]; then
40 DB_STYLESHEET=../default.dsl
41 else
42 DB_STYLESHEET=$WINEDOC_STYLESHEET
45 output=db2html-dir
46 TMPDIR=DBTOHTML_OUTPUT_DIR$$
48 echo TMPDIR is $TMPDIR
50 echo "Using stylesheet: \"${DB_STYLESHEET}\""
52 if [ $# -gt 2 ]
53 then
54 echo "Usage: `basename $0` [filename.sgml]" >&2
55 exit 1
58 if [ $# -eq 1 ]
59 then
60 if [ ! -r $1 ]
61 then
62 echo Cannot read \"$1\". Exiting. >&2
63 exit 1
65 if echo $1 | egrep -i '\.sgml$|\.sgm$' >/dev/null 2>&1
66 then
67 # now make sure that the output directory is always a subdirectory
68 # of the current directory
69 input_file=`basename $1`
70 output="`echo $input_file | sed 's,\.sgml$,,;s,\.sgm$,,'`"
71 echo "input file was called $input_file -- output will be in $output"
72 echo
76 mkdir $TMPDIR
77 SAVE_PWD=`pwd`
78 if [ $1 = `basename $1` ]; then
79 EXTRA_PATH=../
80 else
81 EXTRA_PATH=
84 JADE_CMD="jade -t sgml -ihtml -d ${DB_STYLESHEET}${JADETAG} ${EXTRA_PATH}$1"
85 echo "Invoking command '$JADE_CMD'"
86 echo
88 echo "working on ${EXTRA_PATH}$1"
89 (cd $TMPDIR; $JADE_CMD; cd $SAVE_PWD)
91 if [ $# -eq 1 ]
92 then
93 if [ -d ${output}.junk ]
94 then
95 /bin/rm -rf ${output}.junk
97 if [ -d ${output} ]
98 then
99 mv $output ${output}.junk
101 echo "about to rename temporary directory to $output"
102 mv ${TMPDIR} $output
103 else
104 cat $TMPDIR/*
107 rm -rf $TMPDIR
109 exit 0