From e23c6287bb1124397c126c83cc73fed17fda998f Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Thu, 1 Jan 2015 02:29:26 -0600 Subject: added zengoph which is a zenity based gopher browser cuturl is for getting parts out of URLs easier --- nocompile/bin/zengoph.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 nocompile/bin/zengoph.sh (limited to 'nocompile/bin/zengoph.sh') diff --git a/nocompile/bin/zengoph.sh b/nocompile/bin/zengoph.sh new file mode 100755 index 0000000..defac73 --- /dev/null +++ b/nocompile/bin/zengoph.sh @@ -0,0 +1,48 @@ +#!/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 -- cgit v1.2.3