--- LYUtils.c 1997/06/13 19:06:27 1.1 +++ LYUtils.c 1997/06/13 20:15:33 @@ -3138,9 +3138,40 @@ } #endif /* VMS */ +/* Lynx_Dir() is where Lynx can keep its own private files: cookies, + certificates, .lynxrc, or whatever */ + +PUBLIC CONST char * Lynx_Dir NOARGS +{ + static CONST char *lynxdir=NULL; + + if (!lynxdir) { + StrAllocCopy(lynxdir, Home_Dir() ); + StrAllocCat(lynxdir, "/.lynx"); + /* Check if the Lynx-private directory exists */ + { + struct stat st; + + if (stat(lynxdir, &st)<0) + { + /* Attempt to create the directory */ + if (mkdir(lynxdir, 0700)<0) + { + /* XXX couldn't create .lynx directory; how to handle? */ + /* For the moment, just drop the .lynx and use homedir */ + free(lynxdir); lynxdir=Home_Dir(); + } + } + } + } + return lynxdir; +} + + + PUBLIC CONST char * Home_Dir NOARGS { - static CONST char *homedir; + static CONST char *homedir=NULL; if (!homedir) { if ((homedir = getenv("HOME")) == NULL) { --- LYUtils.h 1997/06/13 19:52:05 1.1 +++ LYUtils.h 1997/06/13 19:52:38 @@ -49,6 +49,7 @@ char *LogicalName, char *LogicalValue)); #endif /* VMS */ extern CONST char *Home_Dir NOPARAMS; +extern CONST char *Lynx_Dir NOPARAMS; extern BOOLEAN LYPathOffHomeOK PARAMS((char *fbuffer, int fbuffer_size)); extern void LYAddPathToHome PARAMS(( char *fbuffer, int fbuffer_size, char *fname)); --- LYrcFile.c 1997/06/13 19:52:05 1.1 +++ LYrcFile.c 1997/06/13 20:07:44 @@ -26,12 +26,12 @@ * Make an RC file name. */ #ifdef DJGPP - sprintf(rcfile, "%s/lynx.rc", Home_Dir()); + sprintf(rcfile, "%s/lynx.rc", Lynx_Dir()); #else #ifdef VMS sprintf(rcfile, "sys$login:.lynxrc"); #else - sprintf(rcfile, "%s/.lynxrc", Home_Dir()); + sprintf(rcfile, "%s/.lynxrc", Lynx_Dir()); #endif /* VMS */ #endif /* DJGPP */ @@ -476,12 +476,12 @@ * Make a name. */ #ifdef DJGPP - sprintf(rcfile, "%s/lynx.rc", Home_Dir()); + sprintf(rcfile, "%s/lynx.rc", Lynx_Dir()); #else #ifdef VMS sprintf(rcfile, "sys$login:.lynxrc"); #else - sprintf(rcfile, "%s/.lynxrc", Home_Dir()); + sprintf(rcfile, "%s/.lynxrc", Lynx_Dir()); #endif /* VMS */ #endif /* DJGPP */