Blob Blame History Raw
#!/bin/sh +x

# Note:  When run via "make check", test output files are automatically deleted.
#	 When run from the command line, output files are left in directory
#	 block.on.subnets.YYYYMMDD.  This is useful when something is different.

NODB=1 . ${srcdir=.}/t.frame

map_rc()
{
    (
	set +e
	eval "$@"
	a=$?
	[ $a -eq 0 ] && exit 0
	[ $a -eq 1 ] && exit 0
	[ $a -eq 2 ] && exit 0
	exit $a
    )
}

MSG="$TMPDIR/block.on.subnets.msg"
REF="$TMPDIR/block.on.subnets.ref"
OUT="$TMPDIR/block.on.subnets.out"

cat >> "$MSG" <<EOF
test: 192.168.1.2

body 172.12.13.14
EOF

cat >> "$REF" <<EOF
head:test
url:192.168.1.2
url:192.168.1
url:192.168
url:192
body
172.12.13.14
172.12.13
172.12
172
EOF

$BOGOLEXER -C -p --block-on-subnets=yes -I "$MSG" > "$OUT"

if  [ $verbose -eq 0 ]; then
    cmp "$REF" "$OUT" \
    ||  diff $DIFF_BRIEF "$REF" "$OUT"
else
    diff $DIFF_BRIEF "$REF" "$OUT"
fi