#!/usr/local/bin/perl
# Fix users email addresses
# Overwrite will username@velio.com
$p4="/apps/perforce/2000.2/solaris/p4";
# Get the users
$cmd="$p4 users";
open(CMD, "$cmd|") || die;
while(<CMD>) {
# vic <vic@baluga> (vic) accessed 2001/03/23
(@data)=split;
$user=$data[0];
#print "User $user\n";
push(@users,$user);
$cmd2="$p4 user -o $user | sed 's/^Email\.*/Email: $user\@velio.com/g' | $p4 -u $user user -i";
system($cmd2);
}
close(CMD);
# Add all these users to the control group
# Don't mess with these users for control purposes
$dontmess="sikand barnson";
$cmd3="$p4 group -o control > /tmp/p4con.$$";
system($cmd3);
foreach $p4user (@users) {
#print "Gobble $p4user\n";
if(!($p4user =~ /sikand/)) {
$cmd3="echo '\t$p4user' >> /tmp/p4con.$$";
system($cmd3);
}
}
system("$p4 group -i < /tmp/p4con.$$");