1#! /bin/sh
2
3# Test recode-sr-latin on some input in UTF-8 encoding.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8# Test whether a specific UTF-8 locale is installed.
9: ${LOCALE_FR_UTF8=fr_FR.UTF-8}
10if test $LOCALE_FR_UTF8 != none; then
11  LC_ALL=$LOCALE_FR_UTF8 ./testlocale 2>/dev/null
12  case $? in
13    0) ;;
14    77) LOCALE_FR_UTF8=none;;
15    *) exit 1;;
16  esac
17fi
18if test $LOCALE_FR_UTF8 = none; then
19  if test -f /usr/bin/localedef; then
20    echo "Skipping test: no french UTF-8 locale is installed"
21  else
22    echo "Skipping test: no french UTF-8 locale is supported"
23  fi
24  rm -fr $tmpfiles; exit 77
25fi
26
27tmpfiles="$tmpfiles rec-srl-1.in"
28cat <<\EOF > rec-srl-1.in
29���������������� ������������������ ����
30�������������������������� ����������������
31EOF
32
33tmpfiles="$tmpfiles rec-srl-1.out"
34: ${RECODE=recode}
35LC_ALL=$LOCALE_FR_UTF8 \
36${RECODE}-sr-latin < rec-srl-1.in > rec-srl-1.out \
37  || { rm -fr $tmpfiles; exit 1; }
38
39tmpfiles="$tmpfiles rec-srl-1.ok"
40cat <<\EOF > rec-srl-1.ok
41Ispravni argumenti su
42nejednozna��an argument
43EOF
44
45: ${DIFF=diff}
46${DIFF} rec-srl-1.ok rec-srl-1.out
47result=$?
48
49rm -fr $tmpfiles
50
51exit $result
52