xref: /freebsd/contrib/dialog/samples/infobox6 (revision 7a1c0d963366a31363d3705697a083dd8efee077)
14c8945a0SNathan Whitehorn#! /bin/sh
2*7a1c0d96SNathan Whitehorn# $Id: infobox6,v 1.7 2011/01/18 09:20:59 tom Exp $
34c8945a0SNathan Whitehorn# get rid of all flickering by constructing a script unroll the loop, leaving
44c8945a0SNathan Whitehorn# us in curses-mode until we're done counting.
54c8945a0SNathan Whitehorn#
64c8945a0SNathan Whitehorn# a little fancier than infobox5, this moves the widget at each step.
74c8945a0SNathan Whitehorn
84c8945a0SNathan Whitehorn. ./setup-vars
94c8945a0SNathan Whitehorn
104c8945a0SNathan Whitehorn. ./setup-tempfile
114c8945a0SNathan Whitehorn
124c8945a0SNathan Whitehornleft=10
134c8945a0SNathan Whitehornunit="seconds"
144c8945a0SNathan Whitehornlast='\'
154c8945a0SNathan Whitehorn
164c8945a0SNathan Whitehorncat >>$tempfile <<EOF
174c8945a0SNathan Whitehorn$DIALOG $last
184c8945a0SNathan WhitehornEOF
194c8945a0SNathan Whitehorn
204c8945a0SNathan Whitehornwhile test $left != 0
214c8945a0SNathan Whitehorndo
224c8945a0SNathan Whitehorn
234c8945a0SNathan Whitehorncat >>$tempfile <<EOF
244c8945a0SNathan Whitehorn	--sleep 1 \
254c8945a0SNathan Whitehorn	--begin $left `expr $left + 5` \
26*7a1c0d96SNathan Whitehorn	--title "INFO BOX" $* $last
274c8945a0SNathan Whitehorn        --infobox "Hi, this is an information box. It is
284c8945a0SNathan Whitehorndifferent from a message box: it will
294c8945a0SNathan Whitehornnot pause waiting for input after displaying
304c8945a0SNathan Whitehornthe message. The pause here is only introduced
314c8945a0SNathan Whitehornby the sleep command within dialog.
324c8945a0SNathan WhitehornYou have $left $unit to read this..." 0 0 $last
334c8945a0SNathan WhitehornEOF
344c8945a0SNathan Whitehorn
354c8945a0SNathan Whitehornleft=`expr $left - 1`
364c8945a0SNathan Whitehorntest $left = 1 && unit="second"
374c8945a0SNathan Whitehorndone
384c8945a0SNathan Whitehorn
394c8945a0SNathan Whitehornecho >>$tempfile
404c8945a0SNathan Whitehorn
414c8945a0SNathan Whitehorn. $tempfile
42