ACC SHELL

Path : /usr/bin/
File Upload :
Current File : //usr/bin/patch-metamail

#!/bin/sh
# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
# 
# Permission to use, copy, modify, and distribute this material 
# for any purpose and without fee is hereby granted, provided 
# that the above copyright notice and this permission notice 
# appear in all copies, and that the name of Bellcore not be 
# used in advertising or publicity pertaining to this 
# material without the specific, prior written permission 
# of an authorized representative of Bellcore.  BELLCORE 
# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.

# Conversion from C shell to Bourne shell
# by Bob Glickstein, Z-Code Software Corp.
# Conversion Copyright (c) 1992 Z-Code Software Corp. (Z-Code)
# 
# Permission to use, copy, modify, and distribute this material for
# any purpose and without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all
# copies, and that the name of Z-Code not be used in advertising or
# publicity pertaining to this material without the specific, prior
# written permission of an authorized representative of Z-Code.
# Z-CODE MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF
# THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", WITHOUT ANY
# EXPRESS OR IMPLIED WARRANTIES.

HOSTNAME=thumper.bellcore.com
DIRNAME=pub/nsb
PREFIX=mm.patch.

if test -z "$2" -o ! -z "$6"
then
	echo "Usage: patch-metamail source-tree-root patch-number [hostname [dirname [prefix]]]"
	exit 1
fi

TREEROOT=$1
PATCHNUMBER=$2

if test ! -z "$3"
then
	HOSTNAME=$3
fi

if test ! -z "$4"
then
	DIRNAME=$4
fi

if test ! -z "$5"
then
	PREFIX=$5
fi
	
echo WARNING:  This program, if allowed to do so, will attempt to 
echo install a PATCH file for your metamail sources which are rooted 
echo in the directory $TREEROOT.
echo ""
echo It will use a patch file that it retrieves via anonymous ftp
echo from the host $HOSTNAME, in the directory $DIRNAME, 
echo with filenames starting with $PREFIX.
echo ""
echo -n "Do you want to install the patch in directory $TREEROOT (y/n)? [n] "
read ans

case "$ans" in
	[Yy]*) cd $TREEROOT
	       ident=`whoami`@`hostname -f`
	       echo Using anonymous ftp with password $ident
	       if [ -n "`type -p mktemp`" ] ; then
		   TmpFtp=`mktemp ${METAMAIL_TMPDIR-/tmp}/mm.ftp.$$.XXXXXX` || exit 1
	       else
		   TmpFtp=${METAMAIL_TMPDIR-/tmp}/mm.ftp.$$
	       fi
	       set -f
	       cat > $TmpFtp <<!
open $HOSTNAME
user anonymous $ident
cd $DIRNAME
binary
get ${PREFIX}${PATCHNUMBER}
quit
!
	       set +f
	       ftp -n < $TmpFtp
	       rm -f $TmpFtp
	       patch -p < ${PREFIX}${PATCHNUMBER} ;;
	*) echo Patch not installed
esac

ACC SHELL 2018