-i=0
-while [ -e "$PIDF" ]; do
- i=`expr $i + 1`
- [ $i -gt "$MAXCON" ] && i=1
- fifo="$tmpd/fifo.$i"
- rm -f "$fifo" 2>/dev/null
- mkfifo "$fifo"
- < "$fifo" nc -l -q0 -w"$TIMEOUT" "$ADDR" -p "$port" | (
- if [ -e "$PIDF" ]; then
- read -r query
- selector="`echo "$query" | cut -f1 -d' ' | sed 's:[\r\n]::g'`"
- query="`echo "$query" | cut -f2 -d' ' | sed 's:[\r\n]::g'`"
- if [ "$query" = "" ]; then
- if [ "$defn" = "" ]; then
- echo "7Search $selector $ADDR $port"
- else
- echo "$defn"
- fi
- else
- QUERY_STRING="$query" "$prog" 2>> "$LOG" &
- 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"