#! /bin/sh
###############################################################################
#
# File:         sendmail-remote
# RCS:          uudecode-filter,v 1.1 1998/10/21 21:29:32 tom Exp
# Description:  A shell script to uudecode in filter-mode, from stdin to stdout
# Author:       Tom Hageman
# Created:      Tue Oct 20 00:15:32 1998
# Modified:     
# Language:     Bourne
# Package:      mailapp-utilities
# Status:       Experimental
#
# (C) Copyright 1998, but otherwise this file is perfect freeware.
#
# BUGS:         Decodes via a temporary file in current directory,
#               so probably not bulletproof enough for general use,
#               but good enough to serve as /NextApps/Mail.app/decode
#               replacement for MacOSX...
#
###############################################################################

CAT=/bin/cat
UUDECODE=/usr/bin/uudecode
RM=/bin/rm

while read begin mode file
do
   case "$begin $mode" in
   begin\ [0-7][0-7][0-7])
      file="$file$$"
      { echo $begin $mode "$file"; $CAT; } | $UUDECODE && $CAT "$file"
      status=$?
      $RM -f "$file"
      exit $status
   esac
done
exit 1
