summaryrefslogtreecommitdiffstats
path: root/network/elinks/patches/0006-gopher-indexes_nocr.patch
diff options
context:
space:
mode:
author Dave Woodfall2020-01-09 11:14:49 +0100
committer Willy Sudiarto Raharjo2020-01-12 02:47:52 +0100
commit9044f879a9a70226159660117c245a425a808293 (patch)
tree8ebbaa9baafe6ee3abd5ad6a07775e6447c9204e /network/elinks/patches/0006-gopher-indexes_nocr.patch
parent7bf5d624be78d025b436312d3a1dd7a60c2b26f9 (diff)
downloadslackbuilds-9044f879a9a70226159660117c245a425a808293.tar.gz
network/elinks: Add gopher patch for html entities
Diffstat (limited to 'network/elinks/patches/0006-gopher-indexes_nocr.patch')
-rw-r--r--network/elinks/patches/0006-gopher-indexes_nocr.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/network/elinks/patches/0006-gopher-indexes_nocr.patch b/network/elinks/patches/0006-gopher-indexes_nocr.patch
new file mode 100644
index 0000000000..797c9a8b55
--- /dev/null
+++ b/network/elinks/patches/0006-gopher-indexes_nocr.patch
@@ -0,0 +1,23 @@
+#######################################################################
+# Fixes index listings with only LF and no CRs.
+# dave@slackbuilds.org
+#######################################################################
+diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
+--- a/src/protocol/gopher/gopher.c 2020-01-08 07:39:33.403725857 +0000
++++ b/src/protocol/gopher/gopher.c 2020-01-08 07:40:30.587406965 +0000
+@@ -779,6 +779,15 @@
+ switch (gopher->entity->type) {
+ case GOPHER_DIRECTORY:
+ case GOPHER_INDEX:
++ /* Lines with no carriage returns */
++ if (strchr(rb->data, ASCII_CR) == NULL) {
++ unsigned char *tmp = malloc(rb->length + 3);
++ tmp[0] = 'i';
++ tmp = stpcpy(stpcpy(stpcpy(tmp, rb->data), '\r'), '\n');
++ rb->length += 3;
++ memcpy(rb->data, tmp, rb->length);
++ free(tmp);
++ }
+ state = read_gopher_directory_data(conn, rb);
+ break;
+