LC_ALL=C
export LC_ALL
rm -rf testmd
set -e
$VALGRIND ./maildirmake.tst testmd
$VALGRIND ./maildirmake.tst -q 3C testmd
ls | $VALGRIND ./deliverquota testmd
echo $? | cut -c1
ls | $VALGRIND ./deliverquota testmd
echo $? | cut -c1
ls | $VALGRIND ./deliverquota testmd
echo $? | cut -c1
ls | $VALGRIND ./deliverquota testmd || echo $? | cut -c1

rm -rf md
./maildirmake.tst md
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw md one Label0 Label1
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw md two Label0 Label1
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw md two Label1 Label2
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw md three Label2 Label3
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw md three Label3
$VALGRIND ./maildirkw -a md three Label4
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw -r md one Label0
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw -r md one Label1
echo ""
$VALGRIND ./maildirkw -L md | sort
$VALGRIND ./maildirkw md one two
ls md/tmp
$VALGRIND ./maildirkw md one three
ls md/tmp
$VALGRIND ./maildirkw -L md | sort
rm -rf md testmd

./maildirmake.tst ./testmd

$VALGRIND ./maildiracl -set testmd INBOX.Folder user1 rw
$VALGRIND ./maildiracl -list testmd INBOX.Folder | sort
$VALGRIND ./maildiracl -list testmd INBOX.Folder.Subfolder | sort
$VALGRIND ./maildirmake.tst -f Folder testmd
$VALGRIND ./maildiracl -list testmd INBOX.Folder | sort
ls testmd/courierimaphieracl
rm -rf testmd

./maildirmake.tst ./testmd
echo "Subject: message 1" >testmd/cur/001:2,S
echo "Subject: message 2" >testmd/cur/002:2,S
echo "Subject: message 3" >testmd/cur/003:2,S
$VALGRIND ./maildirkw testmd 003 gamma alpha beta
$VALGRIND ./maildirkw testmd 002 alpha gamma
$VALGRIND ./maildirkw testmd 001 beta gamma
$VALGRIND ./maildirkw testmd 004 000
MOCKTIME=1000 $VALGRIND ./maildirkwtest2 -L testmd
echo "==="
MOCKTIME=1000 $VALGRIND ./maildirkwtest2 -L testmd
MOCKTIME=2000 $VALGRIND ./maildirkwtest2 -L testmd
MOCKTIME=1000 $VALGRIND ./maildirkwtest2 -L testmd
>testmd/courierimapkeywords/.tmp.4.foo
>testmd/courierimapkeywords/.tmp.1000.baz
touch -t 200001010000 testmd/courierimapkeywords/.tmp.4.foo
$VALGRIND ./maildirkwtest2 -L testmd
ls testmd/courierimapkeywords/.tmp.* 2>&1
rm -f testmd/courierimapkeywords/:list
rm -f testmd/courierimapkeywords/.?.001
rm -f testmd/courierimapkeywords/.?.002
rm -f testmd/courierimapkeywords/.?.003
echo "epsilon" >testmd/courierimapkeywords/.1.002
echo "zeta" >testmd/courierimapkeywords/.2.002
MOCKTIME=1000 $VALGRIND ./maildirkwtest2 -L testmd
ls testmd/courierimapkeywords/.*002
$VALGRIND ./maildirkw -a testmd 001 alpha beta
$VALGRIND ./maildirkw -L testmd
$VALGRIND ./maildirkw -r testmd 001 beta
$VALGRIND ./maildirkw -L testmd
rm -rf testmd

LC_ALL=C
export LC_ALL
$VALGRIND ./maildirkwtest3 | sort

rm -rf testmd
./maildirmake testmd
./maildirmake -f folder testmd
mv testmd/.folder 'testmd/.R&AOk-pertoire'
echo 'INBOX.R&AOk-pertoire' >testmd/courierimapsubscribed

cat >testmd/mailfilter <<EOF
#MFMAILDROP=2
#
# DO NOT EDIT THIS FILE.  This is an automatically generated filter.

FROM='nobody@example.com'
##Op:contains
##Header:Subject
##Value:[courier]
##Folder:.R&AOk-pertoire
##From:
##PlainString
##Name:Cone mailing list


if ((/^Subject:.*\[courier\]/))
{
   to "./Maildir/.R&AOk-pertoire/."
}

to "./Maildir/."
EOF
$VALGRIND ./maildirmake --checkutf8 testmd testmd/mailfilter
$VALGRIND ./maildirmake --convutf8 testmd testmd/mailfilter
echo testmd/.*ire
cat testmd/courierimapsubscribed
cat testmd/mailfilter
rm -rf testmd
