summaryrefslogtreecommitdiffstats
path: root/app-text/a2ps/files/cyr2ps
diff options
context:
space:
mode:
Diffstat (limited to 'app-text/a2ps/files/cyr2ps')
-rwxr-xr-xapp-text/a2ps/files/cyr2ps49
1 files changed, 49 insertions, 0 deletions
diff --git a/app-text/a2ps/files/cyr2ps b/app-text/a2ps/files/cyr2ps
new file mode 100755
index 0000000..a602228
--- /dev/null
+++ b/app-text/a2ps/files/cyr2ps
@@ -0,0 +1,49 @@
+#! /bin/bash
+
+enc=UTF-8
+case $1 in
+koi|KOI|Koi|koi8|Koi8|KOI8|koi-8|Koi-8|KOI-8|koi-8r|Koi-8r|KOI-8R|koi8r|Koi8r|KOI8R|k|K|Koi8-r|koi8-r|KOI8-R)
+ enc=""
+ shift
+ ;;
+alt|Alt|ALT|dos|Dos|DOS|cp866|Cp866|CP866|A|a)
+ enc=CP866
+ shift
+ ;;
+win|Win|WIN|cp1251|Cp1251|CP1251|W|w)
+ enc=CP1251
+ shift
+ ;;
+UTF-8|utf-8|Utf-8|UTF8|utf8|Utf-8|Unicode|UNICODE|unicode|U|u)
+ enc=UTF-8
+ shift
+ ;;
+esac
+
+
+in=$BASH_ARGV
+if [ "$in" == "-" -o -f "$in" ]; then
+ arglen=$(($#-1))
+ args=${@:1:$arglen}
+else
+ args=$@
+ in="-"
+fi
+
+out=""
+
+if [[ " ${args[*]} " != *" -o "* ]]; then
+ if [ $in == "-" ]; then
+ out="-o -"
+ else
+ out="-o `basename $in`.ps"
+ fi
+fi
+
+
+echo "Encoding: $enc, In: $in, Out: $out, extra args: ${args[*]}"
+if [ -n "$enc" ]; then
+ cat $in | iconv -f UTF-8 -t KOI8-R -c | a2ps $out $args -
+else
+ a2ps $out $args $in
+fi