1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-30 05:40:06 +00:00
freebsd-ports/security/vuxml/files/validate.sh
Hiroki Sato c65c583e56 - Fix "make validate" problem when textproc/xhtml-basic is
installed by adding an SGML declaration and DTDDECL.
- Remove the --catalogs option for xmllint(1) in validate.sh.

Approved by:	nectar (maintainer)
PR:		ports/63035
2004-08-25 15:36:09 +00:00

55 lines
1.1 KiB
Bash

#! /bin/sh
vuxml_file="$1"
if [ -z "${vuxml_file}" ]; then
exec >&2
echo "Usage: validate.sh /path/to/vuxml/document"
exit 1
fi
xml_catalog="${LOCALBASE:-/usr/local}/share/xml/catalog.ports"
sgml_catalog="${LOCALBASE:-/usr/local}/share/sgml/catalog.ports"
SGML_CATALOG_FILES="${sgml_catalog}"; export SGML_CATALOG_FILES
XML_CATALOG_FILES="${xml_catalog}"; export XML_CATALOG_FILES
SP_CHARSET_FIXED="YES"; export SP_CHARSET_FIXED
SP_ENCODING="XML"; export SP_ENCODING
X=`/usr/bin/which xmllint onsgmls`
if [ -z "$X" ]; then
exec >&2
echo "Could not find \`xmllint' nor \`onsgmls'."
echo "Install ports/textproc/libxml2 for \`xmllint', or"
echo "ports/textproc/opensp for \`onsgmls'."
exit 1
fi
validate() {
echo ">>> Validating..."
echo "$@"
if $@; then
echo ">>> Successful."
return 0
else
echo ">>> FAILED."
return 1
fi
}
for x in ${X}; do
case ${x} in
*xmllint)
validate ${x} --valid --noout "${vuxml_file}"
exit $?
;;
*onsgmls)
validate ${x} -wxml -s "${vuxml_file}"
exit $?
;;
*)
echo "Oops, I don't know how to use \`${x}'."
exit 1
;;
esac
done