#! /bin/sh
# Carlos Duarte <cgd@teleweb.pt>, 990820

USAGE='
	eval cat<<EOF
usage: $0 -d dest [SOURCES]

  -h help
  -n do nothing
  -l list stuff to export
  -d dest,  dest maybe
		 a:         floppy drive A
		 b:         floppy drive B
		 /path 
		 host:/path disk places
EOF
	exit 1
'

while : ; do
	case x"$1" in 
	x-h)	eval "$USAGE" ;;
	x-n)	N=dont ;;
	x-l)	D=. ;;
	x-d)	D="$2"; shift ;;
	x--)	shift; break ;;
	x-*)	echo "invalid option -- `echo $1|cut -c2-`"
		eval "$USAGE" ;;
	*)	break ;;
	esac
	shift
done
test x"$D" = x && eval "$USAGE"
if test $# -eq 0; then 
	set cgb cv dd etc fun homepage libs scripts share sources \
	    templates tw vi-lib
fi

cd 
case $D in 
.)
	echo "$@"
	;;
*:)
	for i
	do
		if test x"$N" = x; then
			tar cf - $i | gzip -1 | mcopy -v - ${D}:$i.tgz
		else
			echo tar cf - $i \| gzip -1 \| mcopy -v - ${D}:$i.tgz
		fi
	done
	;;
*)
	test x"$N" != x && N="-n" 
	rsync $N -C -av --delete $* $D
	## rsync $N -C -av $* $D
	;;
esac
