# Copyright (C) 2012 The Meme Factory, Inc. http://www.meme.com/ # Copyright (C) 2010, 2011, Karl O. Pinc # # This file is part of Gombe-MI. # # Gombe-MI is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Gombe-MI. If not, see . # # Wrapper around xmllint to deliver an exit code on entity error. # # Karl O. Pinc # # Bugs: # This is a kludge to deal with oddity in xmllint. # # Normally xmllint does not exit with an error when --postvalid is used # and an entity does not exist, but it does send text to stderr. # Go figure. tfile=/tmp/xmllint-wrapper.$$ # (It's _so_ wrong to put this path here.) #xmllint --postvalid --noout --xinclude --nonet --noent -relaxng /usr/share/xml/docbook/schema/rng/5.0/docbook.rng "$@" 2> $tfile xmllint --postvalid --noout --xinclude --nonet --noent "$@" 2> $tfile status=$(echo $?) [ -s $tfile ] \ && cat $tfile >&2 \ && rm -f $tfile \ && [ $status = "0" ] \ && exit 1 rm -f $tfile exit $status