| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.10

 

get_hostname

#include "sflsock.h"
char *
get_hostname (void)

Synopsis

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".

Source Code - (sflsock.c)

{
#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
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation