summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-05-09 13:11:04 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2007-05-09 13:11:04 (GMT)
commit56b73046a43a489387ebe4d05f3cf485dc0c1f32 (patch)
tree6b760c3008e11bff1e72958985e99005c71f6299 /scripts
parent823a283d19935b1890e1137f056b974df2dda481 (diff)
Again, some progress bar optimisation.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/crosstool.sh23
-rw-r--r--scripts/functions15
2 files changed, 12 insertions, 26 deletions
diff --git a/scripts/crosstool.sh b/scripts/crosstool.sh
index 1eacc73..fd43da6 100755
--- a/scripts/crosstool.sh
+++ b/scripts/crosstool.sh
@@ -37,28 +37,7 @@ CT_TOP_DIR="`CT_MakeAbsolutePath \"${CT_TOP_DIR}\"`"
CT_TestOrAbort "Configuration file not found. Please create one." -f "${CT_TOP_DIR}/.config"
. "${CT_TOP_DIR}/.config"
-# The progress bar indicator is asked for
-if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then
- _CT_PROG_BAR_DATE() {
- local str=`CT_DoDate +%s`
- local elapsed=$((str-(CT_STAR_DATE/(1000*1000*1000))))
- printf "[%02d:%02d]" $((elapsed/60)) $((elapsed%60))
- }
- _CT_PROG_BAR() {
- [ ${CT_PROG_BAR_CPT} -eq 0 ] && echo -en "\r`_CT_PROG_BAR_DATE` /"
- [ ${CT_PROG_BAR_CPT} -eq 10 ] && echo -en "\r`_CT_PROG_BAR_DATE` -"
- [ ${CT_PROG_BAR_CPT} -eq 20 ] && echo -en "\r`_CT_PROG_BAR_DATE` \\"
- [ ${CT_PROG_BAR_CPT} -eq 30 ] && echo -en "\r`_CT_PROG_BAR_DATE` |"
- CT_PROG_BAR_CPT=$(((CT_PROG_BAR_CPT+1)%40))
- }
- CT_PROG_BAR_CPT=0
- CT_PROG_BAR=_CT_PROG_BAR
- export -f _CT_PROG_BAR
-else
- CT_PROG_BAR=
-fi
-
-# Apply the color scheme if needed
+# Override the color scheme if needed
if [ "${CT_LOG_USE_COLORS}" = "y" ]; then
CT_ERROR_COLOR="${_A_NOR}${_A_BRI}${_F_RED}"
CT_WARN_COLOR="${_A_NOR}${_A_BRI}${_F_YEL}"
diff --git a/scripts/functions b/scripts/functions
index 1bd7fbd..dd19fcd 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -75,7 +75,7 @@ CT_DoLog() {
else
echo "${1}"
fi |( IFS="\n" # We want the full lines, even leading spaces
- cpt=0
+ CT_PROG_BAR_CPT=0
indent=$((2*CT_STEP_COUNT))
while read line; do
case "${CT_LOG_SEE_TOOLS_WARN},${line}" in
@@ -91,9 +91,16 @@ CT_DoLog() {
normal="CT_NORMAL_COLOR"
if [ ${cur_l} -le ${max_level} ]; then
echo -e "\r${!color}${l}${!normal}"
- CT_PROG_BAR_CPT=0 # Force redrawing progress bar on next 'unlogged' line
- else
- ${CT_PROG_BAR}
+ fi
+ if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then
+ str=`CT_DoDate +%s`
+ elapsed=$((str-(CT_STAR_DATE/(1000*1000*1000))))
+ [ ${CT_PROG_BAR_CPT} -eq 0 ] && bar="/"
+ [ ${CT_PROG_BAR_CPT} -eq 10 ] && bar="-"
+ [ ${CT_PROG_BAR_CPT} -eq 20 ] && bar="\\"
+ [ ${CT_PROG_BAR_CPT} -eq 30 ] && bar="|"
+ printf "\r[%02d:%02d] %s " $((elapsed/60)) $((elapsed%60)) "${bar}"
+ CT_PROG_BAR_CPT=$(((CT_PROG_BAR_CPT+1)%40))
fi
done
)