#!/usr/bin/perl
#
#   mrgtree src dst
#
# This program digs through the src directory and its  subdirectories,
# and makes a copy of everything it finds in the dst directory.
# There are, naturally, some options:
#
# -l means to use links; the default is to copy.
#
# -n means to copy only the new(er) files, and don't modify files under
# the dst directory if they are newer; the default is everything.
#
$lnk = $new = 0;
for (@ARGV) {
	if (/^[-+](.*)/) {
		if ($1 == 'l') {
			++$lnk;
		} elsif($1 == 'n') {
			++$new;
		} else {
			printf STDERR "Unknown option; \"$_\" ignored.\n";
		}
	} else {
		if (defined $dst) {
			printf STDERR "Too many args; \"$_\" ignored.\n";
		} elsif (defined $src) {
			$dst = $_;
		} else {
			$src = $_;
		}
	}
}
print "lnk=$lnk new=$new src=\"$src\" dst=\"$dst\"\n";

# To be continued ...

