|
| iMatix home page | << | < | > | >> |
SFLVersion 2.10 |
#include "sflsock.h" char * get_hostname (void)
Returns a string containing the local hostname. The returned string is in a static area. Only performs the local hostname lookup one time; the returned value is cached for later repeated calls to this function. If sockets are not supported, returns the value "localhost".
{
#if (defined (DOES_SOCKETS))
static char
host_name [LINE_MAX + 1] = "";
if (strnull (host_name))
if (gethostname (host_name, LINE_MAX))
strcpy (host_name, "localhost");
return (host_name);
#else
return ("localhost");
#endif
}
| | << | < | > | >> |
|