summaryrefslogtreecommitdiffstats
path: root/statgen/doit
blob: a71a88a7ab20232a44e2f4a3f8bf1229e443d39d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/bash

if [ -z "$1" ]; then
    echo "Usage: doit <file name>"
    exit
fi

# In some CP866 texts used "Yo" and "N" simbols from CP1251 encoding. This fixes it.
dos2unix -U $1

cat $1 | sed -e "s/¸/ñ/g;s/¹/N/g;s/°/ø/g" | iconv -f CP866 -t KOI8-R > $1.koi
#cat $1 | sed -e "s/¸/ñ/g;s/¹/N/g;s/°/ø/g" | iconv -f CP866 -t CP1251 > $1.win
#cat $1 | sed -e "s/¸/ñ/g;s/¹/N/g;s/°/ø/g"  > $1.alt
#cat $1 | sed -e "s/¸/ñ/g;s/¹/ü/g;s/°/ø/g" | iconv -f CP866 -t UTF-8 > $1.utf

export LC_CTYPE="ru_RU.KOI8-R"
./generate $1.koi koi > table.tmp.h  2> header1.tmp
./generate $1.koi win >> table.tmp.h  2> header2.tmp
./generate $1.koi alt >> table.tmp.h  2> header3.tmp

cmp header1.tmp header2.tmp
if [ $? -ne 0 ]; then
    echo "Different number items in win & koi tables. Strange..."
    rm -f table.tmp.h
else
    cmp header1.tmp header3.tmp
    if [ $? -ne 0 ]; then
	echo "Different number items in win & koi tables. Strange..."
	rm -f table.tmp.h
    else
	cat header1.tmp >> table.tmp.h
    fi
fi

rm -f header?.tmp
rm -f $1.koi
#rm -f $1.win
#rm -f $1.alt
#rm -f $1.utf