[lastbash-cvs] SF.net SVN: lastbash:[242] lastbash/lastbash
Status: Beta
Brought to you by:
cstroie
|
From: <cs...@us...> - 2008-12-22 15:15:00
|
Revision: 242
http://lastbash.svn.sourceforge.net/lastbash/?rev=242&view=rev
Author: cstroie
Date: 2008-12-22 15:14:54 +0000 (Mon, 22 Dec 2008)
Log Message:
-----------
Replace some ESC sequences with `tput` (in case on non-ANSII terminal used)
"netcat" support, as well as "nc"
--
Credits: FrBrGeorge
Modified Paths:
--------------
lastbash/lastbash
Modified: lastbash/lastbash
===================================================================
--- lastbash/lastbash 2008-02-08 21:38:19 UTC (rev 241)
+++ lastbash/lastbash 2008-12-22 15:14:54 UTC (rev 242)
@@ -67,7 +67,7 @@
# Internal stuff
PLAYERS="mplayer"
-HTTP_CLIENTS="wget curl nc"
+HTTP_CLIENTS="wget curl nc netcat"
REQ_PROGRAMS="rm date tput stty md5sum dd chmod"
HTML_TEMPLATE="${HOME_DIR}/lastbash_template.html"
PLAYER_PID=""
@@ -81,10 +81,10 @@
CTRL_S=$'\x13'
CTRL_V=$'\x16'
CTRL_X=$'\x18'
-ARROW_UP=$'\x1b[A'
-ARROW_DOWN=$'\x1b[B'
-ARROW_LEFT=$'\x1b[D'
-ARROW_RIGHT=$'\x1b[C'
+ARROW_UP="$(tput kcuu1)"
+ARROW_DOWN="$(tput kcud1)"
+ARROW_LEFT="$(tput kcub1)"
+ARROW_RIGHT="$(tput kcuf1)"
NUMBER_REGEXP="+([0-9])"
# Set some shell options
@@ -520,7 +520,7 @@
case "${HTTP_CLIENT}" in
"wget") HTTP_CLIENT_FUNCTION="http_get_wget" ;;
"curl") HTTP_CLIENT_FUNCTION="http_get_curl" ;;
- "nc") HTTP_CLIENT_FUNCTION="http_get_nc" ;;
+ "nc" | "netcat") HTTP_CLIENT_FUNCTION="http_get_nc" ;;
*) HTTP_CLIENT_FUNCTION="http_get_builtin" ;;
esac
@@ -676,7 +676,7 @@
REQUEST="GET $4 HTTP/1.0\r\nHost: $2:$3\r\nUser-Agent: ${PROG_TITLE}/${PROG_VER}\r\nConnection: Close\r\n\r\n"
# Send the request
- if echo -ne "${REQUEST}" | nc -w "5" "$2" "$3" > "$1"
+ if echo -ne "${REQUEST}" | "${HTTP_CLIENT}" -w "5" "$2" "$3" > "$1"
then
RET="0"
else
@@ -1005,7 +1005,7 @@
T_ATTR_BLINK="$(tput blink)"
T_ATTR_INVIS="$(tput invis)"
T_ATTR_ULINE="$(tput smul)"
- T_ATTR_NORMAL="\e[0m"
+ T_ATTR_NORMAL="$(tput sgr0)"
# Some more escape sequences
T_EL="$(tput el)"
@@ -1217,7 +1217,7 @@
function tui_keys()
{
local LINE
- printf -v LINE " \e[1;44m%1s\e[0;44m %s " "R" "Refresh" "L" "Love" "B" "Ban" "K" "Skip" "P" "RTP" "D" "Discovery" "Q" "Quit"
+ printf -v LINE " ${T_ATTR_BOLD}${T_BGCOLOR_BLUE}%1s${T_ATTR_NORMAL}${T_BGCOLOR_BLUE} %s " "R" "Refresh" "L" "Love" "B" "Ban" "K" "Skip" "P" "RTP" "D" "Discovery" "Q" "Quit"
# Move the cursor on lower-left corner and print
tput cup ${T_LINES} 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|