#!/bin/bash
# Copyright (C) 2004 Networks Associates Technology Inc.  All rights reserved.

if [ -f $NETAWSS/.profile.vars ]; then
    . $NETAWSS/.profile.vars
else
    . /var/NAIENV/.profile.vars
fi

shopt -s extglob
shopt -s nullglob
umask 022

Transform="${WSMGMT}/merge-badwords.xsl"
RulesXml=$XMLCONFDIR/rules.xml
RulesNew=$RulesXml.new.$$

for Template in $NETAWSS/proto/badwords/$NAI_LANG/*.xml; do
    xsltproc --xinclude --stringparam BadwordsTemplate ${Template} \
	    $Transform $RulesXml > $RulesNew &&
	[[ -s $RulesNew ]] &&
	mv $RulesNew $RulesXml
done
rm -f $RulesNew

exit 0
