+HEADER_ONLY="-H"
+
+while [[ $1 ]]; do
+
+ case $1 in
+
+ "--help"|"-h")
+ usage
+ exit 0
+ ;;
+
+ "--body")
+ HEADER_ONLY=""
+ ;;
+
+ "--keepspam")
+ KEEP_SPAM=1
+ ;;
+
+ "--from")
+ RE_PREFIX="^From:.*"
+ ;;
+
+ "--to")
+ RE_PREFIX="^To:.*"
+ ;;
+
+ "--fromto")
+ RE_PREFIX="^(From|To):.*"
+ ;;
+
+ "--subject")
+ RE_PREFIX="^Subject:.*"
+ ;;
+
+ *)
+ if [[ ${PATTERN} ]]; then
+ # If we already have the pattern to match in the
+ # message, get the new argument as a pattern for the
+ # filename
+ if [[ ${FILE_PATTERN} ]]; then
+ usage
+ exit 1
+ else
+ FILE_PATTERN="${MAIL_ARCHIVE_DIR}/${1}/*/*"
+ SIZE_FILE_PATTERN="${MAIL_ARCHIVE_DIR}/${1}"
+ fi
+ else
+ PATTERN=$1
+ fi
+ ;;
+ esac