mirror of
https://github.com/opnsense/src.git
synced 2026-06-04 06:15:33 -04:00
New features overview: * Unicode. User interface handles multi-column characters. API can handle char* like a multibyte character string. Internally wide characters are used for keyboard input, to adapt word wrapping and dynamic text auto-sizing for multi-column characters. * Forms refactoring. Complete rewrite deleting libformw dependency. * Theme. New utility options to save and load custom theme at run-time. * TUI navigation. Added keys to navigate input components. Changed default focus behavior of input dialogs to be LGPL-dialog-like; a new option can set the previous whiptail-like behavior. See /usr/src/contrib/bsddialog/CHANGELOG '2022-08-29 Version 0.3' for more detailed information. Merge commit '2c9fd7655ba54e7239f528e1af9fe09662de9b03'
55 lines
No EOL
1.2 KiB
C
55 lines
No EOL
1.2 KiB
C
/*-
|
|
* SPDX-License-Identifier: CC0-1.0
|
|
*
|
|
* Written in 2021 by Alfonso Sabato Siciliano.
|
|
* To the extent possible under law, the author has dedicated all copyright
|
|
* and related and neighboring rights to this software to the public domain
|
|
* worldwide. This software is distributed without any warranty, see:
|
|
* <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
*/
|
|
|
|
#include <bsddialog.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
|
|
int main()
|
|
{
|
|
int output;
|
|
unsigned int yy, mm, dd;
|
|
struct bsddialog_conf conf;
|
|
time_t cal;
|
|
struct tm *localtm;
|
|
|
|
time(&cal);
|
|
localtm = localtime(&cal);
|
|
yy = localtm->tm_year + 1900;
|
|
mm = localtm->tm_mon + 1;
|
|
dd = localtm->tm_mday;
|
|
|
|
if (bsddialog_init() == BSDDIALOG_ERROR) {
|
|
printf("Error: %s\n", bsddialog_geterror());
|
|
return (1);
|
|
}
|
|
|
|
bsddialog_initconf(&conf);
|
|
conf.title = "datebox";
|
|
output = bsddialog_datebox(&conf, "Example", 9, 35, &yy, &mm, &dd);
|
|
|
|
bsddialog_end();
|
|
|
|
switch (output) {
|
|
case BSDDIALOG_OK:
|
|
printf("Date: %u/%u/%u", yy, mm, dd);
|
|
break;
|
|
case BSDDIALOG_CANCEL:
|
|
printf("Cancel");
|
|
break;
|
|
case BSDDIALOG_ERROR:
|
|
printf("Error: %s", bsddialog_geterror());
|
|
break;
|
|
}
|
|
printf("\n");
|
|
|
|
return (output);
|
|
} |