xref: /freebsd/contrib/bsddialog/examples_utility/passwordform.sh (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
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:  1  1  ""  1  12  18  25 \
20	Password2:  2  1  ""  2  12  18  25 \
21	Password3:  3  1  ""  3  12  18  25 \
22	Password4:  4  1  ""  4  12  18  25 \
23	Password5:  5  1  ""  5  12  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