diff --git a/mycp/mycp b/mycp/mycp index d8a562a..893231d 100755 --- a/mycp/mycp +++ b/mycp/mycp @@ -61,7 +61,7 @@ if ( $cvspath ) { foreach ( @ARGV ) { if ( -f $_ ) { &incvs($_); # check if file exists in cvs else make it so - &inperms($_); # check if file perms are registered or make it so + next unless &inperms($_); # check if file perms are registered or make it so unless (&cmptocvs($_)) { # compare file to cvs print "$_ not in sync with cvs version\n"; print "please fix this\n"; @@ -99,7 +99,7 @@ if ( $cvspath ) { } sub cmdline { - getopts("eh", \%option); + getopts("ehp", \%option); if ( $option{h} ) { &help; } if ( scalar(@ARGV) == 0 ) { &help; } @@ -198,17 +198,29 @@ EOT my $perms = &slurp($permsfile); if ( $perms =~ /^(\d{4}):([^-:][^:]*):([^:]+?):$fullname$/o ) { - # check perms - # update als optie -p anders file skippen + if ( $1 eq $mode && $2 eq $user && $3 eq $group ) { + return 1; + } elsif ( $option{p} ){ + $perms =~ s/^(\d{4}):([^-:][^:]*):([^:]+?):$fullname$/$mode:$user:$group:$filename/o; + open(FH, ">>$permsfile"); + print FH $perms; + close FH; + return 1; + } else { + print "$_ perms not in sync with registered version\n"; + print "please fix this\n"; + print "press enter to continue\n"; + my $line = <>; + return 0; + } } else { open(FH, ">>$permsfile"); print FH "$mode:$user:$group:$fullname\n"; close FH; system("$cvscmd ci -m \"adding $fullname\" $permsfile"); + return 1; } - print "$path\n"; - exit; } sub edit($) {