bsddialog 0.4 and LGPL-Free bsdinstall

Posted on October 2, 2022

The bsddialog project provides bsddialog and libbsddialog, an utility and a library to build TUI dialogs and widgets. The version 0.4 is out!

This release provides mainly new features and changes to integrate bsddialog (utility) with scripts in FreeBSD BASE system. Finally, it is possible to install FreeBSD using BSD-Like licensed tools/code only (at least like a proof of concept).

CHANGELOG:

2022-09-24 Version 0.4

	Utility:
	* add: --normal-screen to set normal mode.
	* add: --alternate-screen to set alternate mode.
	* add: --keep-tite as --alternate-screen alias.
	* add: --and-dialog to build other dialogs.
	* add: --and-widget as --and-dialog alias.
	* add: --no-names (--no-tags becames its alias).
	* add: --no-descriptions (--no-items becames its alias).
	* add: --help-print-name (--help-tags becames its alias).
	* add: --item-bottom-desc (--item-help becames its alias).
	* add: --cr-wrap (was partially implemented) to keep '\n' with "\n".
	* add: --text-unchanged to avoid default modification.
	* add: --tab-escape enables "\t" in text.
	* add: --clear-screen to clear the screen.
	* add: --clear-dialog to clear the dialog (was --clear).
	* add: --calendar dialog to select a date.
	* add: DIAGNOSTICS messages for bad arguments number.
	* add: DIAGNOSTICS messages for missing and unexpected options.
	* change: --clear becames alias for --clear-screen.
	* change: --print-maxsize format output.
	* change: --menu, --radiolist, --checklist and --treeview output.
	    - no printed items with Cancel or ESC.
	    - --separator prints <sepstr> before each item except HELP.
	    - --separator and --separate-output print <sepstr> after each item.
	    - quoted item name/desc only when needed.
	    - --menu avoids to print selected item after focused HELP item.
	* change: text default modification.
	    - without a "\n": '\t' -> space, '\n' -> '\n', trim spaces.
	    - with a "\n": '\t' -> space, '\n' -> space, "\n" -> '\n', no trim.
	    - delete '\n' after "\n" (also with --cr-wrap).
	* change: --datebox input and output format yy/mm/dd -> dd/mm/yy.
	* delete: --no-collapse (partially implemented).
	* delete: --no-nl-expand (partially implemented).
	* delete: --trim (partially implemented).

	Library:
	* add: bsddialog_msgbox() HOME, END, PPAGE and NPAGE keys.
	* add: bsddialog_yesno() HOME, END, PPAGE and NPAGE keys.
	* add: bsddialog_menu() SPACE key (equivalent to ENTER).
	* add: bsddialog_calendar() to select a date.
	* change: rename enum bsddialog_grouptype -> enum bsddialog_menutype.
	* change: fixed-menurows becames at most menurows (depending on text).
	* change: fixed-rows becames at most rows, min(rows, screenH - shadow).
	* change: fixed-cols becames at most cols, min(cols, screenW - shadow).
	* delete: undocumented internal bsddialog_menuitem.depth factor (was 2).

Actually, version 0.4 is the completion of the integration process started with by the version 0.3 mainly in the library: cols/rows ratio, dynamic buttons margin, multi-column characters, form refactoring, etc.

