xref: /freebsd/contrib/dialog/samples/buildlist2 (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
1 #!/bin/sh
2 # $Id: buildlist2,v 1.8 2020/11/26 00:03:58 tom Exp $
3 
4 . ./setup-vars
5 
6 . ./setup-edit
7 
8 count=0
9 ls -1 | while true
10 do
11 	read filename
12 	test -z "$filename" && break
13 	case $filename in
14 	*.*)
15 		state=off
16 		;;
17 	*-*)
18 		state=on
19 		;;
20 	*)
21 		continue
22 		;;
23 	esac
24 	case "x$DIALOGOPTS" in
25 	*--no-items*|*--noitem*)
26 		echo "$filename $state" >>$input
27 		;;
28 	*)
29 		echo "$count $filename $state" >>$input
30 		;;
31 	esac
32 	count=`expr $count + 1`
33 done
34 
35 $DIALOG --title "BUILDLIST DEMO" --backtitle "A user-built list" \
36 	--visit-items --scrollbar --separator "|" \
37 	--buildlist "hello, this is a --buildlist..." 0 0 10 `cat "$input"` 2> $output
38 
39 returncode=$?
40 
41 tempfile=$output
42 . ./report-tempfile
43