#!/usr/local/bin/perl

if ($#ARGV != -1) {
   exit print "Usage: ctihave\n" ;
}

$tool = $ENV{"DTOOL"} ;
if ( $tool eq "" ) {
   die "not configured for using CTtools\n" ;
}

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" ;

$projname = &CTProj ;
$projname =~ tr/A-Z/a-z/ ;
$flav = &CTQueryProj( $projname ) ;
$spec = &CTResolveSpec( $projname, $flav ) ;

if ( $projname eq "" ) {
   exit print "Not currently in any project tree\n" ;
}

$result = &CTCMIHave( $projname, $flav, $spec ) ;
if ( $result ne "" ) {
    @splitlist = split( /\n/, $result ) ;
    foreach $item ( @splitlist ) {
	print $item . "\n" ;
    }
}
