summaryrefslogtreecommitdiffstats
path: root/dbus/make-dbus-glib-error-enum.sh
blob: 55362ded576087eaa7b9469eb70a55bd2ade64f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

SRC=$1
DEST=$2

die()
{
    echo $1 1>&2
    /bin/rm $DEST.tmp
    exit 1
}

cat $SRC | grep '#define DBUS_ERROR' | sed -e 's/#define //g' | \
  sed -e 's/".*//g' | sed -e 's/DBUS_ERROR/DBUS_GERROR/g' | sed -e 's/ *$/,/g' > $DEST.tmp

if ! test -s $DEST.tmp ; then
    die "$DEST.tmp is empty, something went wrong, see any preceding error message"
fi
echo "DBUS_GERROR_REMOTE_EXCEPTION" >> $DEST.tmp

echo "#ifndef DBUS_INSIDE_DBUS_GLIB_H" >> $DEST.tmp
echo '#error "' "$DEST" 'may only be included by dbus-glib.h"' >> $DEST.tmp
echo "#endif" >> $DEST.tmp

mv $DEST.tmp $DEST || die "could not move $DEST.tmp to $DEST"