1 #! /bin/sh 2 3 # Test recode-sr-latin on some input in EUC-JP encoding. 4 # (Apart from UTF-8 and GB18030, EUC-JP is the only common encoding that is 5 # a superset of both ISO-8859-5 and ISO-8859-2.) 6 7 tmpfiles="" 8 trap 'rm -fr $tmpfiles' 1 2 3 15 9 10 # Test whether a specific EUC-JP locale is installed. 11 case "$host_os" in 12 aix*) 13 LOCALE_JA_EUCJP=ja_JP ;; 14 hpux* | osf* | netbsd*) 15 LOCALE_JA_EUCJP=ja_JP.eucJP ;; 16 irix* | freebsd* | darwin*) 17 LOCALE_JA_EUCJP=ja_JP.EUC ;; 18 *) 19 LOCALE_JA_EUCJP=ja_JP.EUC-JP ;; 20 esac 21 if test $LOCALE_JA_EUCJP != none; then 22 LC_ALL=$LOCALE_JA_EUCJP ./testlocale 2>/dev/null 23 case $? in 24 0) ;; 25 77) LOCALE_JA_EUCJP=none;; 26 *) exit 1;; 27 esac 28 fi 29 if test $LOCALE_JA_EUCJP = none; then 30 if test -f /usr/bin/localedef; then 31 echo "Skipping test: no japanese EUC-JP locale is installed" 32 else 33 echo "Skipping test: no japanese EUC-JP locale is supported" 34 fi 35 rm -fr $tmpfiles; exit 77 36 fi 37 38 # Test whether locale_charset() in this locale really returns EUC-JP. 39 # (On some systems, config.charset supports only UTF-8 locales.) 40 case "$host_os" in 41 darwin[56]*) ;; 42 darwin* | beos*) 43 echo "Skipping test: no EUC-JP locale is supported" 44 rm -fr $tmpfiles; exit 77 45 ;; 46 esac 47 48 tmpfiles="$tmpfiles rec-srl-2.in" 49 cat <<\EOF > rec-srl-2.in 50 51 52 EOF 53 54 tmpfiles="$tmpfiles rec-srl-2.out" 55 : ${RECODE=recode} 56 LC_ALL=$LOCALE_JA_EUCJP \ 57 ${RECODE}-sr-latin < rec-srl-2.in > rec-srl-2.out \ 58 || { rm -fr $tmpfiles; exit 1; } 59 60 tmpfiles="$tmpfiles rec-srl-2.ok" 61 cat <<\EOF > rec-srl-2.ok 62 Ispravni argumenti su 63 nejednoznaan argument 64 EOF 65 66 : ${DIFF=diff} 67 ${DIFF} rec-srl-2.ok rec-srl-2.out 68 result=$? 69 70 rm -fr $tmpfiles 71 72 exit $result 73