25#include <sys/utsname.h>
29 struct utsname info {} ;
30 int rc = ::uname( &info ) ;
32 return std::string() ;
34 std::string name = std::string( info.nodename ) ;
35 std::string::size_type pos = name.find(
'.' ) ;
36 if( pos != std::string::npos )
37 name = name.substr( 0U , pos ) ;
45 name = Str::printable( Environment::get(
"HOSTNAME",std::string()) ,
'_' ) ;
std::string hostname()
Returns the hostname.