Skip to content
Snippets Groups Projects
docbook-wrapper 630 B
Newer Older
if test "$#" != 4
then
  echo "Wrong number of arguments." >&2
  exit 1
fi

cmd="${1}"
input="${2}"
cmdoutputfile="${3}"
output="${4}"
# docbook2man inserts a date formatted using the current locale into its
# output. Using the "C" locale makes sure it's always in the default format.
export LC_ALL=C

tmpdir=`mktemp -d`
trap "rm -rf ${tmpdir}" EXIT

if ! ( cd `dirname ${input}` &&
       ${cmd} -o ${tmpdir} `basename "${input}"` >/dev/null; )
then
  echo "Building ${output} failed." >&2
  exit 1
mv "${tmpdir}/${cmdoutputfile}" "${output}"

# Needed for make to recognize output file
touch "${output}"