diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/HTFWriter.c | 29 | ||||
-rw-r--r-- | src/HTML.c | 3 | ||||
-rw-r--r-- | src/LYBookmark.c | 10 | ||||
-rw-r--r-- | src/LYCgi.c | 166 | ||||
-rw-r--r-- | src/LYCurses.c | 4 | ||||
-rw-r--r-- | src/LYCurses.h | 9 | ||||
-rw-r--r-- | src/LYDownload.c | 13 | ||||
-rw-r--r-- | src/LYForms.c | 7 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 4 | ||||
-rw-r--r-- | src/LYHistory.c | 10 | ||||
-rw-r--r-- | src/LYLeaks.c | 8 | ||||
-rw-r--r-- | src/LYList.c | 5 | ||||
-rw-r--r-- | src/LYLocal.c | 19 | ||||
-rw-r--r-- | src/LYMail.c | 22 | ||||
-rw-r--r-- | src/LYMain.c | 15 | ||||
-rw-r--r-- | src/LYMainLoop.c | 38 | ||||
-rw-r--r-- | src/LYNews.c | 10 | ||||
-rw-r--r-- | src/LYOptions.c | 7 | ||||
-rw-r--r-- | src/LYPrint.c | 29 | ||||
-rw-r--r-- | src/LYReadCFG.c | 6 | ||||
-rw-r--r-- | src/LYShowInfo.c | 5 | ||||
-rw-r--r-- | src/LYTraversal.c | 25 | ||||
-rw-r--r-- | src/LYUpload.c | 11 | ||||
-rw-r--r-- | src/LYUtils.c | 57 | ||||
-rw-r--r-- | src/LYUtils.h | 7 | ||||
-rw-r--r-- | src/LYrcFile.c | 5 |
26 files changed, 315 insertions, 209 deletions
diff --git a/src/HTFWriter.c b/src/HTFWriter.c index eab03eb3..e869eb73 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -574,20 +574,12 @@ SaveAndExecute_tempname: } } -#ifdef VMS - me->fp = fopen (fnam, "wb", "mbc=32"); -#else - me->fp = fopen (fnam, "wb"); -#endif /* VMS */ - + me->fp = LYNewBinFile (fnam); if (!me->fp) { HTAlert(CANNOT_OPEN_TEMP); FREE(me); return NULL; } -#ifndef __DJGPP__ - chmod(fnam, 0600); -#endif /* __DJGPP__ */ StrAllocCopy(me->viewer_command, pres->command); /* @@ -776,20 +768,12 @@ SaveToFile_tempname: */ IsBinary = FALSE; -#ifdef VMS - ret_obj->fp = fopen (fnam, "wb", "mbc=32"); -#else - ret_obj->fp = fopen (fnam, "wb"); -#endif /* VMS */ - + ret_obj->fp = LYNewBinFile (fnam); if (!ret_obj->fp) { HTAlert(CANNOT_OPEN_OUTPUT); FREE(ret_obj); return NULL; } -#ifndef __DJGPP__ - chmod(fnam, 0600); -#endif /* __DJGPP__ */ /* * Any "application/foo" or other non-"text/foo" types that @@ -1041,20 +1025,13 @@ Compressed_tempname: /* * Open the file for receiving the compressed input stream. - FM */ -#ifdef VMS - me->fp = fopen (fnam, "wb", "mbc=32"); -#else - me->fp = fopen (fnam, "wb"); -#endif /* VMS */ + me->fp = LYNewBinFile (fnam); if (!me->fp) { HTAlert(CANNOT_OPEN_TEMP); FREE(uncompress_mask); FREE(me); return NULL; } -#ifndef __DJGPP__ - chmod(fnam, 0600); -#endif /* __DJGPP__ */ /* * me->viewer_command will be NULL if the converter Pres found above diff --git a/src/HTML.c b/src/HTML.c index 4a60ac9a..839fccc4 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -4166,9 +4166,6 @@ PRIVATE void HTML_start_element ARGS5( * Convert any HTML entities or decimal escaping. - FM */ int CurrentCharSet = current_char_set; - BOOL CurrentEightBitRaw = HTPassEightBitRaw; - BOOLEAN CurrentUseDefaultRawMode = LYUseDefaultRawMode; - HTCJKlang CurrentHTCJK = HTCJK; int len; me->UsePlainSpace = TRUE; diff --git a/src/LYBookmark.c b/src/LYBookmark.c index d6891e9c..24fa5614 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -458,7 +458,7 @@ PUBLIC void remove_bookmark_link ARGS2( #else tempname(newfile, NEW_FILE); #endif /* VMS */ - if ((nfp = fopen(newfile, "w")) == NULL) { + if ((nfp = LYNewTxtFile(newfile)) == NULL) { fclose(fp); #ifdef VMS _statusline(BOOKSCRA_OPEN_FAILED_FOR_DEL); @@ -469,17 +469,15 @@ PUBLIC void remove_bookmark_link ARGS2( return; } -#ifndef VMS +#ifdef UNIX /* * Explicitly preserve bookmark file mode on Unix. - DSL */ if (stat(filename_buffer, &stat_buf) == 0) { - mode = ((stat_buf.st_mode & 0777) | 0600); + mode = ((stat_buf.st_mode & 0777) | HIDE_CHMOD); (void) fclose(nfp); nfp = NULL; -#ifndef __DJGPP__ (void) chmod(newfile, mode); -#endif /* __DJGPP__ */ if ((nfp = fopen(newfile, "a")) == NULL) { (void) fclose(fp); _statusline(BOOKTEMP_REOPEN_FAIL_FOR_DEL); @@ -487,7 +485,7 @@ PUBLIC void remove_bookmark_link ARGS2( return; } } -#endif /* !VMS */ +#endif /* UNIX */ if (is_mosaic_hotlist) { int del_line = cur*2; /* two lines per entry */ diff --git a/src/LYCgi.c b/src/LYCgi.c index 6a431122..c3658cae 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -9,6 +9,7 @@ ** dynamic pages without the need for a http daemon. GL ** 27 Jun 95 Added <index> (command line) support. Various cleanup ** and bug fixes. GL +** 04 Sep 97 Added support for PATH_INFO scripts. JKT ** ** Bugs ** If the called scripts aborts before sending the mime headers then @@ -128,8 +129,19 @@ PRIVATE int LYLoadCGI ARGS4( struct stat stat_buf; char *pgm = NULL; /* executable */ char *pgm_args = NULL; /* and its argument(s) */ + int statrv; + char *orig_pgm = NULL; /* Path up to ? as given, URL-escaped*/ + char *document_root = NULL; /* Corrected value of DOCUMENT_ROOT */ + char *path_info = NULL; /* PATH_INFO extracted from pgm */ + char *pgm_buff = NULL; /* PATH_INFO extraction buffer */ + char *path_translated; /* From document_root/path_info */ + + if (!arg || !*arg || strlen(arg) <= 8) { + HTAlert(BAD_REQUEST); + status = -2; + return(status); - if (arg) { + } else { if (strncmp(arg, "lynxcgi://localhost", 19) == 0) { StrAllocCopy(pgm, arg+19); } else { @@ -141,11 +153,57 @@ PRIVATE int LYLoadCGI ARGS4( } } - if (!arg || !*arg) { - HTAlert(BAD_REQUEST); - status = -2; + StrAllocCopy(orig_pgm, pgm); + if ((cp=strchr(pgm, '#')) != NULL) { + /* + * Strip a #fragment from path. In this case any pgm_args + * found above will also be bogus, since the '?' came after + * the '#' and is part of the fragment. Note that we don't + * handle the case where a '#' appears after a '?' properly + * according to URL rules. - kw + */ + *cp = '\0'; + pgm_args = NULL; + } + HTUnEscape(pgm); + + /* BEGIN WebSter Mods */ + /* If pgm is not stat-able, see if PATH_INFO data is at the end of pgm */ + if ((statrv = stat(pgm, &stat_buf)) < 0) { + StrAllocCopy(pgm_buff, pgm); + while (statrv < 0 || (statrv = stat(pgm_buff, &stat_buf)) < 0) { + if ((cp=strrchr(pgm_buff, '/')) != NULL) { + *cp = '\0'; + statrv = 999; /* force new stat() - kw */ + } else { + if (TRACE) + perror("LYNXCGI: strrchr(pgm_buff, '/') returned NULL"); + break; + } + } + + if (statrv < 0) { + /* Did not find PATH_INFO data */ + if (TRACE) + perror("LYNXCGI: stat() of pgm_buff failed"); + } else { + /* Found PATH_INFO data. Strip it off of pgm and into path_info. */ + StrAllocCopy(path_info, pgm+strlen(pgm_buff)); + strcpy(pgm, pgm_buff); + if (TRACE) + fprintf(stderr, + "LYNXCGI: stat() of %s succeeded, path_info=\"%s\".\n", + pgm_buff, path_info); + } + FREE(pgm_buff); + } + /* END WebSter Mods */ - } else if (stat(pgm, &stat_buf) < 0) { + if (statrv != 0) { + /* + * Neither the path as given nor any components examined by + * backing up were stat()able. - kw + */ HTAlert("Unable to access cgi script"); if (TRACE) { perror("LYNXCGI: stat() failed"); @@ -154,13 +212,31 @@ PRIVATE int LYLoadCGI ARGS4( } else if (!(S_ISREG(stat_buf.st_mode) && stat_buf.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) { - /* Not a runnable file, See if we can load it using file: code */ - char *temp = NULL; + /* + * Not a runnable file, See if we can load it using "file:" code. + */ char *new_arg = NULL; - StrAllocCopy(temp, pgm); + /* + * But try "file:" only if the file we are looking at is the path + * as given (no path_info was extracted), otherwise it will be + * to confusing to know just what file is loaded. - kw + */ + if (path_info) { + if (TRACE) { + fprintf(stderr, + "%s is not a file and %s not an executable, giving up.\n", + orig_pgm, pgm); + } + FREE(path_info); + FREE(pgm); + FREE(orig_pgm); + status = -4; + return(status); + } + StrAllocCopy(new_arg, "file://localhost"); - StrAllocCat(new_arg, temp); + StrAllocCat(new_arg, orig_pgm); if (TRACE) { fprintf(stderr, @@ -169,18 +245,41 @@ PRIVATE int LYLoadCGI ARGS4( status = HTLoadFile(new_arg, anAnchor, format_out, sink); FREE(new_arg); + } else if (path_info && + anAnchor != HTMainAnchor && + !(reloading && anAnchor->document) && + strcmp(arg, HTLoadedDocumentURL()) && + HText_AreDifferent(anAnchor, arg) && + HTUnEscape(orig_pgm) && + !exec_ok(HTLoadedDocumentURL(), orig_pgm, + CGI_PATH)) { /* exec_ok gives out msg. */ + /* + * If we have extra path info and are not just reloading + * the current, check the full file path (after unescaping) + * now to catch forbidden segments. - kw + */ + status = HT_NOT_LOADED; + } else if (no_lynxcgi) { _statusline(CGI_DISABLED); sleep(MessageSecs); status = HT_NOT_LOADED; - } else if (!reloading && no_bookmark_exec && + } else if (no_bookmark_exec && + anAnchor != HTMainAnchor && + !(reloading && anAnchor->document) && + strcmp(arg, HTLoadedDocumentURL()) && + HText_AreDifferent(anAnchor, arg) && HTLoadedDocumentBookmark()) { _statusline(BOOKMARK_EXEC_DISABLED); sleep(MessageSecs); status = HT_NOT_LOADED; - } else if (!reloading && !exec_ok(HTLoadedDocumentURL(), pgm, + } else if (anAnchor != HTMainAnchor && + !(reloading && anAnchor->document) && + strcmp(arg, HTLoadedDocumentURL()) && + HText_AreDifferent(anAnchor, arg) && + !exec_ok(HTLoadedDocumentURL(), pgm, CGI_PATH)) { /* exec_ok gives out msg. */ status = HT_NOT_LOADED; @@ -272,7 +371,7 @@ PRIVATE int LYLoadCGI ARGS4( sprintf (line, "Read %d bytes of data.", total_chars); HTProgress(line); if (TRACE) { - fprintf(stderr, "LYNXCGI: Rx: %s\n", buf); + fprintf(stderr, "LYNXCGI: Rx: %.*s\n", chars, buf); } (*target->isa->put_block)(target, buf, chars); @@ -303,15 +402,15 @@ PRIVATE int LYLoadCGI ARGS4( close(fd2[1]); sprintf(buf, "HTTP_ACCEPT_LANGUAGE=%.*s", - (sizeof(buf) - 22), language); + (int)(sizeof(buf) - 22), language); buf[(sizeof(buf) - 1)] = '\0'; add_environment_value(buf); if (pref_charset) { - sprintf(buf, "HTTP_ACCEPT_CHARSET=%.*s", - (sizeof(buf) - 21), pref_charset); - buf[(sizeof(buf) - 1)] = '\0'; - add_environment_value(buf); + cp = NULL; + StrAllocCopy(cp, "HTTP_ACCEPT_CHARSET="); + StrAllocCat(cp, pref_charset); + add_environment_value(cp); } if (anAnchor->post_data) { /* post script, read stdin */ @@ -382,6 +481,37 @@ PRIVATE int LYLoadCGI ARGS4( *cur_argv = NULL; /* Terminate argv */ argv[0] = pgm; + /* Begin WebSter Mods -jkt */ + if (LYCgiDocumentRoot != NULL) { + /* Add DOCUMENT_ROOT to env */ + cp = NULL; + StrAllocCopy(cp, "DOCUMENT_ROOT="); + StrAllocCat(cp, LYCgiDocumentRoot); + add_environment_value(cp); + } + if (path_info != NULL ) { + /* Add PATH_INFO to env */ + cp = NULL; + StrAllocCopy(cp, "PATH_INFO="); + StrAllocCat(cp, path_info); + add_environment_value(cp); + } + if (LYCgiDocumentRoot != NULL && path_info != NULL ) { + /* Construct and add PATH_TRANSLATED to env */ + StrAllocCopy(document_root, LYCgiDocumentRoot); + if (document_root[strlen(document_root) - 1] == '/') { + document_root[strlen(document_root) - 1] = '\0'; + } + path_translated = document_root; + StrAllocCat(path_translated, path_info); + cp = NULL; + StrAllocCopy(cp, "PATH_TRANSLATED="); + StrAllocCat(cp, path_translated); + add_environment_value(cp); + FREE(path_translated); + } + /* End WebSter Mods -jkt */ + execve(argv[0], argv, env); if (TRACE) { perror("LYNXCGI: execve failed"); @@ -405,7 +535,9 @@ PRIVATE int LYLoadCGI ARGS4( (*target->isa->_free)(target); } } + FREE(path_info); FREE(pgm); + FREE(orig_pgm); #else /* VMS */ HTStream *target; char buf[256]; diff --git a/src/LYCurses.c b/src/LYCurses.c index 41a29cc4..808bb49d 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1609,7 +1609,7 @@ PUBLIC void lynx_start_link_color ARGS2( * will be underlined if appropriate. - LE & FM */ if (pending) - start_underline(); + lynx_start_underline_color(); } } @@ -1635,7 +1635,7 @@ PUBLIC void lynx_stop_link_color ARGS2( * If underlining was turned on above, turn it off. - LE & FM */ if (pending) - stop_underline(); + lynx_stop_underline_color(); } #endif } diff --git a/src/LYCurses.h b/src/LYCurses.h index 2a2232e8..1246bd2e 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -53,6 +53,11 @@ # else # include <curses.h> # endif + +# ifdef wgetbkgd +# define getbkgd(w) wgetbkgd(w) /* workaround pre-1.9.9g bug */ +# endif + extern void LYsubwindow PARAMS((WINDOW * param)); # else /* FIXME: remove this after configure script is complete */ @@ -302,11 +307,11 @@ extern int lynx_chg_color PARAMS((int, int, int)); * reverse, and ignore underline. - FM */ #define start_bold() standout() -#define start_underline() 1 /* nothing */ +#define start_underline() /* nothing */ #define start_reverse() standout() #define wstart_reverse(a) wstandout(a) #define stop_bold() standend() -#define stop_underline() 1 /* nothing */ +#define stop_underline() /* nothing */ #define stop_reverse() standend() #define wstop_reverse(a) wstandend(a) diff --git a/src/LYDownload.c b/src/LYDownload.c index 14bfa21f..644ade45 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -42,7 +42,7 @@ PRIVATE char LYValidDownloadFile[256] = "\0"; PUBLIC void LYDownload ARGS1( char *, line) { - char *Line = NULL, *method, *file, *theFile, *sug_file = NULL; + char *Line = NULL, *method, *file, *sug_file = NULL; int method_number; int count; char buffer[512]; @@ -385,9 +385,9 @@ check_recall: fflush(stderr); start_curses(); #endif /* VMS */ -#ifndef __DJGPP__ - chmod(buffer, 0600); -#endif /* __DJGPP__ */ +#if defined(VMS) || defined(UNIX) + chmod(buffer, HIDE_CHMOD); +#endif /* defined(VMS) || defined(UNIX) */ } else { /* @@ -631,13 +631,10 @@ PUBLIC int LYdownload_options ARGS2( StrAllocCopy(sug_filename, *newfile); change_sug_filename(sug_filename); - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } -#ifndef DOSPATH - chmod(tempfile, 0600); -#endif /* DOSPATH */ LYstrncpy(LYValidDownloadFile, data_file, diff --git a/src/LYForms.c b/src/LYForms.c index 85eb44d8..1a2c14b1 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -674,15 +674,12 @@ PRIVATE int popup_options ARGS7( } scrollok(form_window, TRUE); #ifdef PDCURSES - keypad(form_window, TRUE); + keypad(form_window, TRUE); #endif /* PDCURSES */ #ifdef NCURSES -#ifdef wgetbkgd -#define getbkgd(w) wgetbkgd(w) /* workaround pre-1.9.9g bug */ -#endif LYsubwindow(form_window); #endif -#if defined(COLOR_CURSES) && defined(getbkgd) /* not defined in ncurses 1.8.7 */ +#if defined(HAVE_GETBKGD) /* not defined in ncurses 1.8.7 */ wbkgd(form_window, getbkgd(stdscr)); wbkgdset(form_window, getbkgd(stdscr)); #endif diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index d811b74f..584fe9eb 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -78,6 +78,10 @@ extern BOOLEAN local_exec_on_local_files; /* TRUE to enable local program * * execution in local files only */ #endif /* defined(EXEC_LINKS) || defined(EXEC_SCRIPTS) */ +#if defined(LYNXCGI_LINKS) && !defined(VMS) /* WebSter Mods -jkt */ +extern char *LYCgiDocumentRoot; /* DOCUMENT_ROOT in the lynxcgi env */ +#endif /* LYNXCGI_LINKS */ + /* Values to which keypad_mode can be set */ #define NUMBERS_AS_ARROWS 0 #define LINKS_ARE_NUMBERED 1 diff --git a/src/LYHistory.c b/src/LYHistory.c index 5a63061e..aa473d5e 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -421,13 +421,10 @@ PUBLIC int showhistory ARGS1( #endif /* VMS */ } - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } -#ifndef __DJGPP__ - chmod(tempfile, 0600); -#endif /* __DJGPP__ */ StrAllocCopy(*newfile, hist_filename); LYforce_HTML_mode = TRUE; /* force this file to be HTML */ @@ -585,13 +582,10 @@ PUBLIC int LYShowVisitedLinks ARGS1( #endif /* VMS */ } - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } -#ifndef __DJGPP__ - chmod(tempfile, 0600); -#endif /* __DJGPP__ */ StrAllocCopy(*newfile, vl_filename); LYforce_HTML_mode = TRUE; /* force this file to be HTML */ diff --git a/src/LYLeaks.c b/src/LYLeaks.c index 3b158182..fed79414 100644 --- a/src/LYLeaks.c +++ b/src/LYLeaks.c @@ -13,6 +13,7 @@ #include "tcp.h" #include "LYexit.h" #include "LYLeaks.h" +#include "LYUtils.h" #include <ctype.h> /*#include <stdio.h> included by HTUtils.h -- FM */ @@ -51,13 +52,10 @@ PUBLIC void LYLeaks NOARGS { * Recreate the file each time. * Do nothing if unable to open the file. */ - Fp_leakagesink = fopen(LEAKAGE_SINK, "w"); - if(Fp_leakagesink == NULL) { + Fp_leakagesink = LYNewTxtFile(LEAKAGE_SINK); + if(Fp_leakagesink == NULL) { return; } -#ifndef __DJGPP__ - chmod(LEAKAGE_SINK, 0600); -#endif /* __DJGPP__ */ while(ALp_RunTimeAllocations != NULL) { /* diff --git a/src/LYList.c b/src/LYList.c index c62600ba..2dc43fe0 100644 --- a/src/LYList.c +++ b/src/LYList.c @@ -84,14 +84,11 @@ PUBLIC int showlist ARGS2( #endif /* VMS */ } - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { _statusline(CANNOT_OPEN_TEMP); sleep(MessageSecs); return(-1); } -#ifndef __DJGPP__ - chmod(tempfile, 0600); -#endif /* __DJGPP__ */ StrAllocCopy(*newfile, list_filename); LYforce_HTML_mode = TRUE; /* force this file to be HTML */ diff --git a/src/LYLocal.c b/src/LYLocal.c index 9fcfe2e9..6f4b44fa 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -30,6 +30,7 @@ #include "HTUtils.h" #include "tcp.h" +#include "HTAlert.h" #include "HTParse.h" #include "LYCurses.h" #include "LYGlobalDefs.h" @@ -1142,15 +1143,12 @@ PRIVATE BOOLEAN permit_location ARGS3( * protection in case this wasn't done via an * external umask. - FM */ - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { _statusline("Unable to open permit options file"); sleep(AlertSecs); return(0); } -#ifndef __DJGPP__ - chmod(tempfile, 0600); -#endif /* __DJGPP__ */ - + if (first) { /* * Make the tempfile a URL. @@ -1351,7 +1349,7 @@ form to permit %s %s.\n</Ol>\n</Form>\n", cp = cr; } -#ifndef __DJGPP__ +#ifdef UNIX /* * Call chmod(). */ @@ -1364,7 +1362,7 @@ form to permit %s %s.\n</Ol>\n</Form>\n", if (LYExecv(CHMOD_PATH, args, tmpbuf) <= 0) { return (-1); } -#endif /* __DJGPP__ */ +#endif /* UNIX */ LYforce_no_cache = TRUE; /* Force update of dired listing. */ return 1; } @@ -1702,15 +1700,12 @@ PUBLIC int dired_options ARGS2( * protection in case this wasn't done via an * external umask. - FM */ - if ((fp0 = fopen(tempfile,"w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { _statusline("Unable to open file management menu file."); sleep(AlertSecs); return(0); } -#ifndef __DJGPP__ - chmod(tempfile, 0600); -#endif /* __DJGPP__ */ - + if (first) { /* * Make the tempfile a URL. diff --git a/src/LYMail.c b/src/LYMail.c index ad339f17..dbf3b8a9 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -189,14 +189,11 @@ PUBLIC void mailform ARGS4( #if defined(VMS) || defined(DOSPATH) sprintf(my_tempfile, "%s%s", lynx_temp_space, "temp_mail.txt"); - if ((fd = fopen(my_tempfile,"w")) == NULL) { + if ((fd = LYNewTxtFile(my_tempfile)) == NULL) { HTAlert(FORM_MAILTO_FAILED); FREE(address); return; } -#ifndef __DJGPP__ - chmod(tmpfile, 0600); -#endif /* __DJGPP__ */ if (*self) { cp = self; while (*cp == ' ' || *cp == ',') @@ -387,13 +384,10 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address, #endif /* UNIX */ #if defined(VMS) || defined(DOSPATH) sprintf(my_tempfile, "%s%s", lynx_temp_space, "temp_mail.txt"); - if ((fd = fopen(my_tempfile,"w")) == NULL) { + if ((fd = LYNewTxtFile(my_tempfile)) == NULL) { FREE(address); return; } -#ifndef __DJGPP__ - chmod(tmpfile, 0600); -#endif /* __DJGPP__ */ #endif /* VMS */ fprintf(fd, "The link %s :?: %s \n", @@ -450,8 +444,8 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address, if (traversal) { FILE *ofp; - if ((ofp = fopen(TRAVERSE_ERRORS,"a+")) == NULL) { - if ((ofp = fopen(TRAVERSE_ERRORS,"w")) == NULL) { + if ((ofp = LYAppendToTxtFile(TRAVERSE_ERRORS)) == NULL) { + if ((ofp = LYNewTxtFile(TRAVERSE_ERRORS)) == NULL) { perror(NOOPEN_TRAV_ERR_FILE); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -466,9 +460,6 @@ PUBLIC void mailmsg ARGS4(int,cur, char *,owner_address, #endif /* SIGTSTP */ exit(-1); } -#ifndef __DJGPP__ - chmod(TRAVERSE_ERRORS, 0600); -#endif /* __DJGPP__ */ } fprintf(ofp, "%s\t%s \tin %s\n", @@ -531,13 +522,10 @@ PUBLIC void reply_by_mail ARGS3( *cp = '\0'; strcat(my_tempfile, ".txt"); } - if ((fd = fopen(my_tempfile,"w")) == NULL) { + if ((fd = LYNewTxtFile(my_tempfile)) == NULL) { HTAlert(MAILTO_URL_TEMPOPEN_FAILED); return; } -#ifndef __DJGPP__ - chmod(my_tempfile, 0600); -#endif /* __DJGPP__ */ subject[0] = '\0'; /* diff --git a/src/LYMain.c b/src/LYMain.c index 943348ab..10b143c0 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -134,6 +134,10 @@ PUBLIC BOOLEAN local_exec_on_local_files = LOCAL_EXECUTION_LINKS_ON_BUT_NOT_REMOTE; #endif /* EXEC_LINKS || EXEC_SCRIPTS */ +#if defined(LYNXCGI_LINKS) && !defined(VMS) /* WebSter Mods -jkt */ +PUBLIC char *LYCgiDocumentRoot = NULL; /* DOCUMENT_ROOT in the lynxcgi env */ +#endif /* LYNXCGI_LINKS */ + #ifdef REVERSE_CLEAR_SCREEN_PROBLEM PUBLIC BOOLEAN enable_scrollback=TRUE; #else @@ -393,6 +397,9 @@ PRIVATE void free_lynx_globals NOARGS #ifdef SYSLOG_REQUESTED_URLS FREE(syslog_txt); #endif /* SYSLOG_REQUESTED_URLS */ +#ifdef LYNXCGI_LINKS /* WebSter Mods -jkt */ + FREE(LYCgiDocumentRoot); +#endif /* LYNXCGI_LINKS */ FREE(lynx_version_putenv_command); FREE(NNTPSERVER_putenv_cmd); FREE(http_proxy_putenv_cmd); @@ -998,7 +1005,7 @@ PUBLIC int main ARGS2( * versions from previous sessions so they don't * accumulate, and open it again. - FM */ - if ((LYTraceLogFP = fopen(LYTraceLogPath, "w")) == NULL) { + if ((LYTraceLogFP = LYNewTxtFile(LYTraceLogPath)) == NULL) { WWW_TraceFlag = FALSE; fprintf(stderr, "%s\n", TRACELOG_OPEN_FAILED); exit(-1); @@ -1007,16 +1014,12 @@ PUBLIC int main ARGS2( fclose(LYTraceLogFP); while (remove(LYTraceLogPath) == 0) ; - if ((LYTraceLogFP = fopen(LYTraceLogPath, "w", - "shr=get")) == NULL) { + if ((LYTraceLogFP = LYNewTxtFile(LYTraceLogPath)) == NULL) { WWW_TraceFlag = FALSE; printf("%s\n", TRACELOG_OPEN_FAILED); exit(-1); } #endif /* VMS */ -#ifndef __DJGPP__ - chmod(LYTraceLogPath, 0600); -#endif /* __DJGPP__ */ *stderr = *LYTraceLogFP; fprintf(stderr, "\t\t%s\n\n", LYNX_TRACELOG_TITLE); } diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 5a7b3fe4..4a712098 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -393,14 +393,7 @@ try_again: fflush(stderr); fclose(LYTraceLogFP); *stderr = LYOrigStderr; -#ifdef VMS - if ((LYTraceLogFP = fopen(LYTraceLogPath, - "a+", "shr=get")) == NULL) -#else - if ((LYTraceLogFP = fopen(LYTraceLogPath, - "a+")) == NULL) -#endif /* VMS */ - { + if ((LYTraceLogFP = LYAppendToTxtFile(LYTraceLogPath)) == NULL) { WWW_TraceFlag = FALSE; _statusline(TRACELOG_OPEN_FAILED); sleep(MessageSecs); @@ -507,8 +500,8 @@ try_again: if (traversal && !first_file && !LYCancelledFetch) { FILE *ofp; - if ((ofp = fopen(TRAVERSE_ERRORS,"a+")) == NULL) { - if ((ofp = fopen(TRAVERSE_ERRORS,"w")) == NULL) { + if ((ofp = LYAppendToTxtFile(TRAVERSE_ERRORS)) == NULL) { + if ((ofp = LYNewTxtFile(TRAVERSE_ERRORS)) == NULL) { perror(NOOPEN_TRAV_ERR_FILE); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -523,9 +516,6 @@ try_again: #endif /* SIGTSTP */ exit(-1); } -#ifndef __DJGPP__ - chmod(TRAVERSE_ERRORS, 0600); -#endif /* __DJGPP__ */ } fprintf(ofp, "%s %s\tin %s\n", links[curdoc.link].lname, @@ -1338,10 +1328,7 @@ try_again: crawl_ok = FALSE; sprintf(cfile,"lnk%08d.dat",ccount); ccount = ccount + 1; - if ((cfp = fopen(cfile,"w")) != NULL) { -#ifndef __DJGPP__ - chmod(cfile, 0600); -#endif /* __DJGPP__ */ + if ((cfp = LYNewTxtFile(cfile)) != NULL) { print_crawl_to_fd(cfp,curdoc.address,curdoc.title); fclose(cfp); } else { @@ -4538,7 +4525,7 @@ check_add_bookmark_to_self: * attempting to read the log via the TRACE_LOG * command. - FM */ - if ((LYTraceLogFP = fopen(LYTraceLogPath, "w")) == NULL) { + if ((LYTraceLogFP = LYNewTxtFile(LYTraceLogPath)) == NULL) { WWW_TraceFlag = FALSE; _statusline(TRACELOG_OPEN_FAILED); sleep(MessageSecs); @@ -4548,17 +4535,13 @@ check_add_bookmark_to_self: fclose(LYTraceLogFP); while (remove(LYTraceLogPath) == 0) ; - if ((LYTraceLogFP = fopen(LYTraceLogPath, "w", - "shr=get")) == NULL) { + if ((LYTraceLogFP = LYNewTxtFile(LYTraceLogPath)) == NULL) { WWW_TraceFlag == FALSE; _statusline(TRACELOG_OPEN_FAILED); sleep(MessageSecs); break; } #endif /* VMS */ -#ifndef __DJGPP__ - chmod(LYTraceLogPath, 0600); -#endif /* __DJGPP__ */ *stderr = *LYTraceLogFP; fprintf(stderr, "\t\t%s\n\n", LYNX_TRACELOG_TITLE); } @@ -4598,14 +4581,7 @@ check_add_bookmark_to_self: fflush(stderr); fclose(LYTraceLogFP); *stderr = LYOrigStderr; -#ifdef VMS - if ((LYTraceLogFP = fopen(LYTraceLogPath, - "a+", "shr=get")) == NULL) -#else - if ((LYTraceLogFP = fopen(LYTraceLogPath, - "a+")) == NULL) -#endif /* VMS */ - { + if ((LYTraceLogFP = LYAppendToTxtFile(LYTraceLogPath)) == NULL) { WWW_TraceFlag = FALSE; _statusline(TRACELOG_OPEN_FAILED); sleep(MessageSecs); diff --git a/src/LYNews.c b/src/LYNews.c index bb752de0..f67acf45 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -69,13 +69,10 @@ PUBLIC char *LYNewsPost ARGS2( * and message body. - FM */ tempname(my_tempfile, NEW_FILE); - if ((fd = fopen(my_tempfile, "w")) == NULL) { + if ((fd = LYNewTxtFile(my_tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(postfile); } -#ifndef __DJGPP__ - chmod(my_tempfile, 0600); -#endif /* __DJGPP__ */ /* * If we're using a Japanese display character set, @@ -85,7 +82,7 @@ PUBLIC char *LYNewsPost ARGS2( if (!strncmp(LYchar_set_names[current_char_set], "Japanese (EUC)", 14) || !strncmp(LYchar_set_names[current_char_set], "Japanese (SJIS)", 15)) { tempname(CJKfile, NEW_FILE); - if ((fc = fopen(CJKfile, "w")) == NULL) { + if ((fc = LYNewTxtFile(CJKfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); fclose(fd); #ifdef VMS @@ -96,9 +93,6 @@ PUBLIC char *LYNewsPost ARGS2( #endif /* VMS */ return(postfile); } -#ifndef __DJGPP__ - chmod(CJKfile, 0600); -#endif /* __DJGPP__ */ } /* diff --git a/src/LYOptions.c b/src/LYOptions.c index 5ed6f5d7..f73e58ff 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -2134,15 +2134,12 @@ PRIVATE int popup_choice ARGS6( } scrollok(form_window, TRUE); #ifdef PDCURSES - keypad(form_window, TRUE); + keypad(form_window, TRUE); #endif /* PDCURSES */ #ifdef NCURSES -#ifdef wgetbkgd -#define getbkgd(w) wgetbkgd(w) /* workaround pre-1.9.9g bug */ -#endif LYsubwindow(form_window); #endif -#if defined(COLOR_CURSES) && defined(getbkgd) /* not defined in ncurses 1.8.7 */ +#if defined(HAVE_GETBKGD) /* not defined in ncurses 1.8.7 */ wbkgd(form_window, getbkgd(stdscr)); wbkgdset(form_window, getbkgd(stdscr)); #endif diff --git a/src/LYPrint.c b/src/LYPrint.c index 0bd554ae..364cc2ca 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -83,6 +83,8 @@ PUBLIC int printfile ARGS1( char *disp_charset; #ifdef VMS extern BOOLEAN HadVMSInterrupt; +#else + char *envbuffer = NULL; /* WebSter Print Mods -jkt */ #endif /* VMS */ /* @@ -430,14 +432,13 @@ PUBLIC int printfile ARGS1( } } - if ((outfile_fp = fopen(buffer,"w")) == NULL) { + if ((outfile_fp = LYNewTxtFile(buffer)) == NULL) { HTAlert(CANNOT_WRITE_TO_FILE); _statusline(NEW_FILENAME_PROMPT); FirstRecall = TRUE; FnameNum = FnameTotal; goto retry; } - chmod(buffer, 0600); if (HTisDocumentSource()) { /* @@ -513,11 +514,10 @@ PUBLIC int printfile ARGS1( strcat(tempfile, ".txt"); } } - if((outfile_fp = fopen(tempfile, "w")) == NULL) { + if((outfile_fp = LYNewTxtFile(tempfile)) == NULL) { HTAlert(UNABLE_TO_OPEN_TEMPFILE); break; } - chmod(tempfile, 0600); /* * Write the contents to a temp file. @@ -800,11 +800,10 @@ PUBLIC int printfile ARGS1( strcat(tempfile, ".txt"); } } - if ((outfile_fp = fopen(tempfile, "w")) == NULL) { + if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) { HTAlert(FILE_ALLOC_FAILED); break; } - chmod(tempfile, 0600); if (HTisDocumentSource()) { /* @@ -1004,11 +1003,26 @@ PUBLIC int printfile ARGS1( if (TRACE) fprintf(stderr, "command: %s\n", buffer); printf(PRINTING_FILE); + +#ifndef VMS + /* Begin WebSter Print Mods - jkt */ + StrAllocCopy(envbuffer, "LYNX_PRINT_TITLE="); + StrAllocCat(envbuffer, HText_getTitle()); + putenv(envbuffer); + /* End WebSter Print Mods - jkt */ +#endif /* !VMS */ + fflush(stdout); system(buffer); fflush(stdout); #ifndef VMS signal(SIGINT, cleanup_sig); + /* + * Remove LYNX_PRINT_TITLE value from environment - kw + */ + envbuffer[17] = '\0'; /* truncate after '=' */ + putenv(envbuffer); + FREE(envbuffer); #endif /* !VMS */ sleep(MessageSecs); start_curses(); @@ -1079,11 +1093,10 @@ PUBLIC int print_options ARGS2( #endif /* !VMS */ } - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(UNABLE_TO_OPEN_PRINTOP_FILE); return(-1); } - chmod(tempfile, 0600); StrAllocCopy(*newfile, print_filename); LYforce_no_cache = TRUE; diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 25f4301e..84c6b718 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -834,6 +834,12 @@ PUBLIC void read_cfg ARGS1( #ifdef LYNXCGI_LINKS } else if (!strncasecomp(buffer, "LYNXCGI_ENVIRONMENT:", 20)) { add_lynxcgi_environment(buffer+20); + +#ifndef VMS + /* WebSter Mods - Next 2 Lines -jkt */ + } else if (!strncasecomp(buffer, "LYNXCGI_DOCUMENT_ROOT:", 22)) { + StrAllocCopy(LYCgiDocumentRoot, buffer+22); +#endif /* !VMS */ #endif /* LYNXCGI_LINKS */ } else if (!strncasecomp(buffer, "LYNX_HOST_NAME:", 15)) { diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index 2d167ee9..a3297b7d 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -66,13 +66,10 @@ PUBLIC int showinfo ARGS4( #endif /* VMS */ } - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(0); } -#ifndef __DJGPP__ - chmod(tempfile, 0600); -#endif /* __DJGPP__ */ /* * Point the address pointer at this Url diff --git a/src/LYTraversal.c b/src/LYTraversal.c index 500475d3..44853908 100644 --- a/src/LYTraversal.c +++ b/src/LYTraversal.c @@ -16,7 +16,7 @@ PUBLIC BOOLEAN lookup ARGS1(char *,target) char buffer[200], line[200]; if ((ifp = fopen(TRAVERSE_FILE,"r")) == NULL) { - if ((ifp = fopen(TRAVERSE_FILE,"w")) == NULL) { + if ((ifp = LYNewTxtFile(TRAVERSE_FILE)) == NULL) { perror("unable to open or create a traversal file"); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -32,9 +32,6 @@ PUBLIC BOOLEAN lookup ARGS1(char *,target) exit(-1); } else { fclose(ifp); -#ifndef __DJGPP__ - chmod(TRAVERSE_FILE, 0600); -#endif /* __DJGPP__ */ return(FALSE); } } @@ -57,7 +54,7 @@ PUBLIC void add_to_table ARGS1(char *,target) FILE *ifp; - if ((ifp = fopen(TRAVERSE_FILE,"a+")) == NULL) { + if ((ifp = LYAppendToTxtFile(TRAVERSE_FILE)) == NULL) { perror("unable to open traversal file"); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -72,9 +69,6 @@ PUBLIC void add_to_table ARGS1(char *,target) #endif /* SIGTSTP */ exit(-1); } -#ifndef __DJGPP__ - chmod(TRAVERSE_FILE, 0600); -#endif /* __DJGPP__ */ fprintf(ifp,"%s\n",target); @@ -86,7 +80,7 @@ PUBLIC void add_to_traverse_list ARGS2(char *,fname, char *,prev_link_name) FILE *ifp; - if ((ifp = fopen(TRAVERSE_FOUND_FILE,"a+")) == NULL) { + if ((ifp = LYAppendToTxtFile(TRAVERSE_FOUND_FILE)) == NULL) { perror("unable to open traversal found file"); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -101,9 +95,6 @@ PUBLIC void add_to_traverse_list ARGS2(char *,fname, char *,prev_link_name) #endif /* SIGTSTP */ exit(-1); } -#ifndef __DJGPP__ - chmod(TRAVERSE_FOUND_FILE, 0600); -#endif /* __DJGPP__ */ fprintf(ifp,"%s\t%s\n",fname, prev_link_name); @@ -118,13 +109,10 @@ PUBLIC void dump_traversal_history NOARGS if (nhist <= 0) return; - if ((ifp = fopen(TRAVERSE_FILE,"a+")) == NULL) { + if ((ifp = LYAppendToTxtFile(TRAVERSE_FILE)) == NULL) { perror("unable to open traversal file"); return; } -#ifndef __DJGPP__ - chmod(TRAVERSE_FILE, 0600); -#endif /* __DJGPP__ */ fprintf(ifp, "\n\nTRAVERSAL WAS INTERUPTED\n\n\ \t here is a list of the history stack so that you may rebuild\n\n"); @@ -141,7 +129,7 @@ PUBLIC void add_to_reject_list ARGS1(char *,target) FILE *ifp; - if ((ifp = fopen(TRAVERSE_REJECT_FILE,"a+")) == NULL) { + if ((ifp = LYAppendToTxtFile(TRAVERSE_REJECT_FILE)) == NULL) { perror("unable to open reject file"); #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_DFL); @@ -156,9 +144,6 @@ PUBLIC void add_to_reject_list ARGS1(char *,target) #endif /* SIGTSTP */ exit(-1); } -#ifndef __DJGPP__ - chmod(TRAVERSE_REJECT_FILE, 0600); -#endif /* __DJGPP__ */ fprintf(ifp,"%s\n",target); diff --git a/src/LYUpload.c b/src/LYUpload.c index 2259d55f..dba75c56 100644 --- a/src/LYUpload.c +++ b/src/LYUpload.c @@ -198,9 +198,9 @@ retry: system(cmd); fflush(stdout); start_curses(); -#ifndef __DJGPP__ - chmod(buffer, 0600); -#endif /* __DJGPP__ */ +#ifdef UNIX + chmod(buffer, HIDE_CHMOD); +#endif /* UNIX */ /* don't remove(file); */ return 1; @@ -250,13 +250,10 @@ PUBLIC int LYUpload_options ARGS2( * protection in case this wasn't done via an * external umask. - FM */ - if ((fp0 = fopen(tempfile, "w")) == NULL) { + if ((fp0 = LYNewTxtFile(tempfile)) == NULL) { HTAlert(CANNOT_OPEN_TEMP); return(-1); } -#ifndef __DJGPP__ - chmod(tempfile, 0600); -#endif /* __DJGPP__ */ #ifdef VMS strcpy(curloc, "/sys$login"); diff --git a/src/LYUtils.c b/src/LYUtils.c index 26015709..27898c31 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -5312,6 +5312,61 @@ PUBLIC int putenv ARGS1( #ifdef NEED_REMOVE int remove ARGS1(char *, name) { - return unlink(name); + return unlink(name); } #endif + +#ifdef UNIX +/* + * Open a file that we don't want other users to see. For new files, the umask + * will suffice; however if the file already exists we'll change permissions + * first, before opening it. If the chmod fails because of some reason other + * than a non-existent file, there's no point in trying to open it. + */ +static FILE *OpenHiddenFile ARGS2(char *, name, char *, mode) +{ + int save = umask(HIDE_UMASK); + FILE *fp = 0; + if (chmod(name, HIDE_CHMOD) == 0 || errno == ENOENT) + fp = fopen(name, mode); + umask(save); + return fp; +} +#else +# ifndef VMS +# define OpenHiddenFile(name, mode) fopen(name, mode) +# endif +#endif + +FILE *LYNewBinFile ARGS1(char *, name) +{ +#ifdef VMS + FILE *fp = fopen (name, "wb", "mbc=32"); + chmod(name, HIDE_CHMOD); +#else + FILE *fp = OpenHiddenFile(name, "wb"); +#endif + return fp; +} + +FILE *LYNewTxtFile ARGS1(char *, name) +{ +#ifdef VMS + FILE *fp = fopen (name, "w", "shr=get"); + chmod(name, HIDE_CHMOD); +#else + FILE *fp = OpenHiddenFile(name, "w"); +#endif + return fp; +} + +FILE *LYAppendToTxtFile ARGS1(char *, name) +{ +#ifdef VMS + FILE *fp = fopen (name, "a+", "shr=get"); + chmod(name, HIDE_CHMOD); +#else + FILE *fp = OpenHiddenFile(name, "a+"); +#endif + return fp; +} diff --git a/src/LYUtils.h b/src/LYUtils.h index 557d971c..3896624e 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -57,6 +57,10 @@ extern time_t LYmktime PARAMS((char *string, BOOL absolute)); extern int putenv PARAMS((CONST char *string)); #endif /* HAVE_PUTENV */ +FILE *LYNewBinFile PARAMS((char * name)); +FILE *LYNewTxtFile PARAMS((char * name)); +FILE *LYAppendToTxtFile PARAMS((char * name)); + /* * Whether or not the status line must be shown. */ @@ -131,4 +135,7 @@ extern HTList *sug_filenames; #define STREQ(a,b) (strcmp(a,b) == 0) #define STRNEQ(a,b,c) (strncmp(a,b,c) == 0) +#define HIDE_CHMOD 0600 +#define HIDE_UMASK 0077 + #endif /* LYUTILS_H */ diff --git a/src/LYrcFile.c b/src/LYrcFile.c index e4a2b38b..e269f7ad 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -529,12 +529,9 @@ PUBLIC int save_rc NOPARAMS /* * Open the file for write. */ - if ((fp = fopen(rcfile, "w")) == NULL) { + if ((fp = LYNewTxtFile(rcfile)) == NULL) { return FALSE; } -#ifndef __DJGPP__ - chmod(rcfile, 0600); -#endif /* __DJGPP__ */ /* * Header. |