pidgin/pidgin
Clone
Summary
Browse
Changes
Graph
propagate from branch 'im.pidgin.soc.2012.gg' (head 8f578bc9129bf06154dfba5c4dd6b867eda790f4)
2012-05-25, Tomasz Wasilczyk
f7a4bc500915
file is
Executable
propagate from branch 'im.pidgin.soc.2012.gg' (head 8f578bc9129bf06154dfba5c4dd6b867eda790f4)
to branch 'im.pidgin.pidgin' (head de7298a1dbe8923a1d2d1435e3f613f02fa0eed8)
#!/bin/sh
if
[
$#
-eq
0
]
;
then
echo
"Usage: `basename "
$0
"` PurpleFoo..."
echo
echo
"This script searches the *current working directory* and replaces casts"
echo
"with GObject-style type checking and casting macros."
echo
'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".'
exit
0
fi
for
struct
in
$*
;
do
cast
=
`
echo
$struct
|
sed
"s|[A-Z]|_\0|g"
|
tr
"a-z"
"A-Z"
|
sed
"s|^_||"
`
for
file
in
`
grep
-rl
"([[:space:]]*
$struct
[[:space:]]*\*[[:space:]]*)"
.
--include
=
*.c
--exclude
=
purple-client-bindings.c
`
;
do
sed
-i
"s|([[:space:]]*
$struct
[[:space:]]*\*[[:space:]]*)[[:space:]]*(|
$cast
(|g"
$file
sed
-i
"s|([[:space:]]*
$struct
[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|
$cast
(\1)|g"
$file
done
done