#include "variables"
#! /bin/bash -e
#
# bug reporting script for <:=${PACKAGE}:>
#
<:=@COPYRIGHT:>//

set -o posix

cat >&3 <<EOF
========================================================================
Content of '<:=${lisp}:>'
------------------------------------------------------------------------
EOF
find 2>/dev/null <:=${lisp}:> -type f -print0 \
    | xargs --null --no-run-if-empty md5sum | sort --key=2,2 >&3
cat >&3 <<EOF
------------------------------------------------------------------------
EOF

<:# Default flavors: only GNU/Emacsen, XEmacs comes with its own Mailcrypt.:>//
FLAVORS=${*:-"emacs21 emacs22 emacs23 emacs-snapshot"}

for FLAVOR in ${FLAVORS}; do
    if [ -x /usr/bin/${FLAVOR} ]; then
	cat >&3 <<EOF
Content of '<:=if($_=${lisp})=~s|emacs|\${FLAVOR}|:>'
------------------------------------------------------------------------
EOF
	command ls >&3 --almost-all --sort=version --format=long \
	    <:=if($_=${lisp})=~s|emacs|\${FLAVOR}|:>
	LOG=$(ls <:=if($_=${lisp})=~s|emacs|\${FLAVOR}|:>/<:=${ELCLOG}:>*)
	cat >&3 <<EOF
------------------------------------------------------------------------
Content of '${LOG}':
------------------------------------------------------------------------
EOF
	case ${LOG} in
	    (*.gz) zcat >&3 ${LOG} ;;
	    (*) cat >&3 ${LOG} ;;
	esac
	cat >&3 <<EOF
========================================================================
EOF
    fi
done

<:
# arch-tag: dd9ae462-97f1-4931-b52a-141c3215354b
#
# local variables:
# mode: shell-script
# coding: utf-8
# ispell-local-dictionary: "american"
# ispell-check-comments: exclusive
# end:
#
# LocalWords:  Emacsen Mailcrypt
:>//
