#!/usr/bin/perl

# add all users to a default_users group

# to set maxresults and max scanrows


$cmd="/opt/cadroot/bin/p4 users";

open(TMPF,">/tmp/p4limit.$$") || die "Couldn't write temp file\n";

print TMPF "Group: default_users\nMaxResults: 100000\nMaxScanRows: 100000\nUsers:\n\t";

open(CMD, "$cmd|") || die "Error $cmd\n";

while(<CMD>) {

	(@data)=split;
	print TMPF "$data[0]\n\t";
	}


print TMPF "\n";
close(TMPF);


$cmd="p4 group -i < /tmp/p4limit.$$> /dev/null 2>&1";
system($cmd);

unlink("/tmp/p4limit.$$");