--- toast-linux	2004/07/15 00:42:34	1.90
+++ toast-linux	2004/07/15 00:48:15	1.91
@@ -1003,10 +1003,13 @@
 
 start="`date +'%s'`"
 
+[ -n "$LINES" ] && LINES=50
+[ -n "$COLUMNS" ] && COLUMNS=80
+
 if [ "$1" = "init" ]; then
   [ -n "$TASK_INIT" ] && exit 0
   shift
-  for i in `seq 1 25`; do echo; done
+  for i in `seq 1 $LINES`; do echo; done
   TASK_INIT=1 exec "$@"
 fi
 
@@ -1051,9 +1054,10 @@
 atotal=0
 esofar=0
 asofar=0
+let margin="$COLUMNS-1"
 while read n e; do
   line="$line $n"
-  if echo "$line" | egrep -q '.{79}'; then
+  if echo "$line" | egrep -q ".{$margin}"; then
     let firstline="1+$firstline"
     p '\33[K\12'
     line=" $n"
@@ -1078,7 +1082,7 @@
 fi
 out='\33[s\33[H\33[0;1;42m'"`hms $asofar` elapsed / $percent% complete = `hms $remain` left ($name: `hms $this`)"'\33[K\12'"$out"
 p '\33[K\12\16\33[1;33;43m'
-let bar="$esofar*80/$etotal"
+let bar="$esofar*$COLUMNS/$etotal"
 while [ "$bar" -gt 0 ]; do
   p '0'
   let bar="$bar-1"