ENH: Correct sitename

This commit is contained in:
Dan Blezek 2001-05-04 16:43:54 -04:00
parent 089aa3e106
commit f386664efc

View File

@ -78,12 +78,16 @@ bool cmSiteNameCommand::Invoke(std::vector<std::string>& args)
std::string nsOutput; std::string nsOutput;
cmSystemTools::RunCommand(nsCmd.c_str(), cmSystemTools::RunCommand(nsCmd.c_str(),
nsOutput); nsOutput);
cmRegularExpression reg(".*Name:(.*)\n"); std::string RegExp = ".*Name:[ \t\n]*";
RegExp += host;
RegExp += "\\.([^ \t\n\r]*)[ \t\n\r]*Address:";
cmRegularExpression reg( RegExp.c_str() );
if(reg.find(nsOutput.c_str())) if(reg.find(nsOutput.c_str()))
{ {
siteName = reg.match(1); siteName = reg.match(1);
} }
} }
cmCacheManager::GetInstance()-> cmCacheManager::GetInstance()->
AddCacheEntry("SITE", AddCacheEntry("SITE",
siteName.c_str(), siteName.c_str(),