(void) strncpy(dest, ptr, len);
(void) strncpy(dest, ptr, len-1);
static char *GetHomeDir (dest, len)    char *dest;    int len;{#ifdef WIN32    register char *ptr;    char* users = "/users/";    if (ptr = getenv("HOME")) {	(void) strncpy(dest, ptr, len);	dest[len-1] = '\0';    } else if (ptr = getenv("USERNAME")) {	(void) strcpy (dest, users);	(void) strncat (dest, ptr, len - strlen (users));	dest[len-1] = '\0';    } else	*dest = '\0';#else    _Xgetpwparams pwparams;    struct passwd *pw;    register char *ptr;    if ((ptr = getenv("HOME"))) {	(void) strncpy(dest, ptr, len);	dest[len-1] = '\0';    } else {	if (ptr = getenv("USER"))	    pw = _XGetpwnam(ptr,pwparams);	else	    pw = _XGetpwuid(getuid(),pwparams);	if (pw != NULL)	    (void) strcpy(dest, pw->pw_dir);	else	    *dest = '\0';    }#endif    return dest;}