tAdd telnet:// and tn3270:// support. - sacc - sacc(omys), simple console gopher client (mirror) HTML git clone https://git.parazyd.org/sacc DIR Log DIR Files DIR Refs DIR LICENSE --- DIR commit b9d624f390dec6bfa114e5c46292ab2ee4e0ece7 DIR parent ddf996b8f35253bbb2509bff03e5c4e7cc056010 HTML Author: Christoph Lohmann <20h@r-36.net> Date: Fri, 23 Feb 2018 14:45:06 +0100 Add telnet:// and tn3270:// support. Diffstat: M sacc.c | 23 +++++++++++++++++++++++ M ui_ti.c | 8 ++++++++ M ui_txt.c | 8 ++++++++ 3 files changed, 39 insertions(+), 0 deletions(-) --- DIR diff --git a/sacc.c b/sacc.c t@@ -590,6 +590,8 @@ cleanup: static int dig(Item *entry, Item *item) { + char *plumburi = NULL; + if (item->raw) /* already in cache */ return item->type; if (!item->entry) t@@ -617,7 +619,24 @@ dig(Item *entry, Item *item) case '9': downloaditem(item); return 0; + case 'T': + if (asprintf(&plumburi, "tn3270://%s@%s:%s", item->selector, + item->host, item->port) < 0) { + return 0; + } + plumb(plumburi); + free(plumburi); + return 0; + case '8': + if (asprintf(&plumburi, "telnet://%s@%s:%s", item->selector, + item->host, item->port) < 0) { + return 0; + } + plumb(plumburi); + free(plumburi); + return 0; case 'g': + return 0; case 'I': plumbitem(item); return 0; t@@ -675,6 +694,8 @@ searchitem(Item *entry, Item *item) static void printout(Item *hole) { + char *printuri = NULL; + if (!hole) return; t@@ -716,9 +737,11 @@ delve(Item *hole) case '4': case '5': case '6': /* TODO decode? */ + case '8': case '9': case 'g': case 'I': + case 'T': dig(entry, hole); break; case 0: DIR diff --git a/ui_ti.c b/ui_ti.c t@@ -208,10 +208,18 @@ displayuri(Item *item) putp(tparm(cursor_address, lines-1, 0)); putp(tparm(enter_standout_mode)); switch (item->type) { + case '8': + n = snprintf(bufout, sizeof(bufout), "telnet://%s@%s:%s", + item->selector, item->host, item->port); + break; case 'h': n = snprintf(bufout, sizeof(bufout), "%s: %s", item->username, item->selector); break; + case 'T': + n = snprintf(bufout, sizeof(bufout), "tn3270://%s@%s:%s", + item->selector, item->host, item->port); + break; default: fmt = strcmp(item->port, "70") ? "%1$s: gopher://%2$s:%5$s/%3$c%4$s" : DIR diff --git a/ui_txt.c b/ui_txt.c t@@ -181,6 +181,10 @@ printuri(Item *item, size_t i) switch (item->type) { case 0: return; + case '8': + n = snprintf(bufout, sizeof(bufout), "telnet://%s@%s:%s", + item->selector, item->host, item->port); + break; case 'i': n = snprintf(bufout, sizeof(bufout), "%zu: %s", i, item->username); t@@ -189,6 +193,10 @@ printuri(Item *item, size_t i) n = snprintf(bufout, sizeof(bufout), "%zu: %s: %s", i, item->username, item->selector); break; + case 'T': + n = snprintf(bufout, sizeof(bufout), "tn3270://%s@%s:%s", + item->selector, item->host, item->port); + break; default: fmt = strcmp(item->port, "70") ? "%1$zu: %2$s: gopher://%3$s:%6$s/%4$c%5$s" :