#
# $Header: /home/kbackup/CVSROOT/KBackup/src/read_data_src,v 1.10 1996/09/13 18:41:46 kbackup Exp $
#
# This file is Copyright (C) 1995 by Karsten Ballder
#				Karsten.Ballueder@stud.uni-karlsruhe.de
#
# It is part of the KBackup package, see the file COPYING for details.
#
#
#	function to reliably read data from tape, including double buffering
#	and multi-volume handling [DB+multibol w/ multibuf only]
#	- for Verify() and Restore()
#

ReadData_src_loaded=YES


read_data()
{
	if [ "$1" = "-raw" ]
	then
		shift
		if [ "$1" != "" ]
		then
			rdfile="$1"
		else
			rdfile="$device"
		fi
		multibuf_cmd=`echo cat $rdfile`
	else
		if [ "$1" != "" ]
		then
			rdfile="$1"
		else
			rdfile="$device"
		fi
		if [ "$use_multibuf" = "YES" ]
		then
			set_multibuf_options READ
			multibuf_cmd=`echo $MULTIBUF $multibuf_options -b $multibuf_blksize -n $multibuf_nblocks -r "$rdfile" `	
		else
			multibuf_cmd=`echo cat "$rdfile" `
		fi
	fi
	


	if [ "$remote_mode" = "YES" ]
	then
		su $remote_uid -c "rsh $remote_host \"$multibuf_cmd;sleep 10\""
	else
		`echo $multibuf_cmd`
	fi
	
}
