#!/usr/pkg/bin/perl
#
# cpogm.pl,v 1.1.1.1 1999/09/12 15:23:32 kim Exp
#
# Set modes of a file according to an example file
#
# 1996-07-28  Kimmo Suominen
#
#require 'sys/stat.ph';
#
if ($#ARGV != 1) {
    die "Usage: $0 from to\n";
}
(($mode,$uid,$gid) = (stat($ARGV[0]))[2,4,5]) || die "Cannot stat $ARGV[0]\n";
chown($uid, $gid, $ARGV[1]) || die "Cannot chown $ARGV[1]\n";
#$mode &= (&S_ISUID | &S_ISGID | &S_ISVTX | &S_IRWXU | &S_IRWXG | &S_IRWXO);
$mode &= 07777;
chmod($mode, $ARGV[1]) || die "Cannot chmod $ARGV[1]\n";
exit 0;
