commit 7f442ca7e60ac57930e3ddca324dfc0eb5b3a600
parent c5171f59227742e2e7e1b3b2d82b444d288bff88
Author: Luxferre <lux@ferre>
Date: Thu, 30 Mar 2023 09:32:46 +0300
a bit more improved telnet urls
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git 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