bopher-ng

A better Gopher client in pure Bash
git clone git://git.luxferre.top/bopher-ng.git
Log | Files | Refs | README | LICENSE

commit 44c49099f15d3a5b4cfe893949e143ed4c11aa31
parent 754da0568730dd24ba342216f8b70b8279bcde19
Author: Luxferre <lux@ferre>
Date:   Wed, 29 Mar 2023 21:32:53 +0300

Moved to network fd 4 to avoid random crashes on macs

Diffstat:
Mbopher-ng.sh | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bopher-ng.sh b/bopher-ng.sh @@ -66,14 +66,14 @@ trap clear_term INT # fetch any Gopher resource gophetch() { # args: host, port, selector[, input] - exec 3<>/dev/tcp/$1/$2 # bind the descriptor 3 to a /dev/tcp pseudo-device + exec 4<>/dev/tcp/$1/$2 # bind the descriptor 3 to a /dev/tcp pseudo-device if [[ -z "$4" ]]; then - printf '%s\r\n' "$3" >&3 # send the selector string (printf is more reliable) + printf '%s\r\n' "$3" >&4 # send the selector string (printf is more reliable) else - printf '%s\t%s\r\n' "$3" "$4" >&3 # send the selector + tab + input string + printf '%s\t%s\r\n' "$3" "$4" >&4 # send the selector + tab + input string fi - cat <&3 # fetch and output the result (we have to use cat as the result may be binary) - exec 3<&- # close the descriptor to make it reusable + cat <&4 # fetch and output the result (we have to use cat as the result may be binary) + exec 4<&- # close the descriptor to make it reusable } # parse a single Gophermap line according to the current host and port