#!/usr/pkg/bin/bash ### ### I just wrote this so I could have a little gopher client of my own ### requires zenity. I just like using it for scripted GUIs. ### PATH=$PATH:/usr/pkg/sbin if [ "_$1" = "_" ];then printf "usage: $0 gopher://hacking.allowed.org/" exit 1 fi domain=$(printf "%s" "$1" | ./cuturl | grep ^domain | cut '-d ' -f2) port=70 request=$(printf "%s\r\n" "$1" | ./cuturl | grep ^path | cut '-d ' -f2) while true;do echo $domain echo $port echo $request tmp="$(printf "%s" "$request" \ | nc $domain $port \ | tr -d '\r' \ | tr '\t' '\n' \ | zenity --width=1000 --height=500 --list --column=a --column=b --column=c --column=d --print-column=1,2 )" echo $tmp request=$(printf "%s" "$tmp" | cut '-d|' -f2) name_and_type=$(printf "%s" "$tmp" | cut '-d|' -f1) type=$(printf "%s" "$name_and_type" | cut -b1) name=$(printf "%s" "$name_and_type" | cut -b2-) echo request $request echo type $type echo name $name if [ "_$type" = "_7" ];then args="$(zenity --entry)" request=$(printf "%s\t%s\r\n" "$request" "$args") else request=$(printf "%s\r\n" "$request") fi if [ "_$tmp" = "_" ];then exit fi done