xref: /freebsd/contrib/dialog/samples/infobox6 (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
14c8945a0SNathan Whitehorn#! /bin/sh
2*a96ef450SBaptiste Daroussin# $Id: infobox6,v 1.8 2019/12/10 23:38:49 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` \
267a1c0d96SNathan 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`
36*a96ef450SBaptiste Daroussintest "$left" = 1 && unit="second"
374c8945a0SNathan Whitehorndone
384c8945a0SNathan Whitehorn
394c8945a0SNathan Whitehornecho >>$tempfile
404c8945a0SNathan Whitehorn
414c8945a0SNathan Whitehorn. $tempfile
42