TIVI-153: add as dependency for iputils
[profile/ivi/docbook-utils.git] / frontends / docbook.in
1 # Frontend to convert a docbook file into something else
2 # Send any comments to Eric Bischoff <eric@caldera.de>
3 # This program is under GPL license. See LICENSE file for details.
4
5 case "$1" in
6 # Give the location of the centralized catalog
7 # First try the one with a version matching the version that is indicated in the document
8   centralized-catalog)
9         if [ -n "$SGML_NORM" ]; then
10           SGML_NORM_OPTS='-d'
11         else
12           SGML_NORM=cat
13           SGML_NORM_OPTS=
14         fi
15         SGML_VERSION=`"$SGML_NORM" $SGML_NORM_OPTS -- "$SGML_FILE" 2>/dev/null |
16                         grep -i '<!DOCTYPE' |
17                         head -n 1 |
18                         sed 's/^.*DocBook\( XML\)\? V\([0-9][\.0-9]*\).*$/\2/'`
19         SGML_CATALOG=
20         for f in "${SGML_CATALOGS_DIR}/${SGML_XML}-docbook-${SGML_VERSION}"*".cat"
21         do 
22           if [ -f "$f" ]
23           then
24             SGML_CATALOG=$f
25             break
26           fi
27         done
28         if [ -z "$SGML_CATALOG" ]
29         then
30           if [ "${SGML_XML}" != "sgml" ]
31           then SGML_CATALOG=${SGML_CATALOGS_DIR}/${SGML_XML}-docbook.cat
32           else SGML_CATALOG=${SGML_CATALOGS_DIR}/catalog
33           fi
34         fi
35         echo "$SGML_CATALOG"
36         ;;
37 # Find a stylesheet on the model "html/docbook.dsl" or "print/docbook.dsl"
38   style-sheet)
39         case $SGML_STYLESHEET in
40           default)
41             echo "${SGML_BASE_DIR}/docbook/utils-@VERSION@/docbook-utils.dsl#${SGML_TYPE}"
42             ;;
43           none)
44             find $SGML_BASE_DIR -name docbook.dsl | grep "$SGML_TYPE/docbook.dsl" | awk '{print $1}'
45             ;;
46         esac
47         ;;
48   *)    exit 1
49         ;;
50 esac
51
52 exit 0