#! /bin/sh
## $Id: bs_mark,v 1.1 2004/02/28 15:24:09 nabeken Exp $

bsfilter=bsfilter
log=$HOME/.bsfilter/log
umask 077

mark_one () {
    $bsfilter -a --pipe --insert-flag --insert-probability < $target > $target.$$ 2>> $log

    if [ $? -eq  0 ]; then
	/usr/bin/touch -r $target $target.$$
	mv $target.$$ $target
    fi
}

while [ "$*" != "" ]; do
    target=$1
    if [ -r $target -a -f $target ]; then
	mark_one
    fi
    shift
done
