git: 263660c061ac - main - bsddialog: import version 0.1

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Fri, 28 Jan 2022 08:56:44 UTC
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=263660c061ac76d449cbca7bdd0db2ecdfad76d9

commit 263660c061ac76d449cbca7bdd0db2ecdfad76d9
Merge: ddf162d1d15f 02db4a1234b3
Author:     Alfonso Siciliano <alfsiciliano@gmail.com>
AuthorDate: 2022-01-28 08:25:38 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2022-01-28 08:56:21 +0000

    bsddialog: import version 0.1
    
    Import bsddialog 0.1 Utility and Library, fully refatorized, API stable,
    manuals completed, easier to maintain and improve.
    
    Update deps for new API:
    add mixedgauge consts, delete __DECONST and add bsddialog_geterror()
    info to avoid silent errors
    
    * tzsetup
    * kbdmap
    * distextract
    
    Differential Revision:  https://reviews.freebsd.org/D34066

 contrib/bsddialog/GNUMakefile                      |    6 +-
 contrib/bsddialog/LICENSE                          |    2 +-
 contrib/bsddialog/Makefile                         |   25 +-
 contrib/bsddialog/README.md                        |  159 +--
 contrib/bsddialog/bsddialog.1                      |  590 +++++++++-
 contrib/bsddialog/bsddialog.c                      | 1152 ++++++++++----------
 contrib/bsddialog/examples_library/buildlist.c     |   44 -
 contrib/bsddialog/examples_library/checklist.c     |   41 +-
 contrib/bsddialog/examples_library/compile         |   15 +-
 contrib/bsddialog/examples_library/datebox.c       |   18 +-
 contrib/bsddialog/examples_library/form.c          |   34 +-
 contrib/bsddialog/examples_library/infobox.c       |   21 +-
 contrib/bsddialog/examples_library/menu.c          |   38 +-
 contrib/bsddialog/examples_library/mixedlist.c     |   47 +-
 contrib/bsddialog/examples_library/msgbox.c        |   32 +-
 contrib/bsddialog/examples_library/pause.c         |   16 +-
 contrib/bsddialog/examples_library/radiolist.c     |   38 +-
 contrib/bsddialog/examples_library/rangebox.c      |   20 +-
 contrib/bsddialog/examples_library/sade.c          |   56 -
 contrib/bsddialog/examples_library/theme.c         |   57 +-
 contrib/bsddialog/examples_library/timebox.c       |   18 +-
 contrib/bsddialog/examples_library/treeview.c      |   46 -
 contrib/bsddialog/examples_library/yesno.c         |   25 +-
 contrib/bsddialog/examples_utility/buildlist.sh    |   17 -
 contrib/bsddialog/examples_utility/checklist.sh    |    4 +-
 contrib/bsddialog/examples_utility/form.sh         |   12 +-
 contrib/bsddialog/examples_utility/gauge.sh        |   32 +-
 contrib/bsddialog/examples_utility/infobox.sh      |    5 +-
 contrib/bsddialog/examples_utility/inputbox.sh     |    4 +-
 contrib/bsddialog/examples_utility/menu.sh         |   14 +-
 contrib/bsddialog/examples_utility/mixedform.sh    |    8 +-
 contrib/bsddialog/examples_utility/mixedgauge.sh   |   42 +-
 contrib/bsddialog/examples_utility/msgbox.sh       |    4 +-
 contrib/bsddialog/examples_utility/passwordbox.sh  |    2 +-
 contrib/bsddialog/examples_utility/passwordform.sh |   12 +-
 contrib/bsddialog/examples_utility/radiolist.sh    |   14 +-
 contrib/bsddialog/examples_utility/treeview.sh     |   14 +-
 contrib/bsddialog/examples_utility/yesno.sh        |    4 +-
 contrib/bsddialog/lib/GNUMakefile                  |    8 +-
 contrib/bsddialog/lib/Makefile                     |   74 +-
 contrib/bsddialog/lib/barbox.c                     |  571 +++++-----
 contrib/bsddialog/lib/bsddialog.3                  |  809 +++++++++++---
 contrib/bsddialog/lib/bsddialog.h                  |  182 ++--
 contrib/bsddialog/lib/bsddialog_progressview.h     |   20 +-
 contrib/bsddialog/lib/bsddialog_theme.h            |   23 +-
 contrib/bsddialog/lib/formbox.c                    |  255 ++---
 contrib/bsddialog/lib/infobox.c                    |   93 +-
 contrib/bsddialog/lib/lib_util.c                   |  755 ++++++++-----
 contrib/bsddialog/lib/lib_util.h                   |   86 +-
 contrib/bsddialog/lib/libbsddialog.c               |   37 +-
 contrib/bsddialog/lib/menubox.c                    | 1079 +++++++-----------
 contrib/bsddialog/lib/messagebox.c                 |  237 ++--
 contrib/bsddialog/lib/textbox.c                    |  164 ++-
 contrib/bsddialog/lib/theme.c                      |   48 +-
 contrib/bsddialog/lib/timebox.c                    |  343 +++---
 usr.sbin/bsdinstall/distextract/distextract.c      |   56 +-
 usr.sbin/kbdmap/kbdmap.c                           |   24 +-
 usr.sbin/tzsetup/tzsetup.c                         |   11 +-
 58 files changed, 4045 insertions(+), 3518 deletions(-)

