#!/bin/sh
while [ "$1" != "-stack" ]; do
        shift
done

filename=`mktemp -t ooocrash.XXXXXXXXXX` || exit 1
echo "Video Driver is probably" `grep -A10 'Section[ \t]*"Device"' /etc/X11/xorg.conf | grep Driver | sed -s 's@.*\"\(.*\)\".*@\1@'` > $filename
echo "DESKTOP_SESSION is set to" $DESKTOP_SESSION >> $filename
echo "libgcj version is" `rpm -q libgcj` >> $filename
echo "OpenOffice.org core rpm version is" `rpm -q openoffice.org-core` >> $filename

if [ -e /usr/bin/c++filt ]; then
        cat $2 | c++filt >> $filename
else
        cat $2 >> $filename
fi

rm $2

echo
echo ---start copy and paste here---
cat $filename
echo ---end copy and paste here---
echo paste the above into your bug report

if [ -e /usr/bin/zenity ]; then
        zenity --width=800 --height=600 --title="OOo has crashed!: Paste this text into your bugreport" --text-info --filename=$filename
fi

rm -f $filename
