xref: /freebsd/contrib/dialog/samples/buildlist2 (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
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
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
39returncode=$?
40
41tempfile=$output
42. ./report-tempfile
43