#! /bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
ac_n= ac_c='
' ac_t=' '
else
ac_n=-n ac_c= ac_t=
fi
else
ac_n= ac_c='\c' ac_t=
fi
echo abc | fold -b -s -w 20 >/dev/null 2>&1 || { rm -fr $tmpfiles; exit 77; }
foldoutputcount=`echo $ac_n "abc$ac_c" | fold -b -s -w 20 | wc -c`
foldoutputcount=`echo "$foldoutputcount" | sed -e 's/[ ]//g'`
test "$foldoutputcount" = 3 || { rm -fr $tmpfiles; exit 77; }
tmpfiles="$tmpfiles mfi-test1.po"
cat <<\EOF > mfi-test1.po
msgid ""
msgstr ""
"Project-Id-Version: Bonnie Tyler\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "The world is full of married men"
msgstr "So viele verheiratete Männer"
msgid "with wives who never understand"
msgstr "und ihre Frauen verstehen sie nicht"
msgid "They're looking for someone to share"
msgstr ""
msgid "the excitement of a love affair"
msgstr ""
msgid "Just as soon as they find you"
msgstr ""
msgid "They warn you and darn you"
msgstr ""
EOF
tmpfiles="$tmpfiles mfi-test1.out mfi-test1.err"
: ${MSGFILTER=msgfilter}
LC_ALL=C \
${MSGFILTER} -i mfi-test1.po -o mfi-test1.out fold -b -s -w 20 >mfi-test1.err 2>&1
result=$?
cat mfi-test1.err | grep -v 'warning: Locale charset' | grep -v '^ '
test $result = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles mfi-test1.ok"
cat <<\EOF > mfi-test1.ok
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Bonnie Tyler\n"
"Content-Type: \n"
"text/plain; \n"
"charset=ISO-8859-1\n"
"Content-Transfer-Enc\n"
"oding: 8bit\n"
msgid "The world is full of married men"
msgstr ""
"So viele \n"
"verheiratete Männer"
msgid "with wives who never understand"
msgstr ""
"und ihre Frauen \n"
"verstehen sie nicht"
msgid "They're looking for someone to share"
msgstr ""
msgid "the excitement of a love affair"
msgstr ""
msgid "Just as soon as they find you"
msgstr ""
msgid "They warn you and darn you"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} mfi-test1.ok mfi-test1.out
result=$?
rm -fr $tmpfiles
exit $result