#!/bin/sh

umask 022

case $# in
0|1|2)	exit;;
3)	if [ -d $1 ] && [ $1 != $2 ]; then
		echo >&2
		echo "!! Warning: using $1" >&2
		echo >&2
		dir=$1
	else
		dir=$2
	fi
	;;
*)	dir=$1;;
esac

shift; shift

test -f $dir || mkdir -p $dir
touch $dir
cp -auv "$@" $dir
