#!/usr/bin/perl -w
# Created by Ben Okopnik on Sun Oct 27 11:15:11 EST 2002
use 5.006_001;	# Yes, you need to have some non-ancient version of Perl

@ARGV > 1 or die "Usage: ", $0 =~ m#([^/]+)$#,
	" <file_with_right_perms> <other_file[s]>\n";

@a = (stat shift)[2,4,5];
chown @a[1,2],       grep -f, @ARGV;
chmod $a[0] & 07777, grep -f, @ARGV;

=head1	NAME

cpmod - replicates perms/UID/GID

=head1	SYNOPSIS

cpmod <file_with_right_perms> <list_of_other_files>

=head1	DESCRIPTION

"cpmod" will replicate the perms/UID/GID of a given file to the specified
list. Note that "cpmod file1 *" will copy the relevant inode info from
"file1" to all the files in the current directory including itself (a
harmless side effect).

=head1	WARRANTY

If it breaks, you get to keep both pieces. Heck, you've got the source -
read, heed, and trust your own judgement! That's the only real security
you've got when it comes to software, anyway.

=cut