diff --cc contrib/bsddialog/Makefile
index 295aa927e4c5,000000000000..2abfb9e27cd7
mode 100644,000000..100644
--- a/contrib/bsddialog/Makefile
+++ b/contrib/bsddialog/Makefile
@@@ -1,49 -1,0 +1,56 @@@
- # Any copyright is dedicated to the Public Domain, see:
++# PUBLIC DOMAIN - NO WARRANTY, see:
 +#     <http://creativecommons.org/publicdomain/zero/1.0/>
 +#
- # Written by Alfonso Sabato Siciliano
++# Written in 2021 by Alfonso Sabato Siciliano
 +
 +OUTPUT=  bsddialog
 +SOURCES= bsddialog.c
 +OBJECTS= ${SOURCES:.c=.o}
 +LIBPATH= ${.CURDIR}/lib
 +LIBBSDDIALOG= ${LIBPATH}/libbsddialog.so
 +
- CFLAGS= -Wall -I${LIBPATH}
- LDFLAGS= -Wl,-rpath=${LIBPATH} -L${LIBPATH} -lbsddialog
++CFLAGS+= -I${LIBPATH} -std=gnu99 -Wno-format-zero-length \
++-fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W \
++-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
++-Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int \
++-Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value \
++-Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion \
++-Wno-unused-local-typedef -Wno-address-of-packed-member -Qunused-arguments
++# `make -DDEBUG`
++.if defined(DEBUG)
++CFLAGS= -g -Wall -I${LIBPATH}
++LIBDEBUG= -DDEBUG
++.endif
++LDFLAGS+= -Wl,-rpath=${LIBPATH} -L${LIBPATH} -lbsddialog
 +
 +BINDIR= /usr/local/bin
 +MAN= ${OUTPUT}.1
 +GZIP= gzip -cn
 +MANDIR= /usr/local/share/man/man1
 +
 +INSTALL= install
 +RM= rm -f
 +
 +all : ${OUTPUT}
 +
 +${OUTPUT}: ${LIBBSDDIALOG} ${OBJECTS}
 +	${CC} ${LDFLAGS} ${OBJECTS} -o ${.PREFIX}
 +
 +${LIBBSDDIALOG}:
