eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
# THE PRECEEDING STUFF EXECS perl via $PATH
# -*-Fundamental-*-
# perl_template - please see the comment at the end!
#eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
# & eval 'exec perl -S $0 $argv:q'
# if 0;
# THE PRECEEDING STUFF EXECS perl via $PATH
use Carp;
use strict;
$| = 1;
my $Myname;
($Myname = $0) =~ s%^.*/%%;
my $Usage = <<LIT;
$Myname: usage: $Myname
LIT
my $P4 = "/usr/local/bin/p4";
sub usage
{
print STDERR $Usage;
exit 1;
}
sub help
{
print STDERR <<LIT;
$Usage
$Myname is...
LIT
exit 1;
}
# option switch variables get defaults here...
my $Valopt = "default";
my $Boolopt = 0;
my @Args;
my $Args;
while ($#ARGV >= 0)
{
if ($ARGV[0] eq "-boolopt") { $Boolopt = 1; shift; next; }
elsif ($ARGV[0] eq "-valopt")
{
shift; if ($ARGV[0] < 0) { &usage; }
$Valopt = $ARGV[0]; shift; next;
}
elsif ($ARGV[0] eq "-help")
{ &help; }
elsif ($ARGV[0] =~ /^-/) { &usage; }
if ($Args ne "") { $Args .= " "; }
push(@Args, $ARGV[0]);
shift;
}
open(YPGROUPS, "<&STDIN") || die;
while (<YPGROUPS>)
{
chomp;
my ($group, $pw, $gid, $members) = split(/:/);
my @members = split(/\s*,\s*/, $members);
if ($#members >= 0)
{
if (! open(P4GROUPI, "| $P4 group -i"))
{
print "Myname: Can't open \"$P4 group -i: $!\n";
exit 1;
}
print P4GROUPI <<EOM;
Group: $group
MaxResults: unlimited
MaxScanRows: unlimited
Timeout: 43200
Subgroups:
Users:
EOM
foreach my $member (@members)
{
print P4GROUPI "\t$member\n";
}
print P4GROUPI "\n";
close P4GROUPI;
}
}