blob: b6f52aa7e41b6dbc84f149536ed2fcc79c2fcfba (
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
|
#! /bin/sh
# @(#) $Id: b-recode,v 1.5 2003/12/22 15:32:37 yeti Exp $
# recode braindead wrapper.
# To be called by enca, don't use directly. See enca(1) for calling convention.
#
# Copyright (C) 2000-2001 David Necas (Yeti) <yeti@physics.muni.cz>.
# This is free software; it can be copied and/or modified under the terms of
# version 2 of GNU General Public License, see COPYING for details. There is
# NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
transform_enc_name() {
echo "$1" | sed -e 's:/.*::'
}
if test "x$3" = "x"; then
echo "$0 has to be called by enca" 1>&2
exit 1
fi
umask 077
inenc=`transform_enc_name "$1"`
outenc="$2"
if test "$4" = "-"; then
recode -f "$inenc..$outenc" <"$3" \
|| { echo "$0: recode -f $inenc..$outenc failed" 1>&2
exit 1; }
else
recode -f "$inenc..$outenc" -- "$3" \
|| { echo "$0: recode -f $inenc..$outenc $3 failed, file $3 may be damaged" 1>&2
exit 1; }
fi
|