#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test C support: extraction of contexts specified in GNOME glib syntax.
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles xg-c-15.c"
cat <<\EOF > xg-c-15.c
/* (glib) The 1-argument Q_ macro is a gettext with context. */
print (Q_ ("Printer|Open"));
print (Q_ ("Menu|Recent File", "Menu|Recent Files"));
EOF
-tmpfiles="$tmpfiles xg-c-15.tmp.po xg-c-15.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location \
--keyword=Q_:1g --keyword=Q_:1g,2g \
- -d xg-c-15.tmp xg-c-15.c
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-LC_ALL=C tr -d '\r' < xg-c-15.tmp.po > xg-c-15.po
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+ -d xg-c-15.tmp xg-c-15.c || exit 1
+LC_ALL=C tr -d '\r' < xg-c-15.tmp.po > xg-c-15.po || exit 1
-tmpfiles="$tmpfiles xg-c-15.ok"
cat <<EOF > xg-c-15.ok
msgctxt "Printer"
msgid "Open"
${DIFF} xg-c-15.ok xg-c-15.po
result=$?
-rm -fr $tmpfiles
-
exit $result