format-gcc-internal-1 [plain text]
#! /bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles f-gi-1.data"
cat <<\EOF > f-gi-1.data
"abc%%"
"abc%c"
"abc%s"
"abc%i"
"abc%d"
"abc%o"
"abc%u"
"abc%x"
"abc%.*s"
"abc%H"
"abc%D"
"abc%F"
"abc%T"
"abc%A"
"abc%C"
"abc%E"
"abc%L"
"abc%O"
"abc%P"
"abc%Q"
"abc%V"
"abc%+#Ag"
"abc%li"
"abc%"
"abc%y"
"abc%.*c"
"abc%.*.*s"
"abc%d%u%u"
"abc%1$d"
EOF
: ${XGETTEXT=xgettext}
n=0
while read comment; do
read string
n=`expr $n + 1`
tmpfiles="$tmpfiles f-gi-1-$n.in f-gi-1-$n.po"
cat <<EOF > f-gi-1-$n.in
gettext(${string});
EOF
${XGETTEXT} -L GCC-source -o f-gi-1-$n.po f-gi-1-$n.in || exit 1
test -f f-gi-1-$n.po || exit 1
fail=
if echo "$comment" | grep 'Valid:' > /dev/null; then
if grep gcc-internal-format f-gi-1-$n.po > /dev/null; then
:
else
fail=yes
fi
else
if grep gcc-internal-format f-gi-1-$n.po > /dev/null; then
fail=yes
else
:
fi
fi
if test -n "$fail"; then
echo "Format string recognition error:" 1>&2
cat f-gi-1-$n.in 1>&2
echo "Got:" 1>&2
cat f-gi-1-$n.po 1>&2
exit 1
fi
rm -f f-gi-1-$n.in f-gi-1-$n.po
done < f-gi-1.data
rm -fr $tmpfiles
exit 0