Tailbox text handling

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

Tailbox text handling

#1 Post by 8-bit »

I got tailing to work after a fashion.
But I am having a problem with output from an external program that overwrites some lines it displays.
The output to the tailbox window currrently shows all lines individually rather than overwriting some as it should.
What should I change in this sample program?

Code: Select all

#!/bin/sh

export TITLE="Test run"
export TAILFILE=/tmp/mine
ufiformat -v /dev/sde> $TAILFILE&
#mkdosfs -v -I /dev/sde&> $TAILFILE
echo 99 > /tmp/tailbox_progress
echo " " > /tmp/tailbox_text

tailing (){
   I=`cat /tmp/tailbox_progress`
   echo $TITLE
   echo $I
   sleep 1
   [ -s "$TAILFILE" ] && tail -n 20 "$TAILFILE" | tr '\r' '\n' | tail -n 20 > /tmp/tailbox_text
   echo 100 > /tmp/tailbox_progress
}
export -f tailing

export tailbox="
<window title=\"tailbox\">
 <vbox>
  <progressbar>
   <input>"'while [ A != B ]; do tailing; done'"</input>
   <action>refresh:TAIL</action>
   <action>echo 99 > /tmp/tailbox_progress</action>
  </progressbar>
  <edit>
   <variable>TAIL</variable>
   <input file>/tmp/tailbox_text</input>
   <width>300</width><height>200</height>
  </edit>
 </vbox>
</window>"

I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog3 -p tailbox); do
   eval $STATEMENTS
done
IFS=$I

Post Reply