File: 01-dictl-konwert.patch

package info (click to toggle)
dictd 1.13.1%2Bdfsg-1.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,940 kB
  • sloc: ansic: 12,523; sh: 4,437; yacc: 512; makefile: 442; cpp: 277; lex: 256; perl: 175; awk: 12
file content (36 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download | duplicates (6)
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
From: Jakub Wilk <ubanus@users.sf.net>
Date: Mon, 30 Jul 2007 12:09:42 +0200
Subject: 01 dictl konwert

Patch for #401666: dictl: doesn't work with DICTL_USE_KONWERT
---
 dictl.in | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/dictl.in b/dictl.in
index 913c7ef..3c18e15 100755
--- a/dictl.in
+++ b/dictl.in
@@ -28,7 +28,21 @@ internal_recode (){
 }
 
 internal_konwert (){
-    konwert $1-$2
+	sedexpr='
+		/(CP)?(437|8(5[0257]|6[0-69]|74))/	{ s//cp\2/; q }
+		/8859_([1-9])/				{ s//iso\1/; q }
+		/ANSI_X3.4(-19(68|86))?/		{ s//ascii/; q }
+		/(US-)?ASCII/				{ s//ascii/; q }
+		/(CP|WINDOWS-)(125[0-8])/		{ s//cp\1/; q }
+		/ISO([-_]?8859-|8859)([1-9]|1[01345])/	{ s//iso\2/; q }
+		/KOI8-?R/				{ s//koi8r/; q }
+		/KOI8-?U/				{ s//koi8u/; q }
+		/UTF-?8/				{ s//utf8/; q }
+		/VISCII/				{ s//viscii/; q }
+		/.*/					{ s///; q }'
+	from=`echo "$1" | tr a-z A-Z | sed -r -e "$sedexpr"`
+	to=`echo "$2" | tr a-z A-Z | sed -r -e "$sedexpr"`
+	konwert "$from-$to"
 }
 
 # for backward compatibility