SITE_NAME should return the most qualified name of the host. If nslookup works, now the domain is appended to the hostname (whereas it *replaced* the host name before)

This commit is contained in:
Sebastien Barre 2001-10-18 18:01:19 -04:00
parent 8fefb3dd22
commit 5cc95e4387
1 changed files with 3 additions and 2 deletions

View File

@ -79,7 +79,7 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
host = hostReg.match(1); host = hostReg.match(1);
} }
} }
std::string siteName = host; std::string siteName = host;
if(host.length()) if(host.length())
{ {
@ -90,13 +90,14 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args)
std::string nsOutput; std::string nsOutput;
cmSystemTools::RunCommand(nsCmd.c_str(), cmSystemTools::RunCommand(nsCmd.c_str(),
nsOutput); nsOutput);
std::string RegExp = ".*Name:[ \t\n]*"; std::string RegExp = ".*Name:[ \t\n]*";
RegExp += host; RegExp += host;
RegExp += "\\.([^ \t\n\r]*)[ \t\n\r]*Address:"; RegExp += "\\.([^ \t\n\r]*)[ \t\n\r]*Address:";
cmRegularExpression reg( RegExp.c_str() ); cmRegularExpression reg( RegExp.c_str() );
if(reg.find(nsOutput.c_str())) if(reg.find(nsOutput.c_str()))
{ {
siteName = cmSystemTools::LowerCase(reg.match(1)); siteName += '.' + cmSystemTools::LowerCase(reg.match(1));
} }
} }