#!/bin/sh
# "cdadd" copyright 1994 thomas insel
#         copyright 1996 sven oliver moll
usage()
{
  echo >&2 Usage: `basename $0` [-[0-7]]
  echo >&2 This program is part of cdtool. See \"man cdtool\" for more info.
  exit 1
}

case $# in
  [01]) ;;
  *) usage;;
esac

case x$1 in
  x-[0-7]) DRIVE=$1;;
  x) ;;
  *) usage;;
esac

/usr/local/bin/cdir $DRIVE -t > /tmp/cdadd-$$

if [ -z $EDITOR ]; then
  EDITOR=vi
fi
$EDITOR /tmp/cdadd-$$
cat /tmp/cdadd-$$ >>~/.cdtooldb
rm /tmp/cdadd-$$
