Do not put a username in telnets urls when the field is empty - sacc - sacc(omys), simple console gopher client HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/ DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit bab7585c38f70040c68865455e3fafa552cf9f6c DIR parent cffc2d4ac776d81b9e8a8083cee8064cd3f0d954 HTML Author: Quentin Rameau <quinq@fifth.space> Date: Sat, 18 Aug 2018 14:51:58 +0200 Do not put a username in telnets urls when the field is empty Thanks to Hiltjo for the hint! Diffstat: M sacc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- DIR diff --git a/sacc.c b/sacc.c @@ -679,14 +679,16 @@ dig(Item *entry, Item *item) downloaditem(item); return 0; case '8': - if (asprintf(&plumburi, "telnet://%s@%s:%s", item->selector, + if (asprintf(&plumburi, "telnet://%s%s%s:%s", + item->selector, item->selector ? "@" : "", item->host, item->port) < 0) return 0; plumb(plumburi); free(plumburi); return 0; case 'T': - if (asprintf(&plumburi, "tn3270://%s@%s:%s", item->selector, + if (asprintf(&plumburi, "tn3270://%s%s%s:%s", + item->selector, item->selector ? "@" : "", item->host, item->port) < 0) return 0; plumb(plumburi);