git: 84823cc70824 - main - contrib/bsddialog: Import version 0.4
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 25 Sep 2022 13:09:45 UTC
The branch main has been updated by asiciliano: URL: https://cgit.FreeBSD.org/src/commit/?id=84823cc70824c8d842f503d8c2e6d7b0c2d95b61 commit 84823cc70824c8d842f503d8c2e6d7b0c2d95b61 Merge: 57338837aef5 9f24fda5a8e7 Author: Alfonso S. Siciliano <asiciliano@FreeBSD.org> AuthorDate: 2022-09-25 13:07:29 +0000 Commit: Alfonso S. Siciliano <asiciliano@FreeBSD.org> CommitDate: 2022-09-25 13:09:16 +0000 contrib/bsddialog: Import version 0.4 Improvements and changes to integrate bsddialog(1) with scripts in BASE. Overview: * New options. --and-widget, --keep-tite, --calendar. * Change output format. Menus and --print-maxsize. * Redefine sizing. Fixed rows, cols and menurows became at the most. * Add DIAGNOSTICS. Error messages for bad arguments and options. * Add keys. Space for --menu, fast keys for --msgbox and --yesno. * Text. Change default text modification, add --cr-wrap. See /usr/src/contrib/bsddialog/CHANGELOG '2022-09-24 Version 0.4' for more detailed information. Merge commit '9f24fda5a8e7ab8243e71473c7e2dc98b4877e64' contrib/bsddialog/.gitignore | 27 +- contrib/bsddialog/CHANGELOG | 70 +- contrib/bsddialog/GNUMakefile | 4 +- contrib/bsddialog/Makefile | 4 +- contrib/bsddialog/README.md | 26 +- contrib/bsddialog/bsddialog.1 | 170 +-- contrib/bsddialog/bsddialog.c | 1353 ++++++++++++++---------- contrib/bsddialog/examples_library/calendar.c | 55 + contrib/bsddialog/examples_library/compile | 2 +- contrib/bsddialog/examples_library/form.c | 4 +- contrib/bsddialog/examples_utility/calendar.sh | 34 + contrib/bsddialog/examples_utility/timebox.sh | 3 +- contrib/bsddialog/lib/GNUMakefile | 10 +- contrib/bsddialog/lib/Makefile | 6 +- contrib/bsddialog/lib/barbox.c | 2 +- contrib/bsddialog/lib/bsddialog.3 | 33 +- contrib/bsddialog/lib/bsddialog.h | 10 +- contrib/bsddialog/lib/calendarbox.c | 520 +++++++++ contrib/bsddialog/lib/formbox.c | 29 +- contrib/bsddialog/lib/lib_util.c | 14 +- contrib/bsddialog/lib/lib_util.h | 3 + contrib/bsddialog/lib/libbsddialog.c | 4 +- contrib/bsddialog/lib/menubox.c | 50 +- contrib/bsddialog/lib/messagebox.c | 42 +- contrib/bsddialog/lib/theme.c | 1 - contrib/bsddialog/lib/timebox.c | 20 +- contrib/bsddialog/util_theme.c | 79 +- contrib/bsddialog/util_theme.h | 7 +- lib/libbsddialog/Makefile | 1 + usr.bin/bsddialog/Makefile | 4 +- 30 files changed, 1737 insertions(+), 850 deletions(-) diff --cc contrib/bsddialog/.gitignore index 10a6663fbb47,000000000000..8b8ec9d4ae0b mode 100644,000000..100644 --- a/contrib/bsddialog/.gitignore +++ b/contrib/bsddialog/.gitignore @@@ -1,29 -1,0 +1,24 @@@ +bsddialog ++.depend* +*.o - *~ ++*.so* +*.a - examples_library/buildlist ++*.gz ++*.core ++*~ ++BSDDIALOG.geany ++BSDDIALOG.tags ++examples_library/calendar +examples_library/checklist +examples_library/datebox +examples_library/form - examples_library/formw - examples_library/margin ++examples_library/infobox +examples_library/menu +examples_library/mixedlist - examples_library/radiolist - examples_library/theme - examples_library/treeview - examples_library/infobox +examples_library/msgbox +examples_library/pause ++examples_library/radiolist +examples_library/rangebox - examples_library/sade ++examples_library/theme +examples_library/timebox +examples_library/yesno - examples_library/u_msgbox - *.gz - lib/libbsddialog.so* - BSDDIALOG.geany - BSDDIALOG.tags - *.core - freebsd-lab/ diff --cc contrib/bsddialog/Makefile index 344233581d30,000000000000..28162c5e90b3 mode 100644,000000..100644 --- a/contrib/bsddialog/Makefile +++ b/contrib/bsddialog/Makefile @@@ -1,50 -1,0 +1,50 @@@ +# PUBLIC DOMAIN - NO WARRANTY, see: +# <http://creativecommons.org/publicdomain/zero/1.0/> +# +# Written in 2021 by Alfonso Sabato Siciliano + +OUTPUT= bsddialog +SOURCES= bsddialog.c util_theme.c +OBJECTS= ${SOURCES:.c=.o} +LIBPATH= ${.CURDIR}/lib +LIBBSDDIALOG= ${LIBPATH}/libbsddialog.so + - CFLAGS+= -I${LIBPATH} -std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter ++CFLAGS+= -I${LIBPATH} -std=gnu99 -Wall -Wextra -Werror +# `make -DDEBUG` +.if defined(DEBUG) +CFLAGS= -g -Wall -I${LIBPATH} +LIBDEBUG= -DDEBUG +.endif - LDFLAGS+= -Wl,-rpath=${LIBPATH} -L${LIBPATH} -lbsddialog ++LDFLAGS+= -ltinfow -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}: + 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 016995b232ae,000000000000..59af7072e7f5 mode 100644,000000..100644 --- a/contrib/bsddialog/README.md +++ b/contrib/bsddialog/README.md @@@ -1,132 -1,0 +1,120 @@@ - # BSDDialog 0.3 ++# BSDDialog 0.4 + +This project provides **bsddialog** and **libbsddialog**, an utility +and a library to build scripts and tools with TUI dialogs and widgets. - - - ## Intro - - Briefly: - <https://www.freebsd.org/status/report-2021-04-2021-06/bsddialog/> - - 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> ++[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 +``` + +Linux: + +``` +% git clone https://gitlab.com/alfix/bsddialog.git +% cd bsddialog +% make -f GNUMakefile +% ./bsddialog --msgbox "Hello World!" 8 20 +``` + +Output: + +![screenshot](screenshot.png) + + +## Utility + +**Dialogs:** + - --checklist, --datebox, --form, --gauge, --inputbox, --menu, --mixedform, - --mixedgauge, --msgbox, --passwordbox, --passwordform, --pause, --radiolist, - --rangebox, --textbox, --timebox, --treeview, --yesno. ++--calendar, --checklist, --datebox, --form, --gauge, --infobox, --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 --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 [Examples](https://gitlab.com/alfix/bsddialog/-/tree/main/examples_utility) +in the _Public Domain_ to build new projects: +``` ++% sh ./examples_utility/calendar.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/pause.sh +% sh ./examples_utility/radiolist.sh +% sh ./examples_utility/timebox.sh +% sh ./examples_utility/yesno.sh +``` + +## 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 ++% ./calendar +% ./checklist +% ./datebox +% ./form +% ./infobox +% ./menu +% ./mixedlist +% ./msgbox +% ./pause +% ./radiolist +% ./rangebox +% ./theme +% ./timebox +% ./yesno +``` + + +## TODO and Ideas + + - menubar feature + - key callback + - Right-To-Left text diff --cc contrib/bsddialog/examples_library/calendar.c index 000000000000,33e38c69a81b..33e38c69a81b mode 000000,100644..100644 --- a/contrib/bsddialog/examples_library/calendar.c +++ b/contrib/bsddialog/examples_library/calendar.c diff --cc contrib/bsddialog/examples_utility/calendar.sh index 000000000000,a7ce4f1bb1d5..a7ce4f1bb1d5 mode 000000,100644..100644 --- a/contrib/bsddialog/examples_utility/calendar.sh +++ b/contrib/bsddialog/examples_utility/calendar.sh diff --cc contrib/bsddialog/lib/Makefile index 5c535c5483f1,000000000000..0f536fb38743 mode 100644,000000..100644 --- a/contrib/bsddialog/lib/Makefile +++ b/contrib/bsddialog/lib/Makefile @@@ -1,75 -1,0 +1,75 @@@ +# PUBLIC DOMAIN - NO WARRANTY, see: +# <http://creativecommons.org/publicdomain/zero/1.0/> +# +# Written in 2021 by Alfonso Sabato Siciliano + - VERSION = 0.3 ++VERSION = 0.4 +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 ++SOURCES = barbox.c calendarbox.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 += -D_XOPEN_SOURCE_EXTENDED -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 -lncursesw -ltinfow + +.if defined(DEBUG) +# `make -DDEBUG` +CFLAGS = -g -D_XOPEN_SOURCE_EXTENDED -fPIC -Wall -Wextra +.else +CFLAGS += -std=gnu99 -fstack-protector-strong +.endif + +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 = ${LOCALBASE}/share/man/man3 +INSTALL = install +RM = rm -f + +all : man ${LIBRARY} + +${LIBRARY}: ${LIBRARY_SO} ${LIBRARY_A} + +${LIBRARY_SO}.${VERSION}: ${OBJECTS} + ${CC} ${LDFLAGS} ${.ALLSRC} -o ${LIBRARY_SO}.${VERSION} + +${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 ${LIBRARY_A} + + +install: + ${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 ${MANDIR} + +unistall: + ${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 contrib/bsddialog/lib/calendarbox.c index 000000000000,3b55b26a13b8..3b55b26a13b8 mode 000000,100644..100644 --- a/contrib/bsddialog/lib/calendarbox.c +++ b/contrib/bsddialog/lib/calendarbox.c diff --cc lib/libbsddialog/Makefile index 08e5bebcb6a5,000000000000..ddb7e08f71ba mode 100644,000000..100644 --- a/lib/libbsddialog/Makefile +++ b/lib/libbsddialog/Makefile @@@ -1,27 -1,0 +1,28 @@@ +BSDDIALOG= ${SRCTOP}/contrib/bsddialog + +.PATH: ${BSDDIALOG}/lib + +LIB= bsddialog +PRIVATELIB= yes +SHLIB_MAJOR= 0 +SRCS= barbox.c \ ++ calendarbox.c \ + formbox.c \ + infobox.c \ + lib_util.c \ + lib_util.h \ + libbsddialog.c \ + menubox.c \ + messagebox.c \ + textbox.c \ + theme.c \ + timebox.c +INCS= bsddialog.h \ + bsddialog_theme.h \ + bsddialog_progressview.h +MAN= bsddialog.3 + +LIBADD= ncursesw tinfow formw +CFLAGS+= -D_XOPEN_SOURCE_EXTENDED + +.include <bsd.lib.mk> diff --cc usr.bin/bsddialog/Makefile index 06d086a51adc,000000000000..1c2f9d697e97 mode 100644,000000..100644 --- a/usr.bin/bsddialog/Makefile +++ b/usr.bin/bsddialog/Makefile @@@ -1,12 -1,0 +1,10 @@@ +BSDDIALOG= ${SRCTOP}/contrib/bsddialog +.PATH: ${BSDDIALOG} + +PROG= bsddialog +SRCS= bsddialog.c util_theme.c +MAN= bsddialog.1 +CFLAGS+= -I${BSDDIALOG}/lib - LIBADD= bsddialog - - WARNS= 3 ++LIBADD= bsddialog tinfow + +.include <bsd.prog.mk>