ChangeLog the Proxy-Authorization thing. Refs #2910. Need a proper name
[pidgin-git.git] / fix-casts.sh
blob6556f6935e0b95d5af1dc9506991fda125c7f40a
1 #!/bin/sh
3 if [ $# -eq 0 ]; then
4 echo "Usage: `basename "$0"` PurpleFoo..."
5 echo
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)".'
9 exit 0
12 for struct in $* ; do
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
17 done
18 done