From 24efd81edda1e797719e0f4eb231604d9b273dad Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Thu, 1 Oct 1998 13:29:54 -0400 Subject: snapshot of project "lynx", label v2-8-1pre_6 --- src/LYBookmark.c | 8 ++---- src/LYCurses.h | 8 +++++- src/LYDownload.c | 6 +++- src/LYExtern.c | 2 +- src/LYMain.c | 8 ++++-- src/LYMainLoop.c | 19 +++++++++++++ src/LYPrint.c | 2 +- src/LYUpload.c | 15 ++++++---- src/LYUtils.c | 83 ++++++++++++++++++++++++-------------------------------- src/LYrcFile.c | 8 +++--- 10 files changed, 89 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/LYBookmark.c b/src/LYBookmark.c index bf6f4b60..7e8f7276 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -291,9 +291,7 @@ PUBLIC void save_bookmark_link ARGS2( * Create the bookmark file, if it doesn't exist already, * Otherwise, open the pre-existing bookmark file. - FM */ -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_TEXT; -#endif /* __DJGPP__ or _WINDOWS */ + SetDefaultMode(O_TEXT); if (first_time) { /* * Seek it in the home path. - FM @@ -355,9 +353,7 @@ Note: if you edit this file manually\n\ } fclose(fp); -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_BINARY; -#endif /* __DJGPP__ or _WINDOWS */ + SetDefaultMode(O_BINARY); /* * If this is a cached bookmark file, set nocache for * it so we'll see the new bookmark link when that diff --git a/src/LYCurses.h b/src/LYCurses.h index a0275449..ace10813 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -396,10 +396,16 @@ extern void lynx_stop_all_colors NOPARAMS; * stdout in BINARY mode by default. Where necessary we should open and * (close!) TEXT mode. */ -#if defined(_WINDOWS) || defined(DJGPP) +#if defined(_WINDOWS) || defined(DJGPP) || defined(__EMX__) #define SetOutputMode(mode) setmode(fileno(stdout), mode) #else #define SetOutputMode(mode) /* nothing */ #endif +#if defined(_WINDOWS) || defined(DJGPP) +#define SetDefaultMode(mode) _fmode = mode +#else +#define SetDefaultMode(mode) /* nothing */ +#endif + #endif /* LYCURSES_H */ diff --git a/src/LYDownload.c b/src/LYDownload.c index af02fe41..e55d0dbc 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -358,16 +358,20 @@ check_recall: } chmod(buffer, HIDE_CHMOD); #else /* Unix: */ + +#if !( defined(__EMX__) || defined(__DJGPP__) ) /* * Prevent spoofing of the shell. */ -#ifndef __EMX__ cp = quote_pathname(file); cp1 = quote_pathname(buffer); sprintf(command, "%s %s %s", COPY_PATH, cp, cp1); FREE(cp); FREE(cp1); #else + /* DJGPP: no " or space possible in 8+3 dos filenames. */ + /* (but EMX probably allows spaces which should be quoted, */ + /* like Win32 LFN does...) */ sprintf(command, "%s %s %s", COPY_PATH, file, buffer); #endif /* __EMX__ */ CTRACE(tfp, "command: %s\n", command); diff --git a/src/LYExtern.c b/src/LYExtern.c index 8b6959e9..329fe103 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -57,7 +57,7 @@ void run_external ARGS1(char *, c) */ #if defined(VMS) || defined(DOSPATH) || defined(__EMX__) sprintf(command, externals2->command, c); -#else /* Unix or DOS/Win: */ +#else /* Unix: */ cp = quote_pathname(c); sprintf(command, externals2->command, cp); FREE(cp); diff --git a/src/LYMain.c b/src/LYMain.c index e8c98418..49d6d3e5 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -35,6 +35,10 @@ #include #endif /* __DJGPP__ */ +#ifdef __EMX__ +#include +#endif + #ifndef VMS #ifdef SYSLOG_REQUESTED_URLS #include @@ -559,16 +563,14 @@ PUBLIC int main ARGS2( sock_init(); #endif -#if defined(_WINDOWS) || defined(DJGPP) /* * To prevent corrupting binary data with _WINDOWS and DJGPP * we open files and stdout in BINARY mode by default. * Where necessary we should open and (close!) TEXT mode. * (use LYNewTxtFile/LYAppendToTxtFile to open text files for writing) */ - _fmode = O_BINARY; + SetDefaultMode(O_BINARY); SetOutputMode( O_BINARY ); -#endif #ifdef DOSPATH if (getenv("TERM")==NULL) putenv("TERM=vt100"); diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index e5b44d62..51c0fd88 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -42,6 +42,10 @@ #include #endif +#ifdef __EMX__ +#include +#endif + #ifdef VMS #include #endif /* VMS */ @@ -4959,6 +4963,21 @@ check_add_bookmark_to_self: "mailto:", 7)) { HTUserMsg(NO_DOWNLOAD_MAILTO_LINK); + /* + * From here on we could have a remote host, so check if + * that's allowed. + * + * We copy all these checks from getfile() to LYK_DOWNLOAD + * here because LYNXDOWNLOAD:// will NOT be pushing the + * previous document into the history stack so preserve + * getfile() from returning a wrong status (NULLFILE). + */ + } else if (local_host_only && + !(LYisLocalHost(links[curdoc.link].lname) || + LYisLocalAlias(links[curdoc.link].lname))) { + HTUserMsg(ACCESS_ONLY_LOCALHOST); + + } else { /* Not a forms, options or history link */ /* * Follow a normal link or anchor. Note that diff --git a/src/LYPrint.c b/src/LYPrint.c index 91fd2f82..c4eea6e0 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -1136,7 +1136,7 @@ PUBLIC int printfile ARGS1( HTAddSugFilename(filename); } -#if defined (VMS) || defined (__EMX__) +#if defined (VMS) || defined (__EMX__) || defined(__DJGPP__) sprintf(buffer, cur_printer->command, tempfile, filename, "", "", "", "", "", "", "", "", "", ""); #else /* Unix: */ diff --git a/src/LYUpload.c b/src/LYUpload.c index 825d0e19..c9488e22 100644 --- a/src/LYUpload.c +++ b/src/LYUpload.c @@ -93,7 +93,7 @@ PUBLIC int LYUpload ARGS1( * Commands have the form "command %s [etc]" * where %s is the filename. */ - _statusline("Enter a filename: "); + _statusline(FILENAME_PROMPT); retry: *tmpbuf = '\0'; if (LYgetstr(tmpbuf, VISIBLE, sizeof(tmpbuf), NORECALL) < 0) @@ -129,9 +129,9 @@ retry: fclose(fp); #ifdef VMS - _statusline("File exists. Create higher version? (y/n)"); + _statusline(FILE_EXISTS_HPROMPT); #else - _statusline("File exists. Overwrite? (y/n)"); + _statusline(FILE_EXISTS_OPROMPT); #endif /* VMS */ c = 0; while (TOUPPER(c) != 'Y' && TOUPPER(c) != 'N' && c != 7 && c != 3) @@ -148,7 +148,7 @@ retry: } if (TOUPPER(c) == 'N') { - _statusline("Enter a filename: "); + _statusline(NEW_FILENAME_PROMPT); goto retry; } } @@ -156,15 +156,18 @@ retry: /* * See if we can write to it. */ + CTRACE(tfp, "LYUpload: filename is %s", buffer); + if ((fp = fopen(buffer, "w")) != NULL) { fclose(fp); remove(buffer); } else { - _statusline("Cannot write to file. Enter a new filename: "); + HTAlert(CANNOT_WRITE_TO_FILE); + _statusline(NEW_FILENAME_PROMPT); goto retry; } -#if defined (VMS) || defined (__EMX__) +#if defined (VMS) || defined (__EMX__) || defined(__DJGPP__) sprintf(tmpbuf, upload_command->command, buffer, "", "", "", "", ""); #else cp = quote_pathname(buffer); /* to prevent spoofing of the shell */ diff --git a/src/LYUtils.c b/src/LYUtils.c index d14b0b48..ac66b7f7 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -2031,8 +2031,8 @@ PUBLIC void LYFakeZap ARGS1( PUBLIC int HTCheckForInterrupt NOARGS { -#ifndef VMS /* UNIX stuff: */ int c; +#ifndef VMS /* UNIX stuff: */ #ifndef USE_SLANG struct timeval socket_timeout; int ret = 0; @@ -2095,6 +2095,37 @@ PUBLIC int HTCheckForInterrupt NOARGS #if defined (DOSPATH) && defined (NCURSES) nodelay(stdscr,FALSE); #endif /* DOSPATH */ + +#else /* VMS: */ + extern BOOLEAN HadVMSInterrupt; + extern int typeahead(); + + if (fake_zap > 0) { + fake_zap--; + CTRACE(tfp, "\r *** Got simulated 'Z' ***\n"); + CTRACE_FLUSH(tfp); + CTRACE_SLEEP(AlertSecs); + return((int)TRUE); + } + + /** Curses or slang setup was not invoked **/ + if (dump_output_immediately) + return((int)FALSE); + + /** Control-C or Control-Y and a 'N'o reply to exit query **/ + if (HadVMSInterrupt) { + HadVMSInterrupt = FALSE; + return((int)TRUE); + } + + /** Keyboard 'Z' or 'z', or Control-G or Control-C **/ + c = typeahead(); + +#endif /* !VMS */ + + /* + * 'c' contains whatever character we're able to read from type-ahead + */ if (TOUPPER(c) == 'Z' || c == 7 || c == 3) return((int)TRUE); #ifdef DISP_PARTIAL @@ -2147,42 +2178,8 @@ PUBLIC int HTCheckForInterrupt NOARGS HText_pageDisplay(Newline_partial, ""); } #endif /* DISP_PARTIAL */ - - /** Other keystrokes **/ - return((int)FALSE); - -#else /* VMS: */ - - int c; - extern BOOLEAN HadVMSInterrupt; - extern int typeahead(); - - if (fake_zap > 0) { - fake_zap--; - CTRACE(tfp, "\r *** Got simulated 'Z' ***\n"); - CTRACE_FLUSH(tfp); - CTRACE_SLEEP(AlertSecs); - return((int)TRUE); - } - - /** Curses or slang setup was not invoked **/ - if (dump_output_immediately) - return((int)FALSE); - - /** Control-C or Control-Y and a 'N'o reply to exit query **/ - if (HadVMSInterrupt) { - HadVMSInterrupt = FALSE; - return((int)TRUE); - } - - /** Keyboard 'Z' or 'z', or Control-G or Control-C **/ - c = typeahead(); - if (TOUPPER(c) == 'Z' || c == 7 || c == 3) - return((int)TRUE); - /** Other or no keystrokes **/ return((int)FALSE); -#endif /* !VMS */ } /* @@ -5549,15 +5546,11 @@ PUBLIC FILE *LYNewTxtFile ARGS1(char *, name) fp = fopen (name, "w", "shr=get"); chmod(name, HIDE_CHMOD); #else -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_TEXT; -#endif /* __DJGPP__ or _WINDOWS */ + SetDefaultMode(O_TEXT); fp = OpenHiddenFile(name, "w"); -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_BINARY; -#endif /* __DJGPP__ or _WINDOWS */ + SetDefaultMode(O_BINARY); #endif return fp; @@ -5571,15 +5564,11 @@ PUBLIC FILE *LYAppendToTxtFile ARGS1(char *, name) fp = fopen (name, "a+", "shr=get"); chmod(name, HIDE_CHMOD); #else -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_TEXT; -#endif /* __DJGPP__ or _WINDOWS */ + SetDefaultMode(O_TEXT); fp = OpenHiddenFile(name, "a+"); -#if defined(__DJGPP__) || defined(_WINDOWS) - _fmode = O_BINARY; -#endif /* __DJGPP__ or _WINDOWS */ + SetDefaultMode(O_BINARY); #endif return fp; } diff --git a/src/LYrcFile.c b/src/LYrcFile.c index c3968a31..8c4faa3f 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -855,10 +855,10 @@ PUBLIC int save_rc NOPARAMS * Partial display threshold */ fprintf(fp, "\ -# partial_thres specifies the number of lines Lynx should download and render -# before we redraw the screen in Partial Display logic -# e.g. partial_thres=2 -# would have Lynx redraw every 2 lines that it renders +# partial_thres specifies the number of lines Lynx should download and render\n\ +# before we redraw the screen in Partial Display logic\n\ +# e.g. partial_thres=2\n\ +# would have Lynx redraw every 2 lines that it renders\n\ # partial_thres=-1 would use the entire screensize\n"); fprintf(fp, "partial_thres=%d\n\n", partial_threshold); #endif /* DISP_PARTIAL */ -- cgit