:
: cdcat - CD cat
:
# Usage: cdcat <index_file> <cd_device> <file>
#
# Written by Rich Morin, CFCL, June 1992

if [ $# -ne 3 ]; then
  echo "Usage: cdcat <index_file> <cd_device> <file>"
  exit 1
fi

if [ ! -f $1 ]; then
  echo "cdcat: no index file found"
  exit 1
fi

awk '
  $1 == "'"$3"'" {
    addr = $2
    size = $3
  }

  END {
    if (addr != "") {
      print "catsub '"$2"'", addr, size
    }
    else {
      print "echo cdcat: file not found in index"
    }
  }
' $1 | sh
