xref: /freebsd/contrib/bsddialog/examples_utility/calendar.sh (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2022 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 " calendar " --date-format "%x" \
18	--calendar "Hello World!" 20 40 \
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