+ if [ "$USE_DIALOG" = 1 ]; then
+ > "$tmp.menu"
+ cat_menu "$tmp" dialog | while read ln; do
+ echo -n " $ln" >> "$tmp.menu"
+ done
+ [ "$LINES" = "" ] && LINES=`tput lines`
+ [ "$COLUMNS" = "" ] && COLUMNS=`tput cols`
+ title="$SERVER: $SELECTOR"
+ dialog --extra-button --extra-label Back \
+ --cancel-label Exit \
+ --no-shadow \
+ --menu "$title" \
+ "$LINES" "$COLUMNS" "$LINES" \
+ --file "$tmp.menu" 2>"$tmp.choice"
+ val=$?
+ clear
+
+ if [ $val = 3 ]; then
+ CHOICE=""
+ elif [ $val = 1 ]; then
+ CHOICE="q"
+ else
+ CHOICE="`cat "$tmp.choice" | cut -c5-`"
+ fi
+
+ rm "$tmp.menu"
+ rm "$tmp.choice"
+ else
+ cat_menu "$tmp" | less
+ read -p "[$SELECTOR]: " NEW_CHOICE
+ if [ "$NEW_CHOICE" = p ]; then
+ CHOICE=`expr "$CHOICE" - 1 2>/dev/null`
+ if [ "$CHOICE" -lt 0 ]; then
+ CHOICE=`cat "$tmp" | grep "^$PREFIX" | wc --lines`
+ fi
+ elif [ "$NEW_CHOICE" = n ]; then
+ CHOICE=`expr "$CHOICE" + 1 2>/dev/null`
+ else
+ CHOICE="$NEW_CHOICE"
+ fi
+ fi
+
+ [ "$CHOICE" = q ] && exit 255 # force-quit