#! /bin/sh

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

tmpfiles="$tmpfiles xg-test4.in.c"
cat <<EOF > xg-test4.in.c
#line 42 "bozo"
main(){printf(gettext("Hello, World!\n"));}
# 6 "clown"
gettext("nothing");
EOF

tmpfiles="$tmpfiles xg-test4.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --add-location xg-test4.in.c -d xg-test4
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-test4.ok"
cat <<EOF > xg-test4.ok
#: bozo:42
msgid "Hello, World!\n"
msgstr ""

#: clown:6
msgid "nothing"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-test4.ok xg-test4.po
result=$?

rm -fr $tmpfiles

exit $result
