blob: defac73c44c31db66578ed2f9950ef0cbc26c945 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
|