t.bogodir
来自「一个C语言写的快速贝叶斯垃圾邮件过滤工具」· BOGODIR 代码 · 共 84 行
BOGODIR
84 行
#! /bin/sh# Note: When run via "make check", test output files are automatically deleted.# When run from the command line, output files are left in directory# bogodir.YYYYMMDD. This is useful when something is different.. ${srcdir=.}/t.frameHOME="${TMPDIR}/home"mkdir $HOMEexport HOMELOG="${TMPDIR}/bogodir.log"cat /dev/null > $LOGmap_rc(){ ( set +e echo >> $LOG "$@" echo >> $LOG "### expect: $expect" result=`eval "$@" 2>&1 | tee -a $LOG | grep open | head -1` ok=`echo "$result" | grep "$expect"` if [ -n "$ok" ] ; then echo >> $LOG "### ok: $ok" echo >> $LOG "PASS" else echo >> $LOG "### got '$result'" echo >> $LOG "FAIL" fi echo >> $LOG "" [ -z "$ok" ] && rc=1 [ -n "$ok" ] && rc=0 exit $rc )}#standard test (bogodir.log=3225)OPTS=" -x d -vv -D"#a bit more info (bogodir.log=5071)#OPTS=" -x dcw -vvv -D"#everything (bogodir.log=5416)#OPTS=" -x cdfghlmrstw -vvvv -D"# just $HOME should display /home/useridunset BOGOFILTER_DIRexpect="$HOME/.bogofilter"map_rc $BOGOFILTER $OPTS -C < /dev/nullcat <<EOF > ${TMPDIR}/bogodir.cfbogofilter_dir=${TMPDIR}/bogoconf.dEOF# config file should display "command"expect="${TMPDIR}/bogoconf.d"map_rc $BOGOFILTER $OPTS -c ${TMPDIR}/bogodir.cf < /dev/null# command line and config file should display "command.d"expect="${TMPDIR}/command.d"map_rc $BOGOFILTER $OPTS -c ${TMPDIR}/bogodir.cf -d ${TMPDIR}/command.d < /dev/null# $HOME and $BOGOFILTER_DIR should display $TMPDIRexpect="$BOGOFILTER_DIR"map_rc $BOGOFILTER $OPTS -C < /dev/nullmap_rc $BOGOFILTER $OPTS -c ${TMPDIR}/bogodir.cf < /dev/null# command line should display "command.d"expect="${TMPDIR}/command.d"map_rc $BOGOFILTER $OPTS -C -d ${TMPDIR}/command.d < /dev/nullmap_rc $BOGOFILTER $OPTS -c ${TMPDIR}/bogodir.cf -d ${TMPDIR}/command.d < /dev/null# test whether command line supercedes bogus config file entrycat <<EOF > ${TMPDIR}/bogodir.cfbogofilter_dir=${TMPDIR}/boguswordlist r,word,wordlist.${DB_EXT},1EOFmap_rc $BOGOFILTER $OPTS -c ${TMPDIR}/bogodir.cf -d ${TMPDIR}/command.d -v < /dev/nulltest ! -d ${TMPDIR}/bogus
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?