#! /bin/sh

# Test recognition of ISO C 99 <inttypes.h> format string directives.

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

tmpfiles="$tmpfiles xg-c-8.c"
cat <<EOF > xg-c-8.c
void foo ()
{
  printf (_("File size is: %" PRId64), size);
  printf (_("File age is %10" PRIdMAX " microseconds"), age);
  printf (_(PRIXFAST16 " errors"), nerrs);
  printf (_(PRIXFAT16 " mistakes"), nerrs);
}
EOF

tmpfiles="$tmpfiles xg-c-8.po"
: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location -k_ -o xg-c-8.po xg-c-8.c
test $? = 0 || { rm -fr $tmpfiles; exit 1; }

tmpfiles="$tmpfiles xg-c-8.ok"
cat <<EOF > xg-c-8.ok
#, c-format
msgid "File size is: %<PRId64>"
msgstr ""

#, c-format
msgid "File age is %10<PRIdMAX> microseconds"
msgstr ""

#, c-format
msgid "<PRIXFAST16> errors"
msgstr ""

#, c-format
msgid " mistakes"
msgstr ""
EOF

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

rm -fr $tmpfiles

exit $result
