1#! /bin/sh 2 3# Test general filter execution with Java .properties syntax. 4 5tmpfiles="" 6trap 'rm -fr $tmpfiles' 1 2 3 15 7 8if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then 9 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. 10 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then 11 ac_n= ac_c=' 12' ac_t=' ' 13 else 14 ac_n=-n ac_c= ac_t= 15 fi 16else 17 ac_n= ac_c='\c' ac_t= 18fi 19 20# Some fold programs (like SunOS4 and FreeBSD) don't have an option to wrap at 21# spaces. 22echo abc | fold -b -s -w 20 >/dev/null 2>&1 || { 23 echo "Skipping test: fold program not POSIX compliant" 24 rm -fr $tmpfiles; exit 77 25} 26 27# Some fold programs (like HP-UX) insert a newline at the end, if the last 28# line was not terminated with a newline and the -s option was given. 29foldoutputcount=`echo $ac_n "abc$ac_c" | fold -b -s -w 20 | wc -c` 30foldoutputcount=`echo "$foldoutputcount" | sed -e 's/[ ]//g'` 31test "$foldoutputcount" = 3 || { 32 echo "Skipping test: fold program inserts extra newline" 33 rm -fr $tmpfiles; exit 77 34} 35 36tmpfiles="$tmpfiles mfi-test3.properties" 37cat <<\EOF > mfi-test3.properties 38# HEADER. 39# 40!=Project-Id-Version\: Bonnie Tyler\n 41 42#: married-men:4 43#, fuzzy 44!The\ world\ is\ full\ of\ married\ men=So viele verheiratete M\u00e4nner 45 46#: married-men:5 47with\ wives\ who\ never\ understand=und ihre Frauen verstehen sie nicht 48 49#: married-men:6 50!They're\ looking\ for\ someone\ to\ share= 51 52# schwer zu \u00fcbersetzen... 53#: married-men:7 54!the\ excitement\ of\ a\ love\ affair= 55 56#: married-men:8 57!Just\ as\ soon\ as\ they\ find\ you= 58 59#: married-men:9 60!They\ warn\ you\ and\ darn\ you= 61EOF 62 63tmpfiles="$tmpfiles mfi-test3.out" 64: ${MSGFILTER=msgfilter} 65LC_ALL=C \ 66${MSGFILTER} --properties-input --properties-output -i mfi-test3.properties -o mfi-test3.out fold -b -s -w 20 67result=$? 68test $result = 0 || { rm -fr $tmpfiles; exit 1; } 69 70tmpfiles="$tmpfiles mfi-test3.ok" 71cat <<\EOF > mfi-test3.ok 72# HEADER. 73# 74!=Project-Id-Version\: \nBonnie Tyler\n 75 76#: married-men:4 77#, fuzzy 78!The\ world\ is\ full\ of\ married\ men=So viele \nverheiratete M\u00e4nner 79 80#: married-men:5 81with\ wives\ who\ never\ understand=und ihre Frauen \nverstehen sie nicht 82 83#: married-men:6 84!They're\ looking\ for\ someone\ to\ share= 85 86# schwer zu \u00fcbersetzen... 87#: married-men:7 88!the\ excitement\ of\ a\ love\ affair= 89 90#: married-men:8 91!Just\ as\ soon\ as\ they\ find\ you= 92 93#: married-men:9 94!They\ warn\ you\ and\ darn\ you= 95EOF 96 97: ${DIFF=diff} 98${DIFF} mfi-test3.ok mfi-test3.out 99result=$? 100 101rm -fr $tmpfiles 102 103exit $result 104