- .if defined(PORTNCURSES)
- 	make -C ${LIBPATH} -DPORTNCURSES
- .else
- 	make -C ${LIBPATH}
- .endif
++	make -C ${LIBPATH} ${LIBDEBUG}
 +
 +.c.o:
 +	${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 +
 +install:
 +	${INSTALL} -s -m 555 ${OUTPUT} ${BINDIR}
 +	${GZIP} ${MAN} > ${MAN}.gz
 +	${INSTALL} -m 444 ${MAN}.gz ${MANDIR}
 +
 +unistall:
 +	${RM} ${BINDIR}/${OUTPUT}
 +	${RM} ${MANDIR}/${MAN}.gz
 +
 +clean:
 +	make -C ${LIBPATH} clean
 +	${RM} ${OUTPUT} *.o *~ *.core ${MAN}.gz
diff --cc contrib/bsddialog/README.md
index 31579f519ab6,000000000000..17af3a0db8e5
mode 100644,000000..100644
--- a/contrib/bsddialog/README.md
+++ b/contrib/bsddialog/README.md
@@@ -1,167 -1,0 +1,116 @@@
- # BSDDialog
++# BSDDialog 0.1
 +
- **Work In Progress!**
 +
 +This project provides **bsddialog** and **libbsddialog**, an utility and a
- library to build scripts and tools with *TUI Widgets*.
++library to build scripts and tools with TUI dialogs and widgets.
 +
- Description:
++
++## Intro
++
++Briefly:
 +<https://www.freebsd.org/status/report-2021-04-2021-06/#_bsddialog_tui_widgets>
 +
++Utility:
++<https://alfonsosiciliano.gitlab.io/posts/2021-12-07-bsddialog.html>
++
++Library:
++<https://alfonsosiciliano.gitlab.io/posts/2022-01-16-libbsddialog.html>
++
 +Screenshots:
 +<https://www.flickr.com/photos/alfonsosiciliano/albums/72157720215006074>
 +
 +
 +## Getting Started
 +
 +FreeBSD:
 +
 +```
 +% git clone https://gitlab.com/alfix/bsddialog.git
 +% cd bsddialog
 +% make
 +% ./bsddialog --msgbox "Hello World!" 8 20
 +```
 +
- If you are using XFCE install 
- [devel/ncurses](https://www.freshports.org/devel/ncurses/)
- 
- ```
- % sudo pkg install ncurses
- % git clone https://gitlab.com/alfix/bsddialog.git
- % cd bsddialog
- % make -DPORTNCURSES
- % ./bsddialog --msgbox "Hello World!" 8 20
- ```
- 
 +Output:
 +
 +![screenshot](screenshot.png)
 +
 +
- Examples utility:
++## Utility
++
++**Dialogs:**
++
++--checklist, --datebox, --form, --gauge, --inputbox, --menu, --mixedform,
++--mixedgauge, --msgbox, --passwordbox, --passwordform, --pause, --radiolist,
++--rangebox, --textbox, --timebox, --treeview, --yesno.
++
++**Manual**
++
++ - [bsddialog(1)](https://alfonsosiciliano.gitlab.io/posts/2022-01-26-manual-bsddialog.html)
++
++
++**Examples**:
++
 +```
- % ./bsddialog --title msgbox --msgbox "Hello World!" 5 30
- % ./bsddialog --theme default --title msgbox --msgbox "Hello World!" 5 30
- % ./bsddialog --begin-y 2 --title yesno --yesno "Hello World!" 5 30
- % ./bsddialog --ascii-lines --pause "Hello World!" 8 50 5
- % ./bsddialog --checklist "Space to select" 0 0 0 Name1 Desc1 off Name2 Desc2 on Name3 Desc3 off
- % ./bsddialog --backtitle "TITLE" --title yesno --hline "bsddialog" --yesno "Hello World!" 5 25
- % ./bsddialog --extra-button --help-button --defaultno --yesno "Hello World!" 0 0
++% ./bsddialog --backtitle "TITLE" --title msgbox --msgbox "Hello World!" 5 30
++% ./bsddialog --theme blackwhite --title msgbox --msgbox "Hello World!" 5 30
++% ./bsddialog --begin-y 2 --default-no --title yesno --yesno "Hello World!" 5 30
++% ./bsddialog --ascii-lines --pause "Hello World!" 8 50 10
++% ./bsddialog --checklist "Space to select" 0 0 0 Name1 Desc1 off Name2 Desc2 on
++% ./bsddialog --title yesno --hline "bsddialog" --yesno "Hello World!" 5 25
++% ./bsddialog --extra-button --help-button --yesno "Hello World!" 0 0
 +```
- and
++
++and [Examples](https://gitlab.com/alfix/bsddialog/-/tree/main/examples_utility)
++in the _Public Domain_ to build new projects:
 +```
- % sh ./examples_utility/buildlist.sh
 +% sh ./examples_utility/checklist.sh
 +% sh ./examples_utility/form.sh
 +% sh ./examples_utility/gauge.sh
 +% sh ./examples_utility/infobox.sh
 +% sh ./examples_utility/inputbox.sh
 +% sh ./examples_utility/menu.sh
 +% sh ./examples_utility/mixedform.sh
 +% sh ./examples_utility/mixedgauge.sh
 +% sh ./examples_utility/msgbox.sh
 +% sh ./examples_utility/passwordbox.sh
 +% sh ./examples_utility/passwordform.sh
 +% sh ./examples_utility/radiolist.sh
 +% sh ./examples_utility/treeview.sh
 +% sh ./examples_utility/yesno.sh
 +```
 +
- Examples library:
++## Library
++
++**API**
++
++ - [bsddialog.h](https://gitlab.com/alfix/bsddialog/-/blob/main/lib/bsddialog.h)
++ - [bsddialog\_theme.h](https://gitlab.com/alfix/bsddialog/-/blob/main/lib/bsddialog_theme.h)
++
++
++**Manual**
++
++ - [bsddialog(3)](https://alfonsosiciliano.gitlab.io/posts/2022-01-15-manual-libbsddialog.html)
++
++
++**Examples**:
++
++[Examples](https://gitlab.com/alfix/bsddialog/-/tree/main/examples_library)
++in the _Public Domain_ to build new projects:
 +```
 +% cd examples_library
 +% sh compile
- % ./buildlist
- % ./compile
 +% ./datebox
 +% ./form
 +% ./infobox
 +% ./menu
 +% ./mixedlist
 +% ./msgbox
 +% ./pause
 +% ./radiolist
 +% ./rangebox
- % ./sade
 +% ./theme
 +% ./timebox
- % ./treeview
 +% ./yesno
 +```
- 
- Use Cases:
- 
-  - [portconfig](https://gitlab.com/alfix/portconfig)
- 
- 
- ## Features
- 
- **Common Options:**
-  
- --ascii-lines, --aspect *ratio* (for infobox, msgbox and yesno),
- --backtitle *backtitle*, --begin-x *x* (--begin *y y*),
- (--begin *y x*), --cancel-label *string*, -clear (test with multiple widgets),
- --colors, --date-format *format*, --default-button *string*, --defaultno,
- --default-item *string*, 
- --exit-label *string*, --extra-button, --extra-label *string*,
- --hfile *filename* (for completed widgets), --help, --help-button,
- --help-label *string*, --help-status, --help-tags, --hline *string*, --ignore,
- --insecure, --item-help, --max-input *size*, --no-cancel, --nocancel,
- --no-label *string*, --no-items, --no-lines, --no-ok,
- --nook, --no-shadow, --no-tags, --ok-label *string*, --output-fd *fd*,
- --output-separator *string*, --print-version,
- --print-size (todo move lib -> utility), --quoted (quotes all != dialog),
- --print-maxsize, --shadow, --single-quoted (add --quote-with *ch*?), 
- --separator *string* (alias --output-separator *string*),
- --separate-output (rename --separate-output-withnl?), --sleep *secs*, --stderr,
- --stdout, --theme *string* ("bsddialog", "dialog", "blackwhite"),
- --time-format *format*, --title *title*, --version, --yes-label *string*.
- 
- **Widgets:**
 + 
-  infobox (do not clear the screen), msgbox,
-  yesno (dialog renames "yes/no" -> "ok/cancel" with --extra-button --help-button).
-  checklist, radiolist, menu, mixedlist, treeview, textbox, mixedgauge, datebox,
-  timebox, gauge, rangebox, pause.
- 
- 
-  Without resize:
- 
-  form, inputbox, mixedform, passwordbox, passwordform.
- 
- 
-  Without autosize, resize, F1:
- 
-  buildlist
- 
- 
- 
- ## TODO
- 
- 
- **Common Options:**
- 
- |  Option                      | Status      | Note                            |
- | ---------------------------- | ----------- | ------------------------------- |
- | --cr-wrap                    | In progress | text                            |
- | --no-collapse                | In progress | text                            |
- | --no-nl-expand               | In progress | text                            |
- | --trim                       | In progress | text                            |
- 
- 
- To evaluate / Not planned in the short term / not in bsdinstall:
- 
- --create-rc *file*, --iso-week, --no-mouse, --print-text-only *str h w*,
- --print-text-size *str h w*, --reorder, -scrollbar, --separate-widget *string*,
- --size-err, --timeout *secs*,--trace *filename*, --visit-items,
- --week-start *day*, --keep-tite, --keep-window, --last-key, --no-kill,
- --column-separator *string*, --input-fd *fd*, --tab-correct, --tab-len *n*
- 
- 
- **Widgets:**
- 
- To evaluate / Not planned in the short term:
- 
- tailbox (textbox/fseek), tailboxbg, dselect, fselect, inputmenu, editbox,
- calendar (use datebox), prgbox, programbox, progressbox.
diff --cc contrib/bsddialog/lib/Makefile
index e8f3ab6aae02,000000000000..d9f2ce8ed69b
mode 100644,000000..100644
--- a/contrib/bsddialog/lib/Makefile
+++ b/contrib/bsddialog/lib/Makefile
@@@ -1,76 -1,0 +1,76 @@@
- # Any copyright is dedicated to the Public Domain, see:
++# PUBLIC DOMAIN - NO WARRANTY, see:
 +#     <http://creativecommons.org/publicdomain/zero/1.0/>
 +#
 +# Written in 2021 by Alfonso Sabato Siciliano
 +
- VERSION = 0.0.2
++VERSION = 0.1
 +LIBRARY = bsddialog
 +LIBRARY_SO = lib${LIBRARY:=.so}
++LIBRARY_A = lib${LIBRARY:=.a}
 +HEADERS = bsddialog.h bsddialog_theme.h bsddialog_progressview.h
 +SOURCES = barbox.c formbox.c infobox.c libbsddialog.c lib_util.c menubox.c \
 +	messagebox.c textbox.c theme.c timebox.c
- OBJECTS= ${SOURCES:.c=.o}
- CFLAGS = -I/usr/local/include -fPIC -Wall -Wextra
- LDFLAGS = -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings \
- 	-Wl,--warn-shared-textrel -Wl,-soname,${LIBRARY_SO}.${VERSION} 
++OBJECTS = ${SOURCES:.c=.o}
++CFLAGS += -fPIC -Wall -Wextra
++LDFLAGS += -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings \
++	-Wl,--warn-shared-textrel -Wl,-soname,${LIBRARY_SO}.${VERSION} \
++	-L/usr/lib -lformw -lncursesw -ltinfow
 +
 +.if defined(DEBUG)
 +# `make -DDEBUG`
- CFLAGS += -g
++CFLAGS = -g -fPIC -Wall -Wextra
 +.else
 +CFLAGS += -O2 -pipe -std=gnu99 -Wno-format-zero-length \
 +	-fstack-protector-strong -Qunused-arguments
 +.endif
 +
- .if defined(PORTNCURSES)
- # PORT ncurses `make -DPORTNCURSES`
- CFLAGS += -DPORTNCURSES -I/usr/local/include
- LDFLAGS += -L/usr/local/lib -lformw -lncursesw -ltinfow
- .else
- # BASE ncurses
- LDFLAGS += -L/usr/lib -lformw -lncursesw -ltinfow
- .endif
- 
- INSTALL_PREFIX=/usr/local
++LOCALBASE = /usr/local
 +LN = ln -s -f
 +RM = rm -f
 +CP = cp
 +GZIP = gzip -cn
 +LDCONFIG = /sbin/ldconfig -m
- MAN= ${OUTPUT}.3
- GZIP= gzip -cn
- MANDIR= /usr/local/share/man/man3
- INSTALL= install
- RM= rm -f
++MAN = ${OUTPUT}.3
++GZIP = gzip -cn
++MANDIR = ${LOCALBASE}/share/man/man3
++INSTALL = install
++RM = rm -f
++
++all : man ${LIBRARY}
 +
- #all : man ${LIBRARY}
- all : ${LIBRARY}
++${LIBRARY}: ${LIBRARY_SO} ${LIBRARY_A}
 +
- ${LIBRARY}: ${OBJECTS}
++${LIBRARY_SO}.${VERSION}: ${OBJECTS}
 +	${CC} ${LDFLAGS} ${.ALLSRC} -o ${LIBRARY_SO}.${VERSION}
- 	# LN for devel
++
++${LIBRARY_SO}: ${LIBRARY_SO}.${VERSION}
 +	${LN} ${LIBRARY_SO}.${VERSION} ${LIBRARY_SO}
 +
++${LIBRARY_A}: ${OBJECTS}
++	${AR} cr ${.TARGET} ${OBJECTS}
++	${RANLIB} ${.TARGET}
++
 +.c.o:
 +	${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
 +
 +man:
 +	${GZIP} ${LIBRARY}.3 > ${LIBRARY}.3.gz
 +
 +clean:
- 	${RM} ${LIBRARY_SO}* *.o *~ *.gz
++	${RM} ${LIBRARY_SO}* *.o *~ *.gz ${LIBRARY_A}
 +
 +
 +install:
- 	${CP} ${LIBRARY}.h ${INSTALL_PREFIX}/include
- 	${CP} ${LIBRARY_SO}.${VERSION} ${INSTALL_PREFIX}/lib/
- 	${LN} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}.${VERSION} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}
- 	${LDCONFIG} ${INSTALL_PREFIX}/lib
- 	${CP} ${LIBRARY}.3.gz ${INSTALL_PREFIX}/man/man3/
++	${INSTALL} -m 644 ${HEADERS} ${LOCALBASE}/include
++	${INSTALL} -m 644 -s ${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/
++	${INSTALL} -l rs ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION} ${LOCALBASE}/lib/${LIBRARY_SO}
++	${INSTALL} -m 644 ${LIBRARY_A} ${LOCALBASE}/lib
++	${LDCONFIG} ${LOCALBASE}/lib
++	${INSTALL} -m 644 ${LIBRARY}.3.gz ${MNADIR}
 +
 +unistall:
- 	${RM} ${INSTALL_PREFIX}/include/${LIBRARY}.h
- 	${RM} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}
- 	${RM} ${INSTALL_PREFIX}/lib/${LIBRARY_SO}.${VERSION}
- 	${LDCONFIG} ${INSTALL_PREFIX}/lib
- 	${RM} ${INSTALL_PREFIX}/man/man3/${LIBRARY}.3.gz
++	${RM} ${LOCALBASE}/include/${LIBRARY}*.h
++	${RM} ${LOCALBASE}/lib/${LIBRARY_SO}
++	${RM} ${LOCALBASE}/lib/${LIBRARY_SO}.${VERSION}
++	${LDCONFIG} ${LOCALBASE}/lib
++	${RM} ${MANDIR}/${LIBRARY}.3.gz
diff --cc usr.sbin/bsdinstall/distextract/distextract.c
index df10c299ab7f,000000000000..fa3b52925dff
mode 100644,000000..100644
--- a/usr.sbin/bsdinstall/distextract/distextract.c
+++ b/usr.sbin/bsdinstall/distextract/distextract.c
@@@ -1,334 -1,0 +1,344 @@@
 +/*-
 + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 + *
 + * Copyright (c) 2011 Nathan Whitehorn
 + * Copyright (c) 2014 Devin Teske <dteske@FreeBSD.org>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + */
 +
 +#include <sys/cdefs.h>
 +__FBSDID("$FreeBSD$");
 +
 +#include <sys/param.h>
++
 +#include <archive.h>
 +#include <ctype.h>
 +#include <bsddialog.h>
 +#include <bsddialog_progressview.h>
 +#include <err.h>
 +#include <errno.h>
 +#include <limits.h>
 +#include <signal.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>
 +#include <unistd.h>
 +
 +/* Data to process */
 +static char *distdir = NULL;
 +static struct archive *archive = NULL;
 +
 +/* Function prototypes */
 +static void	sig_int(int sig);
 +static int	count_files(const char *file);
 +static int	extract_files(struct bsddialog_fileminibar *file);
 +
 +#define _errx(...) (bsddialog_end(), errx(__VA_ARGS__))
 +
 +int
 +main(void)
 +{
 +	char *chrootdir;
 +	char *distributions;
- 	unsigned int i;
++	char *path;
 +	int retval;
++	unsigned int i;
 +	size_t minibar_size = sizeof(struct bsddialog_fileminibar);
 +	size_t span;
 +	unsigned int nminibars;
 +	struct bsddialog_fileminibar *dists;
 +	struct bsddialog_progviewconf pvconf;
 +	struct bsddialog_conf conf;
 +	struct sigaction act;
 +	char error[PATH_MAX + 512];
 +
 +	if ((distributions = getenv("DISTRIBUTIONS")) == NULL)
 +		errx(EXIT_FAILURE, "DISTRIBUTIONS variable is not set");
 +	if ((distdir = getenv("BSDINSTALL_DISTDIR")) == NULL)
 +		distdir = __DECONST(char *, "");
 +
 +	if (bsddialog_init() == BSDDIALOG_ERROR)
- 		errx(EXIT_FAILURE, "Cannot init libbsdialog");
++		errx(EXIT_FAILURE, "Error libbsdialog: %s",
++		    bsddialog_geterror());
 +	bsddialog_initconf(&conf);
- 	bsddialog_backtitle(&conf, __DECONST(char *, "FreeBSD Installer"));
++	bsddialog_backtitle(&conf, "FreeBSD Installer");
 +	bsddialog_infobox(&conf,
- 	    __DECONST(char *, "Checking distribution archives.\n"
- 	    "Please wait..."), 4, 35);
++	    "Checking distribution archives.\nPlease wait...", 4, 35);
 +
 +	/* Parse $DISTRIBUTIONS */
 +	nminibars = 0;
 +	dists = NULL;
 +	while (*distributions != '\0') {
 +		span = strcspn(distributions, "\t\n\v\f\r ");
 +		if (span < 1) { /* currently on whitespace */
 +			distributions++;
 +			continue;
 +		}
 +
 +		/* Allocate a new struct for the distribution */
 +		dists = realloc(dists, (nminibars + 1) * minibar_size);
 +		if (dists == NULL)
 +			_errx(EXIT_FAILURE, "Out of memory!");
 +
 +		/* Set file path */
- 		if ((dists[nminibars].path = malloc(span + 1)) == NULL)
++		if ((path = malloc(span + 1)) == NULL)
 +			_errx(EXIT_FAILURE, "Out of memory!");
- 		snprintf(dists[nminibars].path, span + 1, "%s", distributions);
- 		dists[nminibars].path[span] = '\0';
++		snprintf(path, span + 1, "%s", distributions);
++		path[span] = '\0';
++		dists[nminibars].path = path;
 +
 +		/* Set mini bar label */
 +		dists[nminibars].label = strrchr(dists[nminibars].path, '/');
 +		if (dists[nminibars].label == NULL)
 +			dists[nminibars].label = dists[nminibars].path;
 +
 +		/* Set initial length in files (-1 == error) */
 +		dists[nminibars].size = count_files(dists[nminibars].path);
 +		if (dists[nminibars].size < 0) {
 +			bsddialog_end();
 +			return (EXIT_FAILURE);
 +		}
 +
- 		/* Set initial status to pending */
- 		/* dists[nminibars].status = 10; */
++		/* Set initial status and implicitly miniperc to pending */
++		dists[nminibars].status = BSDDIALOG_MG_PENDING;
 +
 +		/* Set initial read */
 +		dists[nminibars].read = 0;
 +
 +		distributions += span;
 +		nminibars += 1;
 +	}
 +
 +	/* Optionally chdir(2) into $BSDINSTALL_CHROOT */
 +	chrootdir = getenv("BSDINSTALL_CHROOT");
 +	if (chrootdir != NULL && chdir(chrootdir) != 0) {
 +		snprintf(error, sizeof(error),
 +		    "Could not change to directory %s: %s\n",
 +		    chrootdir, strerror(errno));
 +		conf.title = __DECONST(char *, "Error");
 +		bsddialog_msgbox(&conf, error, 0, 0);
 +		bsddialog_end();
 +		return (EXIT_FAILURE);
 +	}
 +
 +	/* Set cleanup routine for Ctrl-C action */
 +	act.sa_handler = sig_int;
 +	sigaction(SIGINT, &act, 0);
 +
- 	conf.title = __DECONST(char *, "Archive Extraction");
++	conf.title = "Archive Extraction";
++	conf.auto_minwidth = 40;
 +	pvconf.callback	= extract_files;
 +	pvconf.refresh = 1;
- 	pvconf.fmtbottomstr = __DECONST(char *, "%10lli files read @ %'9.1f files/sec.");
++	pvconf.fmtbottomstr = "%10lli files read @ %'9.1f files/sec.";
 +	bsddialog_total_progview = 0;
 +	bsddialog_interruptprogview = bsddialog_abortprogview = false;
 +	retval = bsddialog_progressview(&conf,
- 	    __DECONST(char *, "Extracting distribution files..."), 0, 0, &pvconf, nminibars, dists);
++	    "\nExtracting distribution files...\n", 0, 0,
++	    &pvconf, nminibars, dists);
++
++	if (retval == BSDDIALOG_ERROR) {
++		fprintf(stderr, "progressview error: %s\n",
++		    bsddialog_geterror());
++	}
 +
 +	bsddialog_end();
 +
- 	for (i=0; i<nminibars; i++) {
++	for (i = 0; i < nminibars; i++) {
 +		if (dists[i].path != NULL)
- 			free(dists[i].path);
++			free(__DECONST(char *, dists[i].path));
 +	}
 +	if (dists != NULL)
 +		free(dists);
 +
 +	return (retval);
 +}
 +
 +static void
 +sig_int(int sig __unused)
 +{
 +	bsddialog_interruptprogview = true;
 +}
 +
 +/*
 + * Returns number of files in archive file. Parses $BSDINSTALL_DISTDIR/MANIFEST
 + * if it exists, otherwise uses archive(3) to read the archive file.
 + */
 +static int
 +count_files(const char *file)
 +{
 +	static FILE *manifest = NULL;
 +	char *p;
 +	int file_count;
 +	int retval;
 +	size_t span;
 +	struct archive_entry *entry;
 +	char line[512];
 +	char path[PATH_MAX];
 +	char errormsg[PATH_MAX + 512];
 +	struct bsddialog_conf conf;
 +
 +	if (manifest == NULL) {
 +		snprintf(path, sizeof(path), "%s/MANIFEST", distdir);
 +		manifest = fopen(path, "r");
 +	}
 +
 +	if (manifest != NULL) {
 +		rewind(manifest);
 +		while (fgets(line, sizeof(line), manifest) != NULL) {
 +			p = &line[0];
 +			span = strcspn(p, "\t") ;
 +			if (span < 1 || strncmp(p, file, span) != 0)
 +				continue;
 +
 +			/*
 +			 * We're at the right manifest line. The file count is
 +			 * in the third element
 +			 */
 +			span = strcspn(p += span + (*p != '\0' ? 1 : 0), "\t");
 +			span = strcspn(p += span + (*p != '\0' ? 1 : 0), "\t");
 +			if (span > 0) {
 +				file_count = (int)strtol(p, (char **)NULL, 10);
 +				if (file_count == 0 && errno == EINVAL)
 +					continue;
 +				return (file_count);
 +			}
 +		}
 +	}
 +
 +	/*
 +	 * Either no manifest, or manifest didn't mention this archive.
 +	 * Use archive(3) to read the archive, counting files within.
 +	 */
 +	bsddialog_initconf(&conf);
 +	if ((archive = archive_read_new()) == NULL) {
 +		snprintf(errormsg, sizeof(errormsg),
 +		    "Error: %s\n", archive_error_string(NULL));
- 		conf.title = __DECONST(char *, "Extract Error");
++		conf.title = "Extract Error";
 +		bsddialog_msgbox(&conf, errormsg, 0, 0);
 +		return (-1);
 +	}
 +	archive_read_support_format_all(archive);
 +	archive_read_support_filter_all(archive);
 +	snprintf(path, sizeof(path), "%s/%s", distdir, file);
 +	retval = archive_read_open_filename(archive, path, 4096);
 +	if (retval != ARCHIVE_OK) {
 +		snprintf(errormsg, sizeof(errormsg),
 +		    "Error while extracting %s: %s\n", file,
 +		    archive_error_string(archive));
- 		conf.title = __DECONST(char *, "Extract Error");
++		conf.title = "Extract Error";
 +		bsddialog_msgbox(&conf, errormsg, 0, 0);
 +		archive = NULL;
 +		return (-1);
 +	}
 +
 +	file_count = 0;
 +	while (archive_read_next_header(archive, &entry) == ARCHIVE_OK)
 +		file_count++;
 +	archive_read_free(archive);
 +	archive = NULL;
 +
 +	return (file_count);
 +}
 +
 +static int
 +extract_files(struct bsddialog_fileminibar *file)
 +{
 +	int retval;
 +	struct archive_entry *entry;
 +	char path[PATH_MAX];
 +	char errormsg[PATH_MAX + 512];
 +	struct bsddialog_conf conf;
 +
 +	bsddialog_initconf(&conf);
 +
 +	/* Open the archive if necessary */
 +	if (archive == NULL) {
 +		if ((archive = archive_read_new()) == NULL) {
 +			snprintf(errormsg, sizeof(errormsg),
 +			    "Error: %s\n", archive_error_string(NULL));
- 			conf.title = __DECONST(char *, "Extract Error");
++			conf.title = "Extract Error";
 +			bsddialog_msgbox(&conf, errormsg, 0, 0);
 +			bsddialog_abortprogview = true;
 +			return (-1);
 +		}
 +		archive_read_support_format_all(archive);
 +		archive_read_support_filter_all(archive);
 +		snprintf(path, sizeof(path), "%s/%s", distdir, file->path);
 +		retval = archive_read_open_filename(archive, path, 4096);
 +		if (retval != 0) {
 +			snprintf(errormsg, sizeof(errormsg),
 +			    "Error opening %s: %s\n", file->label,
 +			    archive_error_string(archive));
- 			conf.title = __DECONST(char *, "Extract Error");
++			conf.title = "Extract Error";
 +			bsddialog_msgbox(&conf, errormsg, 0, 0);
- 			file->status = 1; /* Failed */
++			file->status = BSDDIALOG_MG_FAILED;
 +			bsddialog_abortprogview = true;
 +			return (-1);
 +		}
 +	}
 +
 +	/* Read the next archive header */
 +	retval = archive_read_next_header(archive, &entry);
 +
 +	/* If that went well, perform the extraction */
 +	if (retval == ARCHIVE_OK)
 +		retval = archive_read_extract(archive, entry,
 +		    ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_OWNER |
 +		    ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL |
 +		    ARCHIVE_EXTRACT_XATTR | ARCHIVE_EXTRACT_FFLAGS);
 +
 +	/* Test for either EOF or error */
 +	if (retval == ARCHIVE_EOF) {
 +		archive_read_free(archive);
 +		archive = NULL;
- 		file->status = 5; /*Done*/;
++		file->status = BSDDIALOG_MG_DONE; /*Done*/;
 +		return (100);
 +	} else if (retval != ARCHIVE_OK &&
 +	    !(retval == ARCHIVE_WARN &&
 +	    strcmp(archive_error_string(archive), "Can't restore time") == 0)) {
 +		/*
 +		 * Print any warning/error messages except inability to set
 +		 * ctime/mtime, which is not fatal, or even interesting,
 +		 * for our purposes. Would be nice if this were a libarchive
 +		 * option.
 +		 */
 +		snprintf(errormsg, sizeof(errormsg),
 +		    "Error while extracting %s: %s\n", file->label,
 +		    archive_error_string(archive));
- 		conf.title = __DECONST(char *, "Extract Error");
++		conf.title = "Extract Error";
 +		bsddialog_msgbox(&conf, errormsg, 0, 0);
- 		file->status = 1; /* Failed */
++		file->status = BSDDIALOG_MG_FAILED; /* Failed */
 +		bsddialog_abortprogview = true;
 +		return (-1);
 +	}
 +
 +	bsddialog_total_progview++;
 +	file->read++;
 +
 +	/* Calculate [overall] percentage of completion (if possible) */
 +	if (file->size >= 0)
 +		return (file->read * 100 / file->size);
 +	else
 +		return (-1);
 +}
diff --cc usr.sbin/kbdmap/kbdmap.c
index ef6e4812a3fc,000000000000..a11956b682ee
mode 100644,000000..100644
--- a/usr.sbin/kbdmap/kbdmap.c
+++ b/usr.sbin/kbdmap/kbdmap.c
@@@ -1,859 -1,0 +1,865 @@@
 +/*-
 + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 + *
 + * Copyright (c) 2002 Jonathan Belson <jon@witchspace.com>
 + * All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + */
 +
 +#include <sys/cdefs.h>
 +__FBSDID("$FreeBSD$");
 +
 +#include <sys/types.h>
 +#include <sys/queue.h>
 +#include <sys/sysctl.h>
 +
 +#include <assert.h>
 +#include <bsddialog.h>
 +#include <ctype.h>
 +#include <dirent.h>
 +#include <limits.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>
 +#include <stringlist.h>
 +#include <unistd.h>
 +
 +#include "kbdmap.h"
 +
 +
 +static const char *lang_default = DEFAULT_LANG;
 +static const char *font;
 +static const char *lang;
 +static const char *program;
 +static const char *keymapdir = DEFAULT_VT_KEYMAP_DIR;
 +static const char *fontdir = DEFAULT_VT_FONT_DIR;
 +static const char *font_default = DEFAULT_VT_FONT;
 +static const char *sysconfig = DEFAULT_SYSCONFIG;
 +static const char *font_current;
 +static const char *dir;
 +static const char *menu = "";
 +static const char *title = "Keyboard Menu";
 +
 +static int x11;
 +static int using_vt;
 +static int show;
 +static int verbose;
 +static int print;
 +
 +
 +struct keymap {
 +	char	*desc;
 +	char	*keym;
 +	int	mark;
 +	SLIST_ENTRY(keymap) entries;
 +};
 +static SLIST_HEAD(slisthead, keymap) head = SLIST_HEAD_INITIALIZER(head);
 +
 +
 +/*
 + * Get keymap entry for 'key', or NULL of not found
 + */
 +static struct keymap *
 +get_keymap(const char *key)
 +{
 +	struct keymap *km;
 +
 +	SLIST_FOREACH(km, &head, entries)
 +		if (!strcmp(km->keym, key))
 +			return km;
 +
 +	return NULL;
 +}
 +
 +/*
 + * Count the number of keymaps we found
 + */
 +static int
 +get_num_keymaps(void)
 +{
 +	struct keymap *km;
 +	int count = 0;
 +
 +	SLIST_FOREACH(km, &head, entries)
 +		count++;
 +
*** 1803 LINES SKIPPED ***