summaryrefslogtreecommitdiff
path: root/nocompile
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2015-01-01 02:29:26 -0600
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2015-01-01 02:29:26 -0600
commite23c6287bb1124397c126c83cc73fed17fda998f (patch)
treee5a5d081fed5fcce05546ad62e9f07aa932ca17e /nocompile
parent86ba931697790d4da2515f4457ebfb3f20b43860 (diff)
downloadmisc-e23c6287bb1124397c126c83cc73fed17fda998f.tar.gz
misc-e23c6287bb1124397c126c83cc73fed17fda998f.zip
added zengoph which is a zenity based gopher browser
cuturl is for getting parts out of URLs easier
Diffstat (limited to 'nocompile')
-rwxr-xr-xnocompile/bin/zengoph.sh48
1 files changed, 48 insertions, 0 deletions
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