30 #ifndef __GETHOSTNAME_H
31 #define __GETHOSTNAME_H
42 # include <sys/utsname.h>
49 #if defined(__VMS) && __CRTL_VER < 70000000
50 # include <omniVMS/utsname.hxx>
59 #if defined(__WIN32__) && !defined(MAXHOSTNAMELEN)
60 # define MAXHOSTNAMELEN MAX_COMPUTERNAME_LENGTH
61 #elif defined(__WIN32__) && defined(MAXHOSTNAMELEN)
62 # undef MAXHOSTNAMELEN
63 # define MAXHOSTNAMELEN MAX_COMPUTERNAME_LENGTH
64 #elif !defined(MAXHOSTNAMELEN)
65 # define MAXHOSTNAMELEN 256
68 #elif defined(MAXHOSTNAMELEN) && (MAXHOSTNAMELEN < 64)
69 # undef MAXHOSTNAMELEN
70 # define MAXHOSTNAMELEN 256
74 #ifndef HAVE_GETHOSTNAME
89 #if defined(__WIN32__)
91 if( GetComputerName((LPTSTR) hostname, &dwordlen) )
101 if( uname(&un)==0 && strlen(un.nodename)<len)
103 strcpy(hostname,un.nodename);
int gethostname(char *hostname, size_t len)
#define MAXHOSTNAMELEN
Provides the function ‘int gethostname(char* hostname, size_t len)’ in a platform independent manner.