if ((cp = getenv("SYS$LOGIN")) == NULL || *cp == '\0') { if ((cp = getenv("SYS$SCRATCH")) == NULL || *cp == '\0') { StrAllocCopy(HomeDir, "sys$scratch:"); } else { StrAllocCopy(HomeDir, cp); } } else { StrAllocCopy(HomeDir, cp);
if ((cp = getenv_text("SYS$LOGIN")) == NULL && (cp = getenv_text("SYS$SCRATCH")) == NULL) { cp = "sys$scratch:";
PUBLIC CONST char * Home_Dir NOARGS{    static CONST char *homedir = NULL;    char *cp = NULL;    if (homedir == NULL) {	if ((cp = getenv("HOME")) == NULL || *cp == '\0'#ifdef UNIX	    || *cp != '/'#endif /* UNIX */	    ) {#if defined (DOSPATH) || defined (__EMX__) /* BAD!	WSB */	    if ((cp = getenv("TEMP")) == NULL || *cp == '\0') {		if ((cp = getenv("TMP")) == NULL || *cp == '\0') {		    StrAllocCopy(HomeDir, "C:\\");		} else {		    StrAllocCopy(HomeDir, cp);		}	    } else {		StrAllocCopy(HomeDir, cp);	    }#else#ifdef VMS	    if ((cp = getenv("SYS$LOGIN")) == NULL || *cp == '\0') {		if ((cp = getenv("SYS$SCRATCH")) == NULL || *cp == '\0') {		    StrAllocCopy(HomeDir, "sys$scratch:");		} else {		    StrAllocCopy(HomeDir, cp);		}	    } else {		StrAllocCopy(HomeDir, cp);	    }#else#if HAVE_UTMP	    /*	     *	One could use getlogin() and getpwnam() here instead.	     */	    struct passwd *pw = getpwuid(geteuid());	    if (pw && pw->pw_dir) {		StrAllocCopy(HomeDir, pw->pw_dir);	    } else#endif	    {		/*		 *  Use /tmp; it should be writable.		 */		StrAllocCopy(HomeDir, "/tmp");	    }#ifdef UNIX	    if (cp && *cp)		HTAlwaysAlert(NULL, gettext("Ignoring invalid HOME"));#endif#endif /* VMS */#endif /* DOSPATH */	} else {	    StrAllocCopy(HomeDir, cp);	}	homedir = (CONST char *)HomeDir;#ifdef LY_FIND_LEAKS	atexit(LYHomeDir_free);#endif    }    return homedir;}