From c244c640f9b4f69f521d286b77db0be566a5a610 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Mon, 6 Nov 2023 01:21:57 +0000 Subject: snapshot of project "lynx", label v2-9-0dev_12m --- CHANGES | 7 +- WWW/Library/Implementation/HTTCP.c | 4 +- WWW/Library/Implementation/HTUtils.h | 4 +- lynx.man | 49 ++++++-- lynx_help/keystrokes/keystroke_help.html | 10 +- src/HTFWriter.c | 4 +- src/LYCurses.c | 26 ++++- src/LYKeymap.c | 4 +- src/LYUtils.c | 189 +++++++++++++++---------------- 9 files changed, 177 insertions(+), 120 deletions(-) diff --git a/CHANGES b/CHANGES index 06095059..eb207e09 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,12 @@ --- $LynxId: CHANGES,v 1.1146 2023/10/27 00:25:32 tom Exp $ +-- $LynxId: CHANGES,v 1.1148 2023/11/05 22:43:27 tom Exp $ =============================================================================== Changes since Lynx 2.8 release =============================================================================== -2023-10-26 (2.9.0dev.13) +2023-11-05 (2.9.0dev.13) +* modify curses initialization to permit ^S built-in keymap to work without + needing external stty changes -TD +* correct ifdef for LYmsec_delay() (report by Alexander Arkhipov) -TD * handle errno EINPROGRESS in HTDoRead() from nonresponsive server (Debian #1033423) -TD * add a NUL after "/" in the SGML parser when the next character is ">", to diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index f0d6f3a7..ae121680 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTCP.c,v 1.166 2023/10/27 00:16:33 tom Exp $ + * $LynxId: HTTCP.c,v 1.167 2023/11/06 00:44:34 tom Exp $ * * Generic Communication Code HTTCP.c * ========================== @@ -662,7 +662,7 @@ static unsigned long __stdcall _fork_func(void *arg) } donelookup = TRUE; - return (unsigned long) (gbl_phost); + return (unsigned long) 1; /* nonzero for successful exit */ } #endif /* __CYGWIN__ */ #endif /* _WINDOWS_NSL */ diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index d01d0ddd..3d66cabe 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -1,5 +1,5 @@ /* - * $LynxId: HTUtils.h,v 1.134 2021/06/29 22:01:12 tom Exp $ + * $LynxId: HTUtils.h,v 1.135 2023/11/05 23:09:43 tom Exp $ * * Utility macros for the W3 code library * MACROS FOR GENERAL USE @@ -120,7 +120,7 @@ char *alloca(); #define HAVE_PUTENV 1 #endif -#ifndef NO_SIZECHANGE +#if !defined(NO_SIZECHANGE) && defined(UNIX) #define HAVE_SIZECHANGE 1 #endif diff --git a/lynx.man b/lynx.man index 6c94bb8a..800e5812 100644 --- a/lynx.man +++ b/lynx.man @@ -1,10 +1,20 @@ -.\" $LynxId: lynx.man,v 1.136 2023/06/18 18:49:34 tom Exp $ +.\" $LynxId: lynx.man,v 1.142 2023/10/30 22:31:08 tom Exp $ .\" ************************************************************************** .\" Escape single quotes in literal strings from groff's Unicode transform. -.ie \n(.g .ds `` \(lq -.el .ds `` `` -.ie \n(.g .ds '' \(rq -.el .ds '' '' +.ie \n(.g \{\ +.ds `` \(lq +.ds '' \(rq +.ds ' \(aq +.\} +.el \{\ +.ie t .ds `` `` +.el .ds `` "" +.ie t .ds '' '' +.el .ds '' "" +.ie t .ds ' \(aq +.el .ds ' ' +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -24,9 +34,10 @@ .el .in -2 .. .\" ************************************************************************** -.TH LYNX 1 2023-06-18 "Lynx 2.9.0" "Lynx \(en the \fItext\fP web browser" +.TH LYNX 1 2023-10-30 "Lynx 2.9.0" "Lynx \(en the \fItext\fP web browser" .SH NAME -lynx \- a general purpose distributed information browser for the World Wide Web +lynx \- +a general purpose distributed information browser for the World Wide Web .SH SYNOPSIS .B lynx \fI[options] [optional paths or URLs] .sp @@ -1031,7 +1042,13 @@ by upper/lowercase only the lowercase mapping is shown. Type \fBDelete\fR to view history list. .SH ENVIRONMENT In addition to various \*(``standard\*('' environment variables such as -\fBHOME\fR, \fBPATH\fR, \fBUSER\fR, \fBDISPLAY\fR, \fBTMPDIR\fR, \fBetc\fR, +\fBDISPLAY\fR, +\fBHOME\fR, +\fBPATH\fR, +\fBSHELL\fR, +\fBTMPDIR\fR, +\fBUSER\fR, +etc., \fILynx\fR utilizes several \fILynx\fP-specific environment variables, if they exist. .PP @@ -1133,21 +1150,31 @@ cso_proxy finger_proxy ftp_proxy gopher_proxy -https_proxy http_proxy +https_proxy +news_proxy newspost_proxy newsreply_proxy -news_proxy nntp_proxy no_proxy +rlogin_proxy +snews_proxy snewspost_proxy snewsreply_proxy -snews_proxy +telnet_proxy +tn3270_proxy wais_proxy .NE .IP See \fBLynx Users Guide\fR for additional details and examples. .TP +.B RL_CLCOPY_CMD +Pipe the contents of the current link using this command as the target. +.TP +.B RL_PASTE_CMD +Open a pipe to read from this command, +pasting it into the current editable-field or command-prompt. +.TP .B SOCKS5_PROXY Is inspected if .B \-socks5_proxy diff --git a/lynx_help/keystrokes/keystroke_help.html b/lynx_help/keystrokes/keystroke_help.html index 68043ffb..f079c786 100644 --- a/lynx_help/keystrokes/keystroke_help.html +++ b/lynx_help/keystrokes/keystroke_help.html @@ -1,4 +1,4 @@ - + @@ -135,6 +135,14 @@ " - Toggle valid or "soft" double-quote parsing CTRL-R - Reload current file and refresh the screen CTRL-L - Refresh the screen + CTRL-S - For UNIX hosts: + Copy the URL for the current document or link to + the clipboard using command in $RL_CLCOPY_CMD. as + illustrated in the clipboard_set function + of the (undated) Perl Term-ReadLine-Perl script. + The clipboard contents can be retrieved using Lynx's + PASTE_URL command (in turn, via $RL_PASTE_CMD). CTRL-V - Outside of a text input line or field, switch to idash ? strrchr(path, '-') : 0; if (the_dash != 0) { - unsigned off = (the_dash - path); + unsigned off = (unsigned) (the_dash - path); StrAllocCopy(new_path, path); new_path[off] = '.'; diff --git a/src/LYCurses.c b/src/LYCurses.c index d97b9558..401af836 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1,4 +1,4 @@ -/* $LynxId: LYCurses.c,v 1.201 2023/10/23 23:39:38 tom Exp $ */ +/* $LynxId: LYCurses.c,v 1.204 2023/11/06 01:21:57 tom Exp $ */ #include #include @@ -1386,16 +1386,36 @@ void start_curses(void) LYlines = LYscreenHeight(); LYcols = LYscreenWidth(); -#if defined(SIGWINCH) && defined(NCURSES_VERSION) +#if defined(NCURSES_VERSION) +#ifdef CAN_CUT_AND_PASTE + /* + * User-defined keymaps are loaded after this check, but since the + * ifdef is enabled, we know that at least the copy/paste commands + * are enabled. However, binding the copy to ^S is inconvenient, + * so ask curses to permit that (saving an external tweak with stty). + */ + { + struct termios alter_tty; + + if (tcgetattr(fileno(stdin), &alter_tty) == 0) { + alter_tty.c_iflag &= (unsigned) ~(IXON | IXOFF); + tcsetattr(fileno(stdout), TCSAFLUSH, &alter_tty); + def_prog_mode(); + } + } +#endif +#if defined(SIGWINCH) size_change(0); LYGetScreenSize(0); recent_sizechange = FALSE; /* prevent mainloop drawing 1st doc twice */ #endif /* SIGWINCH */ +#endif /* NCURSES_VERSION */ CTRACE((tfp, "Screen size is now %d x %d\n", LYcols, LYlines)); #ifdef USE_CURSES_PADS if (LYuseCursesPads) { CTRACE((tfp, "using curses-pads\n")); + keypad(stdscr, TRUE); LYwin = newpad(LYlines, MAX_COLS); LYshiftWin = 0; LYwideLines = FALSE; @@ -1672,6 +1692,8 @@ void lynx_enable_mouse(int state) #endif /* NOT USE_SLANG */ /***********************************************************************/ +#else + (void) state; #endif /* USE_MOUSE */ } diff --git a/src/LYKeymap.c b/src/LYKeymap.c index b05d0a3a..2ec5d919 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -1,4 +1,4 @@ -/* $LynxId: LYKeymap.c,v 1.122 2021/06/09 21:58:11 tom Exp $ */ +/* $LynxId: LYKeymap.c,v 1.123 2023/10/27 20:10:32 tom Exp $ */ #include #include #include @@ -74,7 +74,9 @@ static const LYEditInit initKeymapData[] = {KTL('P'), LYK_UP_TWO}, {KTL('Q'), LYK_CHANGE_CENTER}, {KTL('R'), LYK_RELOAD}, +#ifdef CAN_CUT_AND_PASTE {KTL('S'), LYK_TO_CLIPBOARD}, +#endif {KTL('T'), LYK_TRACE_TOGGLE}, {KTL('U'), LYK_NEXT_DOC}, {KTL('V'), LYK_SWITCH_DTD}, diff --git a/src/LYUtils.c b/src/LYUtils.c index c9c42489..9b5ac476 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYUtils.c,v 1.306 2023/10/24 00:12:43 tom Exp $ + * $LynxId: LYUtils.c,v 1.308 2023/10/27 21:48:46 tom Exp $ */ #include #include @@ -7560,9 +7560,96 @@ void get_clip_release(void) unmorph_PM(); } -#else /* !( defined __EMX__ ) */ +#elif defined(WIN_EX) /* 1997/10/16 (Thu) 20:13:28 */ -# if !defined(WIN_EX) && defined(HAVE_POPEN) +int put_clip(const char *szBuffer) +{ + HANDLE hWnd; + HANDLE m_hLogData; + LPTSTR pLogData; + HANDLE hClip; + int len; + + if (szBuffer == NULL) + return EOF; + + len = (int) strlen(szBuffer); + if (len == 0) + return EOF; + else + len++; + + m_hLogData = GlobalAlloc(GHND, len); + if (m_hLogData == NULL) { + return EOF; + } + + hWnd = NULL; + if (!OpenClipboard(hWnd)) { + return EOF; + } + /* Remove the current Clipboard contents */ + if (!EmptyClipboard()) { + GlobalFree(m_hLogData); + return EOF; + } + + /* Lock the global memory while we write to it. */ + pLogData = (LPTSTR) GlobalLock(m_hLogData); + + lstrcpy((LPTSTR) pLogData, szBuffer); + GlobalUnlock(m_hLogData); + + /* If there were any lines at all then copy them to clipboard. */ + hClip = SetClipboardData(CF_TEXT, m_hLogData); + if (!hClip) { + /* If we couldn't clip the data then free the global handle. */ + GlobalFree(m_hLogData); + } + + CloseClipboard(); + return 0; +} + +static HANDLE m_hLogData; +static int m_locked; + +/* get_clip_grab() returns a pointer to the string in the system area. + get_clip_release() should be called ASAP after this. */ + +char *get_clip_grab() +{ + HANDLE hWnd; + LPTSTR pLogData; + + hWnd = NULL; + if (!OpenClipboard(hWnd)) { + return 0; + } + + m_hLogData = GetClipboardData(CF_TEXT); + + if (m_hLogData == NULL) { + CloseClipboard(); + m_locked = 0; + return 0; + } + pLogData = (LPTSTR) GlobalLock(m_hLogData); + + m_locked = 1; + return pLogData; +} + +void get_clip_release() +{ + if (!m_locked) + return; + GlobalUnlock(m_hLogData); + CloseClipboard(); + m_locked = 0; +} + +#elif defined(HAVE_POPEN) static FILE *paste_handle = 0; static char *paste_buf = NULL; @@ -7643,9 +7730,8 @@ int put_clip(const char *s) return 0; } -# endif /* !defined(WIN_EX) && defined(HAVE_POPEN) */ - -#endif /* __EMX__ */ +#endif /* __EMX__ ... HAVE_POPEN */ +#endif /* CAN_CUT_AND_PASTE */ /* * Sleep for a number of milli-sec. @@ -7671,97 +7757,6 @@ void LYmsec_delay(unsigned msec) #endif } -#if defined(WIN_EX) /* 1997/10/16 (Thu) 20:13:28 */ - -int put_clip(const char *szBuffer) -{ - HANDLE hWnd; - HANDLE m_hLogData; - LPTSTR pLogData; - HANDLE hClip; - int len; - - if (szBuffer == NULL) - return EOF; - - len = (int) strlen(szBuffer); - if (len == 0) - return EOF; - else - len++; - - m_hLogData = GlobalAlloc(GHND, len); - if (m_hLogData == NULL) { - return EOF; - } - - hWnd = NULL; - if (!OpenClipboard(hWnd)) { - return EOF; - } - /* Remove the current Clipboard contents */ - if (!EmptyClipboard()) { - GlobalFree(m_hLogData); - return EOF; - } - - /* Lock the global memory while we write to it. */ - pLogData = (LPTSTR) GlobalLock(m_hLogData); - - lstrcpy((LPTSTR) pLogData, szBuffer); - GlobalUnlock(m_hLogData); - - /* If there were any lines at all then copy them to clipboard. */ - hClip = SetClipboardData(CF_TEXT, m_hLogData); - if (!hClip) { - /* If we couldn't clip the data then free the global handle. */ - GlobalFree(m_hLogData); - } - - CloseClipboard(); - return 0; -} - -static HANDLE m_hLogData; -static int m_locked; - -/* get_clip_grab() returns a pointer to the string in the system area. - get_clip_release() should be called ASAP after this. */ - -char *get_clip_grab() -{ - HANDLE hWnd; - LPTSTR pLogData; - - hWnd = NULL; - if (!OpenClipboard(hWnd)) { - return 0; - } - - m_hLogData = GetClipboardData(CF_TEXT); - - if (m_hLogData == NULL) { - CloseClipboard(); - m_locked = 0; - return 0; - } - pLogData = (LPTSTR) GlobalLock(m_hLogData); - - m_locked = 1; - return pLogData; -} - -void get_clip_release() -{ - if (!m_locked) - return; - GlobalUnlock(m_hLogData); - CloseClipboard(); - m_locked = 0; -} -#endif /* WIN_EX */ -#endif /* CAN_CUT_AND_PASTE */ - #if defined(WIN_EX) #ifndef WSABASEERR -- cgit 1.4.1-2-gfad0