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