Cover V02, I05
Article
Listing 1
Listing 2
Listing 3

sep93.tar


Listing 3: clist

#!/bin/sh
#
# clist
#
# List files contained on a backup tape created by cbackup.
#
# usage:
#       clist tape_device
#
# where:
#       tape_device     name of tape drive, prepended by
#                       hostname and a colon if on a
#                       remote host (e.g., /dev/rst0 or
#                       batman:/dev/rst0)

if [ $# -ne 1 ]; then
echo "usage: $0 tape-device"
exit
fi

#
# find tape device name and hostname if backup
# tape is mounted on a remote host
#
TAPE=`echo $1 | awk -F: '{print $2}'`
if [ "$TAPE" = "" ]; then
TAPE=$1
HOST=""
else
HOST=`echo $1 | awk -F: '{print $1}'`
fi

if [ "$HOST" = "" ]; then       # local tape
cpio -itvB <<$TAPE
else                            # remote tape
rsh $HOST dd if=$TAPE ibs=5120 | cpio -itv
fi