56 lines
1.3 KiB
Perl
56 lines
1.3 KiB
Perl
#!/usr/local/bin/perl
|
|
|
|
sub CTMkDirUsage {
|
|
print STDERR "Usage: ctmkdir [-c \"comment\"] [-nc] dir-name [...]\n" ;
|
|
print STDERR "Options:\n" ;
|
|
print STDERR " -c \"comment\" : provide a comment about this action\n" ;
|
|
print STDERR " -nc : expect no comment on this action\n" ;
|
|
exit ;
|
|
}
|
|
|
|
if ( $#ARGV < 0 ) {
|
|
&CTMkDirUsage ;
|
|
}
|
|
|
|
$tool = $ENV{"DTOOL"} ;
|
|
if ( $tool eq "" ) {
|
|
die "Environment not configured for CTtools" ;
|
|
}
|
|
|
|
require "$tool/include/ctutils.pl" ;
|
|
require "$tool/include/ctvspec.pl" ;
|
|
require "$tool/include/ctquery.pl" ;
|
|
require "$tool/include/ctproj.pl" ;
|
|
require "$tool/include/ctcm.pl" ;
|
|
|
|
$comment = "" ;
|
|
if ( $ARGV[0] eq "-nc" ) {
|
|
shift( @ARGV ) ;
|
|
&CTUDebug( "-nc processed\n" ) ;
|
|
}
|
|
if ( $ARGV[0] eq "-c" ) {
|
|
shift( @ARGV ) ;
|
|
$comment = $ARGV[0] ;
|
|
shift( @ARGV ) ;
|
|
&CTUDebug( "setting comment to '" . $comment . "'\n" ) ;
|
|
}
|
|
|
|
if ( $#ARGV < 0 ) {
|
|
&CTMkDirUsage ;
|
|
}
|
|
|
|
$projname = &CTProj ;
|
|
$projname =~ tr/A-Z/a-z/ ;
|
|
$flav = &CTQueryProj( $projname ) ;
|
|
$spec = &CTResolveSpec( $projname, $flav ) ;
|
|
|
|
foreach $item ( @ARGV ) {
|
|
if ( -e $item ) {
|
|
print STDERR "Name collision on directory '$item'\n" ;
|
|
} else {
|
|
if ( ! &CTCMMkdir( $item, $projname, $spec, $comment ) ) {
|
|
print STDERR "Could name make directory '$item'\n" ;
|
|
}
|
|
}
|
|
}
|