about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTGopher.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2018-12-28 16:58:59 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2018-12-28 16:58:59 +0000
commit54f151b2d9abb8dfafe4b69ccc783bdec46b65f5 (patch)
tree69bb52ffbd12913ec4356bab1507f76c5e7f4f05 /WWW/Library/Implementation/HTGopher.c
parenteee24ddac89576eaf9efdd3753eb35e1e7bf4a6d (diff)
downloadlynx-snapshots-54f151b2d9abb8dfafe4b69ccc783bdec46b65f5.tar.gz
snapshot of project "lynx", label v2-9-0dev_0e
Diffstat (limited to 'WWW/Library/Implementation/HTGopher.c')
-rw-r--r--WWW/Library/Implementation/HTGopher.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 854694e5..865985c2 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTGopher.c,v 1.69 2018/12/27 23:48:37 Kamil.Dudka Exp $
+ * $LynxId: HTGopher.c,v 1.71 2018/12/28 16:58:59 tom Exp $
  *
  *			GOPHER ACCESS				HTGopher.c
  *			=============
@@ -28,6 +28,7 @@
 #include <HTParse.h>
 #include <HTTCP.h>
 #include <HTFinger.h>
+#include <LYGlobalDefs.h>
 
 /*
  *  Implements.
@@ -262,9 +263,33 @@ static void parse_menu(const char *arg GCC_UNUSED,
 	}
 
 	if ((char) ich != LF) {
-	    *p = (char) ich;	/* Put character in line */
-	    if (p < &line[BIG - 1])
-		p++;
+	    const char *ss = NULL;
+
+	    /*
+	     * Help the -source output to look like the HTML equivalent of the
+	     * Gopher menu.
+	     */
+	    if (dump_output_immediately
+		&& HTOutputFormat == HTAtom_for("www/dump")) {
+		if (ich == '<') {
+		    ss = "&lt;";
+		} else if (ich == '>') {
+		    ss = "&gt;";
+		} else if (ich == '&') {
+		    ss = "&amp;";
+		}
+	    }
+	    if (ss != NULL) {
+		if ((p + 5) < &line[BIG - 1]) {
+		    while (*ss != '\0') {
+			*p++ = *ss++;
+		    }
+		}
+	    } else {
+		*p = (char) ich;	/* Put character in line */
+		if (p < &line[BIG - 1])
+		    p++;
+	    }
 
 	} else {
 	    *p++ = '\0';	/* Terminate line */
@@ -1172,7 +1197,7 @@ static int generate_cso_form(char *host,
 
 		if (ctx.seek) {
 		    /*
-		     * Command wants us to skip (forward) to indicated token. 
+		     * Command wants us to skip (forward) to indicated token.
 		     * Start at current position.
 		     */
 		    size_t slen = strlen(ctx.seek);