tDisplay entry uri with protocol prefix - sacc - sacc (saccomys): simple gopher client. (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit 502029b085642f9f09c3d9d7a2b82f87358fd78c (DIR) parent e034ff262431bb4f6c1e8340c6ff7ced21372160 (HTM) Author: kroovy <me@kroovy.de> Date: Thu, 31 Aug 2017 00:22:42 +0200 Display entry uri with protocol prefix Diffstat: ui_ti.c | 13 ++++++++++--- ui_txt.c | 11 +++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) --- (DIR) diff --git a/ui_ti.c b/ui_ti.c t@@ -1,6 +1,7 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <term.h> #include <termios.h> #include <unistd.h> t@@ -176,9 +177,15 @@ displayuri(Item *item) n = printf("%s: %s", item->username, item->selector); break; default: - n = printf("%s: %s:%s/%c%s", item->username, - item->host, item->port, item->type, - item->selector); + if (!strcmp(item->port, "70")) { + n = printf("%s: gopher://%s/%c%s", item->username, + item->host, item->type, + item->selector); + } else { + n = printf("%s: gopher://%s:%s/%c%s", item->username, + item->host, item->port, item->type, + item->selector); + } break; } putp(tparm(exit_standout_mode)); (DIR) diff --git a/ui_txt.c b/ui_txt.c t@@ -145,8 +145,15 @@ printuri(Item *item, size_t i) printf("%zu: %s: %s\n", i, item->username, item->selector); break; default: - printf("%zu: %s: %s:%s/%c%s\n", i, item->username, - item->host, item->port, item->type, item->selector); + if (!strcmp(item->port, "70")) { + printf("%zu: %s: gopher://%s/%c%s\n", i, item->username, + item->host, item->type, + item->selector); + } else { + printf("%zu: %s: gopher://%s:%s/%c%s\n", i, item->username, + item->host, item->port, item->type, + item->selector); + } break; } }