xref: /freebsd/contrib/dialog/samples/mixedform2 (revision a96ef4501919d7ac08e94e98dc34b0bdd744802b)
14c8945a0SNathan Whitehorn#! /bin/sh
2*a96ef450SBaptiste Daroussin# $Id: mixedform2,v 1.8 2020/11/26 00:26:50 tom Exp $
34c8945a0SNathan Whitehorn
44c8945a0SNathan Whitehorn. ./setup-vars
54c8945a0SNathan Whitehorn
64c8945a0SNathan Whitehornbacktitle="An Example for the use of --mixedform:"
74c8945a0SNathan Whitehornreturncode=0
84c8945a0SNathan Whitehornwhile test $returncode != 1 && test $returncode != 250
94c8945a0SNathan Whitehorndo
104c8945a0SNathan Whitehornreturncode=$?
114c8945a0SNathan Whitehornexec 3>&1
12*a96ef450SBaptiste Daroussinreturntext=`$DIALOG  --title "Mixed form demonstration" --ok-label "Submit" \
134c8945a0SNathan Whitehorn           --backtitle "$backtitle" \
144c8945a0SNathan Whitehorn	  --insecure "$@" \
154c8945a0SNathan Whitehorn	  --mixedform "Here is a possible piece of a configuration program." \
164c8945a0SNathan Whitehorn20 50 0 \
174c8945a0SNathan Whitehorn	"Username        :"	 1 1	"Kiran" 1 20 10 0 2 \
184c8945a0SNathan Whitehorn	"Password        :"      2 1	"pass"  2 20  8 0 3 \
194c8945a0SNathan Whitehorn	"Retype Password :"      3 1	"pass"  3 20  8 0 3 \
204c8945a0SNathan Whitehorn	"HOME            :"      4 1	"Cisco" 4 20 40 0 2 \
214c8945a0SNathan Whitehorn2>&1 1>&3`
224c8945a0SNathan Whitehornreturncode=$?
234c8945a0SNathan Whitehornexec 3>&-
24*a96ef450SBaptiste Daroussinshow=`echo "$returntext" |sed -e 's/^/	/'`
254c8945a0SNathan Whitehorn
264c8945a0SNathan Whitehorn	case $returncode in
274c8945a0SNathan Whitehorn	$DIALOG_CANCEL)
284c8945a0SNathan Whitehorn		"$DIALOG" \
294c8945a0SNathan Whitehorn		--clear \
304c8945a0SNathan Whitehorn		--backtitle "$backtitle" \
314c8945a0SNathan Whitehorn		--yesno "Really quit?" 10 30
324c8945a0SNathan Whitehorn		case $? in
334c8945a0SNathan Whitehorn		$DIALOG_OK)
344c8945a0SNathan Whitehorn			break
354c8945a0SNathan Whitehorn			;;
364c8945a0SNathan Whitehorn		$DIALOG_CANCEL)
374c8945a0SNathan Whitehorn			returncode=99
384c8945a0SNathan Whitehorn			;;
394c8945a0SNathan Whitehorn		esac
404c8945a0SNathan Whitehorn		;;
414c8945a0SNathan Whitehorn	$DIALOG_OK)
424c8945a0SNathan Whitehorn		"$DIALOG" \
434c8945a0SNathan Whitehorn		--clear \
444c8945a0SNathan Whitehorn		--backtitle "$backtitle" --no-collapse --cr-wrap \
454c8945a0SNathan Whitehorn		--msgbox "Resulting data:\n\
464c8945a0SNathan Whitehorn$show" 10 40
474c8945a0SNathan Whitehorn		;;
484c8945a0SNathan Whitehorn	*)
49*a96ef450SBaptiste Daroussin		. ./report-button
504c8945a0SNathan Whitehorn		exit
514c8945a0SNathan Whitehorn		;;
524c8945a0SNathan Whitehorn	esac
534c8945a0SNathan Whitehorndone
54