+tmp="`mktemp -t gofetch.current_page.XXXXXX`"
+finish() {
+ rm -rf "$tmp"
+}
+trap finish EXIT
+
+if [ $MODE = 1 ]; then
+ echo "$SELECTOR" | nc "$SERVER" "$PORT" | sed 's:\r::g' > "$tmp"
+else
+ echo "$SELECTOR" | nc "$SERVER" "$PORT" > "$tmp"
+fi
+
+case "$MODE" in
+0)
+ cat "$tmp" | less
+;;
+1)
+ CHOICE=start
+ while [ "$CHOICE" != "" ]; do
+ cat_menu "$tmp" | less
+ read -p "[$SELECTOR]: " CHOICE
+ index="`expr 1 \* "$CHOICE" 2>/dev/null`"
+ if [ "$index" != "" ]; then
+ goto_server="`getsel "$tmp" $index 3`"
+ goto_sel="`getsel "$tmp" $index 2`"
+ goto_port="`getsel "$tmp" $index 4`"
+ goto_mode="`getsel "$tmp" $index 1 | cut -c1`"
+ sh "$0" "$goto_server" "$goto_sel" "$goto_port" "$goto_mode"
+ fi
+ done
+;;
+7)
+ read -p "Query: " SEARCH
+ selQuery="$SELECTOR $SEARCH"
+
+ exec sh "$0" "$SERVER" "$selQuery" "$PORT" 1
+;;
+8)
+ telnet -l "$SELECTOR" "$SERVER" "$PORT"
+ read DUMMY
+;;
+9)
+ echo "<BINARY FILE>" | less
+;;
+*)
+ echo "unknwon selector mode: <$MODE>" | less
+ exit 3
+;;
+esac