xref: /freebsd/contrib/dialog/samples/infobox5 (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
14c8945a0SNathan Whitehorn#! /bin/sh
2*a96ef450SBaptiste Daroussin# $Id: infobox5,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. ./setup-vars
74c8945a0SNathan Whitehorn
84c8945a0SNathan Whitehorn. ./setup-tempfile
94c8945a0SNathan Whitehorn
104c8945a0SNathan Whitehornleft=10
114c8945a0SNathan Whitehornunit="seconds"
124c8945a0SNathan Whitehornlast='\'
134c8945a0SNathan Whitehorn
144c8945a0SNathan Whitehorncat >>$tempfile <<EOF
154c8945a0SNathan Whitehorn$DIALOG $last
164c8945a0SNathan WhitehornEOF
174c8945a0SNathan Whitehorn
184c8945a0SNathan Whitehornwhile test $left != 0
194c8945a0SNathan Whitehorndo
204c8945a0SNathan Whitehorn
214c8945a0SNathan Whitehorncat >>$tempfile <<EOF
224c8945a0SNathan Whitehorn	--sleep 1 \
234c8945a0SNathan Whitehorn	--begin 0 5 \
247a1c0d96SNathan Whitehorn	--title "INFO BOX" $* \
254c8945a0SNathan Whitehorn        --infobox "Hi, this is an information box. It is
264c8945a0SNathan Whitehorndifferent from a message box: it will
274c8945a0SNathan Whitehornnot pause waiting for input after displaying
284c8945a0SNathan Whitehornthe message. The pause here is only introduced
294c8945a0SNathan Whitehornby the sleep command within dialog.
304c8945a0SNathan WhitehornYou have $left $unit to read this..." 0 0 $last
314c8945a0SNathan WhitehornEOF
324c8945a0SNathan Whitehorn
334c8945a0SNathan Whitehornleft=`expr $left - 1`
34*a96ef450SBaptiste Daroussintest "$left" = 1 && unit="second"
354c8945a0SNathan Whitehorndone
364c8945a0SNathan Whitehorn
374c8945a0SNathan Whitehornecho >>$tempfile
384c8945a0SNathan Whitehorn
394c8945a0SNathan Whitehorn. $tempfile
40