|
@@ -1,7 +1,5 @@
|
|
|
#!@KSH@
|
|
|
|
|
|
-export LC_CTYPE="${LANG}"
|
|
|
-
|
|
|
# get the name of this command for errors, warnings and messages
|
|
|
command_name=`basename $0`
|
|
|
|
|
@@ -77,41 +75,69 @@ do
|
|
|
(u) uncompressed=1;;
|
|
|
(v) verbose=1;;
|
|
|
(x) debug=1;;
|
|
|
+ (L) x_locale="$OPTARG";;
|
|
|
# undocumented options to be used at build time
|
|
|
(H) helptag2="$OPTARG";;
|
|
|
(I) instant="$OPTARG";;
|
|
|
- (L) x_locale="$OPTARG";;
|
|
|
(S) sgmls="$OPTARG";;
|
|
|
|
|
|
(?) fatal "Unknown option: -$OPTARG";;
|
|
|
esac
|
|
|
done
|
|
|
|
|
|
+
|
|
|
+# The user asked for help, give it and exit.
|
|
|
+if (( $help )); then
|
|
|
+ echo "$command_name [options] <file>"
|
|
|
+ echo "options:"
|
|
|
+ echo " -c compress an existing SDL file"
|
|
|
+ echo " -d decompress an existing SDL file"
|
|
|
+ echo " -g specify additional catalog file (repeatable)"
|
|
|
+ echo " -h emit this message"
|
|
|
+ echo " -l leave <basename>.<pid>.log in current directory"
|
|
|
+ echo " -m <maps> add <maps> to list of SDATA or CMAP files"
|
|
|
+ echo " -o <file> use <file> as the output file name"
|
|
|
+ echo " -r remove leftover intermediate files"
|
|
|
+ echo " -s <dir> docbook.dcl is in <dir>"
|
|
|
+ echo " -t <dir> read translation specs, etc., from <dir>"
|
|
|
+ echo " -u do not compress during translation"
|
|
|
+ echo " -v verbose"
|
|
|
+ echo " -x leave intermediate files, for debugging"
|
|
|
+ echo " -L <locale> set the current locale to <locale>"
|
|
|
+ exit 0
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+# Check for too many input files or none.
|
|
|
+if (( $OPTIND < $# )); then
|
|
|
+ fatal "Too many names after the options, should only be input file name"
|
|
|
+elif (( $OPTIND > $# )); then
|
|
|
+ fatal "No input file name specified"
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+if [[ $x_locale == "" ]] then
|
|
|
+ fatal "No locale specified"
|
|
|
+fi
|
|
|
+
|
|
|
+# Check for mutually exclusive options.
|
|
|
+if (( $compress && $decompress )); then
|
|
|
+ fatal "$c_and_d are mutually exclusive."
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
default_charset='UTF-8'
|
|
|
-default_locale="en_US.$default_charset"
|
|
|
|
|
|
-# if no -t, use installed dir
|
|
|
prefix="${prefix:-@prefix@}"
|
|
|
exec_prefix="@exec_prefix@"
|
|
|
|
|
|
-export PATH="${PATH}:@bindir@"
|
|
|
-
|
|
|
dcbk_name="@PACKAGE_TARNAME@/dtdocbook"
|
|
|
-
|
|
|
dtdcbk_libdir="${dtdcbk_libdir:-@libdir@/${dcbk_name}}"
|
|
|
dtdcbk_libexecdir="${dtdcbk_libexecdir:-@libexecdir@/${dcbk_name}}"
|
|
|
dtdcbk_datarootdir="${dtdcbk_datarootdir:-@datarootdir@/${dcbk_name}}"
|
|
|
|
|
|
-# if no -I, use installed one
|
|
|
-instant="${instant:-${dtdcbk_libexecdir}/instant/instant}"
|
|
|
-
|
|
|
-# if no -s, use -t
|
|
|
sgml_dir="${sgml_dir:-${dtdcbk_datarootdir}/sgml}"
|
|
|
|
|
|
-sgml_cat="${sgml_dir}"
|
|
|
-sgmls="${sgmls:-onsgmls}" # if no -S, use onsgmls
|
|
|
-x_locale="${x_locale:-${LANG}}" # if no -L, use installed one
|
|
|
-helptag2="${helptag2:-dthelp_htag2}" # if no -H, use one in PATH
|
|
|
|
|
|
if [[ $x_locale == *.* ]] then
|
|
|
x_lang="${x_locale%%.*}"
|
|
@@ -124,73 +150,42 @@ else
|
|
|
x_locale="${x_locale}.$default_charset"
|
|
|
fi
|
|
|
|
|
|
-# Set the environment variables for instant(1) to find its files
|
|
|
-export TPT_LIB="${dtdcbk_datarootdir}/tpt"
|
|
|
-export LOCALE_DIR="${dtdcbk_datarootdir}/locales/${x_locale}"
|
|
|
-
|
|
|
-if [[ -d $LOCALE_DIR ]] then
|
|
|
- export LOCALE_DIR="${dtdcbk_datarootdir}/locales/${default_locale}"
|
|
|
-fi
|
|
|
-
|
|
|
-parser=`basename $sgmls`
|
|
|
-
|
|
|
-# Set the environment variable for finding the default catalog.
|
|
|
if ([[ "$SGML_CATALOG_FILES" = "" ]]) then
|
|
|
- export SGML_CATALOG_FILES="${sgml_cat}/catalog"
|
|
|
+ SGML_CATALOG_FILES="${sgml_dir}/catalog"
|
|
|
else
|
|
|
- export SGML_CATALOG_FILES="${SGML_CATALOG_FILES}:${sgml_cat}/catalog"
|
|
|
+ SGML_CATALOG_FILES="${SGML_CATALOG_FILES}:${sgml_dir}/catalog"
|
|
|
fi
|
|
|
|
|
|
+
|
|
|
+export PATH="${PATH}:@bindir@"
|
|
|
export SP_CHARSET_FIXED=1
|
|
|
export SP_ENCODING="$default_charset"
|
|
|
-
|
|
|
-# Set the environment variable to be picked up inside instant(1) when it
|
|
|
-# goes to call Tcl.
|
|
|
export DBKTCL_DIR="${dtdcbk_libdir}/tcl"
|
|
|
+export TPT_LIB="${dtdcbk_datarootdir}/tpt"
|
|
|
+export LOCALE_DIR="${dtdcbk_datarootdir}/locales/${x_locale}"
|
|
|
+export SGML_CATALOG_FILES
|
|
|
|
|
|
|
|
|
-# The user asked for help, give it and exit.
|
|
|
-if (( $help )); then
|
|
|
- echo "$command_name [options] <file>"
|
|
|
- echo "options:"
|
|
|
- echo " -c compress an existing SDL file"
|
|
|
- echo " -d decompress an existing SDL file"
|
|
|
- echo " -g specify additional catalog file (repeatable)"
|
|
|
- echo " -h emit this message"
|
|
|
- echo " -l leave <basename>.<pid>.log in current directory"
|
|
|
- echo " -m <maps> add <maps> to list of SDATA or CMAP files"
|
|
|
- echo " -o <file> use <file> as the output file name"
|
|
|
- echo " -r remove leftover intermediate files"
|
|
|
- echo " -s <dir> docbook.dcl is in <dir>"
|
|
|
- echo " -t <dir> read translation specs, etc., from <dir>"
|
|
|
- echo " -u do not compress during translation"
|
|
|
- echo " -v verbose"
|
|
|
- echo " -x leave intermediate files, for debugging"
|
|
|
- exit 0
|
|
|
+if [[ ! -d $LOCALE_DIR || ! -x $LOCALE_DIR ]] then
|
|
|
+ fatal "$LOCALE_DIR can't be accessed"
|
|
|
fi
|
|
|
|
|
|
|
|
|
-# Check for too many input files or none.
|
|
|
-if (( $OPTIND < $# )); then
|
|
|
- fatal "Too many names after the options, should only be input file name"
|
|
|
-elif (( $OPTIND > $# )); then
|
|
|
- fatal "No input file name specified"
|
|
|
-fi
|
|
|
+# if no -I, use installed one
|
|
|
+instant="${instant:-${dtdcbk_libexecdir}/instant/instant}"
|
|
|
+sgmls="${sgmls:-onsgmls}" # if no -S, use onsgmls
|
|
|
+helptag2="${helptag2:-dthelp_htag2}" # if no -H, use one in PATH
|
|
|
|
|
|
|
|
|
# Get the name of the input file.
|
|
|
iname=`eval echo \\\${\$OPTIND}`
|
|
|
|
|
|
-# Check for mutually exclusive options.
|
|
|
-if (( $compress && $decompress )); then
|
|
|
- fatal "$c_and_d are mutually exclusive."
|
|
|
-fi
|
|
|
-
|
|
|
-
|
|
|
# Get the basename and directory of the input file.
|
|
|
basename=`basename $iname`
|
|
|
dirname=`dirname $iname`
|
|
|
|
|
|
+parser=`basename $sgmls`
|
|
|
+
|
|
|
|
|
|
# Look for an extension on the input file, if it's .sgm (or .sdl for
|
|
|
# -c and -d), use it as is, else add the proper extension.
|
|
@@ -372,12 +367,14 @@ if (( $verbose )); then
|
|
|
if [[ $mapfiles != "" ]] then
|
|
|
echo " $mapfiles \\\\"
|
|
|
fi
|
|
|
+ echo " -L $x_locale \\\\"
|
|
|
echo " -c docbook.cmap \\\\"
|
|
|
echo " -t docbook.ts \\\\"
|
|
|
echo " $basename.$$.esis"
|
|
|
${instant} -o $basename.out.$$.sdl \
|
|
|
$mapfiles \
|
|
|
- -c docbook.cmap \
|
|
|
+ -L $x_locale \
|
|
|
+ -c docbook.cmap \
|
|
|
-t docbook.ts \
|
|
|
$basename.$$.esis
|
|
|
status=$?
|
|
@@ -397,6 +394,7 @@ if (( $verbose )); then
|
|
|
else
|
|
|
${instant} -o $basename.out.$$.sdl \
|
|
|
$mapfiles \
|
|
|
+ -L $x_locale \
|
|
|
-c docbook.cmap \
|
|
|
-t docbook.ts \
|
|
|
$basename.$$.esis 2> $basename.$$.log
|