2022-08-29 Version 0.3

	Utility:
	* add: --textbox accepts options for the first button.
	* add: --columns-per-row for text autosizing.
	* add: --load-theme to read and set a custom theme at runtime.
	* add: --save-theme to save current theme.
	* add: --bikeshed for random settings.
	* add: --switch-buttons to enable buttons/input widgets focus switching.
	       Available for: --form, --inputbox, --mixedform, --passwordform,
	       --passwordbox, --timebox and --datebox.
	* change: rename --esc-cancelvalue to --esc-return-cancel.
	* change: form field value is printed like multibyte charachter string,
	          previously widechar string.
	* change: --timebox output with zero padding.
	* change: --datebox output mm and dd with zero padding.
	* fix: --hline with empty string.
	* fix: avoid to overlay the backtitle by setting a top margin.
	* fix: avoid to overlay down shadow with menus and forms bottomdesc
	       by setting a down margin.
	* fix: --form read-only flag with multiple fields.

	Library:
	* add: conf.auto_topmargin and conf.auto_downmargin.
	* add: bsddialog_textbox() accepts conf.button.* for the first button.
	* add: bsddialog_textbox() arrows and percentage.
	* add: conf.text.cols_per_row to set a ratio for text autosizing.
	* add: timebox and datebox arrows and focus background for boxes.
	* add: timebox and datebox UP key to switch focus.
	* add: bsddialog_init_notheme() in bsddialog.h.
	* add: bsddialog_hascolors() in bsddialog_theme.h.
	* add: theme.form.bottomdesccolor and theme.menu.bottomdesccolor.
	* add: conf.button.always_active to disable buttons/input-boxes switch.
	* add: dynamic buttons margin.
	    - add: theme.button.minmargin and theme.button.maxmargin.
	    - delete: theme.button.hmargin.
	* add: Unicode.
	    - UI handles multicolumn charachters: backtitle, title,
	      text (word wrapping, autosizing), menus (shortcuts, name, desc),
	      forms (label, field), textbox, mixedgauge (minilabel),
	      buttons (label, shortcuts), bottomtitle.
	    - API handles char* arguments like multibyte charachter string,
	      depending on the current locale.
	    - Internally wide charachters are used to get input from keyboard
	      and to adapt word wrapping and dynamic text autosizing to
	      muticolumn charachters.
	* refactoring: (rewrite) form.c.
	    - delete: libformw dep implementing its features from scratch.
	    - delete: maxvaluelen >= valuelen constraint.
	    - delete: conf.form.enable_wchar, get always unicode (wchar) input.
	    - add: KEY_HOME, KEY_END, KEY_PPAGE, KEY_NPAGE keys in field.
	    - add: KEY_UP can move focus from buttons to fields.
	    - add: KEY_DOWN can move focus from item to buttons, if nitem is 1.
	    - add: conf.form.securembch secure multibyte charachter.
	    - add: BSDDIALOG_FIELDNOCOLOR for formitem.flags.
	    - add: BSDDIALOG_FIELDCURSOREND for formitem.flags.
	    - add: BSDDIALOG_FIELDEXTEND for formitem.flags.
	    - add: BSDDIALOG_FIELDSINGLEBYTE for formitem.flags.
	    - add: resizing and refresh after KEY_RESIZE (SIGWINCH).
	    - add: items scrolling.
	    - add: conf.form.value_wchar, value is wchar_t* instead of MB-char*.
	    - add: formheight autosizing.
	    - add: dynamic item position.
	* fix: bsddialog_gauge() with fd < 0.
	* fix: bsddialog_gauge() refresh new text.
	* fix: internal segmentation fault with disabled shadow.
	* fix: center position without shadow.
	* fix: bsddialog_infobox() with zero text length.
	* fix: text wrapping with more than 1024 words.
	* fix: rename theme.shadow.h to theme.shadow.y.
	* fix: rename theme.shadow.w to theme.shadow.x.
	* fix: menurows autosize with fixed rows improving text_size().
	* fix: messagebox.c scrolling and checksize without text.

The version 0.4 is already in FreeBSD, it changed the utility heavily. The version 0.3 modified some well tested structural code in the library (mainly word wrapping and text auto-sizing). So I need a while to test and to change the OS to use the new features. Actually the changes are small and very simple but they are used by tens of thousands of lines of code, so again I need a while to test.

However, I changed the last CURRENT iso FreeBSD-14.0-CURRENT-amd64-20220930-42dc8696df5-258315-bootonly.iso to test bsddialog and bsdinstall with bhyve on my laptop. The result is: It is possible to install FreeBSD using BSD-Like licensed code only!

Some screenshot:

Partitioning:

Extract BASE items:

Select Date:

Complete installation!


To know more: