Initial revision
[chise/xemacs-chise.git.1] / lib-src / tmdecode
1 #!/bin/sh -
2 #
3 # $Id: tmdecode,v 1.4 1997/01/30 02:22:30 steve Exp $
4 #
5 # Copyright 1994, 1995, 1996 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs; see the file COPYING.  If not, write to the
19 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 # Boston, MA 02111-1307, USA.
21
22 PATH=${PATH:-/usr/bin:/bin}:`dirname $0 2>/dev/null`; export PATH
23
24 trap 'rm -f $2' 0 1 2 3 13 15
25
26 case "$3" in
27 /dev/stdout)
28         OUTPUT=
29         ;;
30 *)
31         OUTPUT='> $3'
32         ;;
33 esac
34
35 case "$1" in
36 ""|"7bit"|"8bit"|"binary")
37         eval "cat $2 $OUTPUT"
38         ;;
39 "base64")
40         #eval "decode-b < $2 $OUTPUT"
41         eval "mmencode -u $2 $OUTPUT"
42         ;;
43 "quoted-printable")
44         eval "mmencode -q -u $2 $OUTPUT"
45         ;;
46 "x-uue"|"x-uuencode")
47         (cd $TM_TMP_DIR ; uudecode $2)
48         ;;
49 "x-gzip64")
50         #eval "decode-b < $2 | gzip -cd $OUTPUT"
51         eval "mmencode -u $2 | gzip -cd $OUTPUT"
52         ;;
53 *)
54         echo "unknown encoding"
55         exit -1
56         ;;
57 esac
58
59 # echo "$2 was removed."