calendar/libical/scripts/mkinclude.sh
author Justin Wood <bugspam.Callek@gmail.com>
Mon, 01 Dec 2008 18:27:18 +0100
changeset 1280 87c1dc594c9b9a8f4af5f93943fe64cf0ce7d123
parent 372 7c0bfdcda6731e77303f3c47b01736aaa93d5534
permissions -rw-r--r--
bug 465521 - client.py needs a way to update the default repo for m-c, add move_to_stable functionality to switch comm-central pulls to mozilla-1.9.1 branch, r=Standard8,davida,KaiRo

#!/bin/sh

#
# Given a list of headers, combine them into one, excluding certain lines
#
OUTFILE="/dev/stdout"
COMBINEDHEADERS=""
EXCLUDES=""

while [ $# -gt 0 ]
do
  case $1 in
      -o)  OUTFILE=$2; shift;;
      -e)  EXCLUDES="$EXCLUDES $2"; shift;;
      *)   COMBINEDHEADERS="$COMBINEDHEADERS $1";
  esac
  shift
done

echo '#ifdef __cplusplus'         > $OUTFILE
echo 'extern "C" {'               >> $OUTFILE
echo '#endif'                     >> $OUTFILE
echo '/*'                         >> $OUTFILE
echo " \$Id\$"                    >> $OUTFILE
echo '*/'                         >> $OUTFILE
cat $COMBINEDHEADERS              >> file.temp1
for exclude in $EXCLUDES
do
  cp file.temp1 file.temp2
  egrep -v "$exclude" file.temp2    > file.temp1
done
cat file.temp1 >> $OUTFILE
rm -f file.temp1
rm -f file.temp2
echo '#ifdef __cplusplus'         >> $OUTFILE
echo '};'                         >> $OUTFILE
echo '#endif'                     >> $OUTFILE