#!/bin/sh
if [ -z "$1" -o "$1" = "--help"  -o "$1" = "-h" ]; then
    PROGRAM=`basename $0`
    fmt <<EOF
Usage: $PROGRAM CATEGORY [IFILEOPTIONS].

Standard-in should be an email (see RFC822).  The email is
MIME-decoded and inserted into ifile's database (~/.idata) under
CATEGORY.  If present, IFILEOPTIONS are passed on to ifile.  
EOF
    exit 1 
fi

CATEGORY="$1"
shift 1
mail-preprocess | \
ifile -w -i "$CATEGORY" $@ 
