view fix-casts.sh @ 27372:7fd1b4c73310

Connection error message changes for gg, and a few other strings changes. * Short connection error messages (phrases and short sentences) should not end in a period. This is kind of arbitrary, but I did comparisons both ways and I thought short messages looked a lot better without the period. Less cluttered, more approachable. * Connection error messages should not have trailing newlines--the UI should add a newline if it wants. * Change "token" to "captcha" in the input box prompts when creating a new account. Captcha is an increasingly common term for this. Not all users will know what it means, but "token" is not a whole lot better. And users should be able to figure out what to do using context clues, regardless of the term used. I believe we use the same term in QQ. * Put the output of g_strerror(errno) in the message when possible
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jul 2009 05:27:08 +0000
parents c3ca613ab550
children
line wrap: on
line source

#!/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