#!/bin/sh
#
# $Header: /home/kbackup/CVSROOT/KBackup/src/read_data_src,v 1.12 1997/09/19 19:49:25 kbackup Exp $
#
# This file is Copyright (C) 1995-1997 by Karsten Ballder (Ballueder@usa.net)
#
# It is part of the KBackup package, see the file COPYING for details.
# KBackup and all files included in this package are licensed and protected
# under the terms and conditions of the GNU General Public License Version 2.
#
#	If you want to contact the current maintainer of this software, please
#	send e-mail to: KBackup@usa.net
#
#	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
	
}
