if (maxlen <= 0 || buf == NULL) return 0;
int _XGetHostname (buf, maxlen)    char *buf;    int maxlen;{    int len;#ifdef NEED_UTSNAME    struct utsname name;    uname (&name);    len = strlen (name.nodename);    if (len >= maxlen) len = maxlen - 1;    strncpy (buf, name.nodename, len);    buf[len] = '\0';#else    buf[0] = '\0';    (void) gethostname (buf, maxlen);    buf [maxlen - 1] = '\0';    len = strlen(buf);#endif /* NEED_UTSNAME */    return len;}