xref: /freebsd/contrib/dialog/samples/buildlist2 (revision 1c05a6ea6b849ff95e539c31adea887c644a6a01)
1#!/bin/sh
2# $Id: buildlist2,v 1.6 2012/12/23 22:28:12 tom Exp $
3
4. ./setup-vars
5
6. ./setup-edit
7
8count=0
9ls -1 | while true
10do
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`
33done
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
39retval=$?
40
41tempfile=$output
42. ./report-tempfile
43