Recently Written · git

sacc

Mirror of git://bitreich.org/sacc, the sacc gopher client from bitreich.org.

git clone https://github.com/equwal/sacc

Log | Files | Refs


commit 7bd48fa9930dca90e24e17b78b451b014ae287e8
Quentin Rameau <quinq@fifth.space>
2019-10-29 00:02:02 +0100

Parse %09 as a search string separator in initial URIs

 sacc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/sacc.c b/sacc.c
index 61d6fc7..33b2678 100644
--- a/sacc.c
+++ b/sacc.c
@@ -922,12 +922,14 @@ moldentry(char *url)
 	entry->type = gopherpath[0];
 	entry->username = entry->selector = ++gopherpath;
 	if (entry->type == '7') {
-		for (; *p; ++p) {
-			if (*p == '\t') {
-				asprintf(&entry->tag, "%s", gopherpath);
-				*p = '\0';
-				break;
-			}
+		p = gopherpath;
+		if (p = strstr(p, "%09")) {
+			memmove(p+1, p+3, strlen(p+3)+1);
+			*p = '\t';
+		}
+		if (p = strchr(p, '\t')) {
+			asprintf(&entry->tag, "%s", gopherpath);
+			*p = '\0';
 		}
 	}
 	entry->host = host;