From 7f442ca7e60ac57930e3ddca324dfc0eb5b3a600 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Thu, 30 Mar 2023 09:32:46 +0300 Subject: [PATCH] a bit more improved telnet urls --- bopher-ng.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bopher-ng.sh b/bopher-ng.sh index 538bbc5..3f4ec68 100755 --- a/bopher-ng.sh +++ b/bopher-ng.sh @@ -106,8 +106,11 @@ gmparse() { # args: line, curhost, curport [[ '3' == "$rtype" ]] && desc="$ERRCOLOR$desc$ERESET" # wrap error messages in the coloration terminal commands # handle external URLs as information lines of a special kind [[ 'h' == "$rtype" ]] && desc="$desc: ${sel#URL:}" - # handle 8-type resources as telnet:// URIs - [[ '8' == "$rtype" ]] && desc="$desc: telnet://${sel}@${rhost}:${rport}/" + if [[ '8' == "$rtype" ]]; then # handle 8-type resources as telnet:// URIs + local username="${sel}@" + [[ -z "${sel}" ]] && username='' + desc="$desc: telnet://${username}${rhost}:${rport}/" + fi fi [[ '0' == "$rtype" ]] && action='P' # plain text is plain text [[ '1' == "$rtype" ]] && action='M' # it's a Gophermap