xref: /freebsd/contrib/bsddialog/examples_utility/passwordform.sh (revision e32fecd0c2c3ee37c47ee100f169e7eb0282a873)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2021 by Alfonso Sabato Siciliano.
6#
7# To the extent possible under law, the author has dedicated all copyright
8# and related and neighboring rights to this software to the public domain
9# worldwide. This software is distributed without any warranty, see:
10#	<http://creativecommons.org/publicdomain/zero/1.0/>.
11
12: ${BSDDIALOG_ERROR=255}
13: ${BSDDIALOG_OK=0}
14: ${BSDDIALOG_CANCEL=1}
15: ${BSDDIALOG_ESC=5}
16
17FORMS=$(./bsddialog --insecure --title " passwordform " \
18	--passwordform "Example" 12 40 5 \
19	Password1:  0  0  ""  0  11  18  25 \
20	Password2:  1  0  ""  1  11  18  25 \
21	Password3:  2  0  ""  2  11  18  25 \
22	Password4:  3  0  ""  3  11  18  25 \
23	Password5:  4  0  ""  4  11  18  25 \
243>&1 1>&2 2>&3 3>&-)
25
26case $? in
27	$BSDDIALOG_ERROR )
28		exit 1
29	;;
30	$BSDDIALOG_ESC )
31		echo "[ESC]"
32	;;
33	$BSDDIALOG_CANCEL )
34		echo "[Cancel]"
35	;;
36	$BSDDIALOG_OK )
37		echo "[OK]"
38	;;
39esac
40
41echo "$FORMS"
42