xref: /freebsd/contrib/bsddialog/examples_utility/datebox.sh (revision 257405d707d77bc55b38e7c2bb83b8a9247a86ae)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2023 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
17DATE=$(./bsddialog --title " datebox " --date-format "%x" \
18	--datebox "Hello World!" 9 30 \
193>&1 1>&2 2>&3 3>&-)
20
21case $? in
22	$BSDDIALOG_ERROR )
23		exit 1
24	;;
25	$BSDDIALOG_ESC )
26		echo "[ESC]"
27	;;
28	$BSDDIALOG_CANCEL )
29		echo "[Cancel]"
30	;;
31	$BSDDIALOG_OK )
32		echo "[OK] $DATE"
33	;;
34esac
35