[RFC] Add getHostname convenience function to kdelibs? (was: Re: [PATCH] Make the default sending domain configurable)

Thiago Macieira thiagom at wanadoo.fr
Sat Apr 20 13:35:03 BST 2002


Ingo Klöcker wrote
>QCString <classname>::getHostname( bool fallback_to_localhost )
>{
>  char str[256];
>  if ( !gethostname( str, 255 ) )
>    // str is not guaranteed to be NUL-terminated if it has full length
>    str[255] = 0;
>  else
>    str[0] = 0;
>
>  if( !*str && fallback_to_localhost )
>    return QCString( "localhost" );
>  else
>    return QCString( str );
>}

For lack of better place, I'll add that as a static function to 
KExtendedSocket, without the bool argument.

Or does anyone have a better suggestion? KGlobal? KSystem?

-- 
  Thiago Macieira - UFOT Registry number: 1001
 thiagom at mail.com
   ICQ UIN: 1967141  PGP: 0x8F2978D5 and 0xEA9037A5 (PGP 2.x)
     Registered Linux user #65028





More information about the kde-core-devel mailing list