#
# Global gültige Deklarationen.
#

DATABASE=tw.db_$HOSTNAME
DBSIG=tw.db_sig
ARCHIVES=tw.archives
DEFDBNAME='<HARDCODED>'
SEP=${IFS:0:2}

function set_entry
{
  # TRIPWIRE/shield-Schnittstelle
  local top h=$IFS end
  unset -v entry rem
  [ "$2" != 'global' ] && top='/.*'
  declare -i i=0 stat=1 ; IFS=${h:2:1}
  for l in $(grep "^$top#.*$1"); do
    entry[$i]=${l%%[$SEP]*} ; stat=0
    if echo $l | grep -q "$1("; then
      end=${l#*$1(} ; rem[$i]=${end%%)*}
    fi
    i=$((i+1))
  done
  IFS=$h
  return $stat
}

function databases
{
  ( cd $DESTDIR
  for name in $(ls tw.config* | grep 'tw.config\($\|-.*\)'); do
    type=${name#*-}
    echo ${type/tw.config/$DEFDBNAME}
  done )
}

function scat_dummies
{
  local path
  for path in "$@"; do
    echo ' - ASR dummy - ' 2>/dev/null >$path
    if ! [ -e $path ]; then
      rm -f "$@"
      scat_dir=${path%/*}
      return 1
    fi
  done
}

