GetHost.c File Reference

#include <X11/Xosdefs.h>
#include <string.h>
#include <unistd.h>
#include <X11/Xmu/SysUtil.h>

Include dependency graph for GetHost.c:

Go to the source code of this file.

Functions

int XmuGetHostname (char *buf, int maxlen)


Function Documentation

int XmuGetHostname ( char *  buf,
int  maxlen 
)

Definition at line 55 of file GetHost.c.

References len, and void().

Referenced by XmuConvertStandardSelection().

00056 {
00057     int len;
00058 #ifdef WIN32
00059     static WSADATA wsadata;
00060 
00061     if (!wsadata.wVersion && WSAStartup(MAKEWORD(1,1), &wsadata))
00062         return -1;
00063 #endif
00064 
00065 #ifdef NEED_UTSNAME
00066     /*
00067      * same host name crock as in server and xinit.
00068      */
00069     struct utsname name;
00070 
00071     uname (&name);
00072     len = strlen (name.nodename);
00073     if (len >= maxlen) len = maxlen - 1;
00074     strncpy (buf, name.nodename, len);
00075     buf[len] = '\0';
00076 #else
00077     buf[0] = '\0';
00078     (void) gethostname (buf, maxlen);
00079     buf [maxlen - 1] = '\0';
00080     len = strlen(buf);
00081 #endif /* hpux */
00082     return len;
00083 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Mar 4 16:04:09 2007 for Scilab [trunk] by  doxygen 1.5.1