4
echo "Usage: `basename "$0"` PurpleFoo..."
6
echo "This script searches the *current working directory* and replaces casts"
7
echo "with GObject-style type checking and casting macros."
8
echo 'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".'
13
cast=`echo $struct | sed "s|[A-Z]|_\0|g" | tr "a-z" "A-Z" | sed "s|^_||"`
14
for file in `grep -rl "([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)" . --include=*.c --exclude=purple-client-bindings.c` ; do
15
sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*(|$cast(|g" $file
16
sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|$cast(\1)|g" $file