From dd6c2619b699c02eff496964203464b1ce19f942 Mon Sep 17 00:00:00 2001 From: tron Date: Tue, 26 May 1998 22:07:19 +0000 Subject: New "dialog" package supplied by Johnny C. Lam in PR pkg/4993. --- misc/dialog/Makefile | 27 ++++++++++++++++++++ misc/dialog/files/md5 | 1 + misc/dialog/patches/patch-aa | 59 ++++++++++++++++++++++++++++++++++++++++++++ misc/dialog/patches/patch-ab | 53 +++++++++++++++++++++++++++++++++++++++ misc/dialog/patches/patch-ac | 33 +++++++++++++++++++++++++ misc/dialog/patches/patch-ad | 14 +++++++++++ misc/dialog/patches/patch-ae | 24 ++++++++++++++++++ misc/dialog/patches/patch-af | 51 ++++++++++++++++++++++++++++++++++++++ misc/dialog/patches/patch-ag | 23 +++++++++++++++++ misc/dialog/patches/patch-ah | 14 +++++++++++ misc/dialog/patches/patch-ai | 55 +++++++++++++++++++++++++++++++++++++++++ misc/dialog/patches/patch-aj | 22 +++++++++++++++++ misc/dialog/patches/patch-ak | 9 +++++++ misc/dialog/pkg/COMMENT | 1 + misc/dialog/pkg/DESCR | 5 ++++ misc/dialog/pkg/PLIST | 13 ++++++++++ 16 files changed, 404 insertions(+) create mode 100644 misc/dialog/Makefile create mode 100644 misc/dialog/files/md5 create mode 100644 misc/dialog/patches/patch-aa create mode 100644 misc/dialog/patches/patch-ab create mode 100644 misc/dialog/patches/patch-ac create mode 100644 misc/dialog/patches/patch-ad create mode 100644 misc/dialog/patches/patch-ae create mode 100644 misc/dialog/patches/patch-af create mode 100644 misc/dialog/patches/patch-ag create mode 100644 misc/dialog/patches/patch-ah create mode 100644 misc/dialog/patches/patch-ai create mode 100644 misc/dialog/patches/patch-aj create mode 100644 misc/dialog/patches/patch-ak create mode 100644 misc/dialog/pkg/COMMENT create mode 100644 misc/dialog/pkg/DESCR create mode 100644 misc/dialog/pkg/PLIST (limited to 'misc/dialog') diff --git a/misc/dialog/Makefile b/misc/dialog/Makefile new file mode 100644 index 00000000000..f16f8e8220b --- /dev/null +++ b/misc/dialog/Makefile @@ -0,0 +1,27 @@ +# $NetBSD: Makefile,v 1.1 1998/05/26 22:07:19 tron Exp $ +# + +DISTNAME= dialog-0.6z +CATEGORIES= misc +MASTER_SITES= ${MASTER_SITE_SUNSITE} +MASTER_SITE_SUBDIR= utils/shell + +MAINTAINER= lamj@stat.cmu.edu + +DEPENDS+= ncurses-1.9.9g:../../devel/ncurses + +NO_CONFIGURE= yes +USE_GMAKE= yes +MAN1= dialog.1 + +post-install: + @${MKDIR} ${PREFIX}/share/examples/dialog +.for file in checklist guage infobox inputbox menubox msgbox radiolist textbox yesno + @${SED} "s,\.\./dialog,${PREFIX}/bin/dialog,g" \ + ${WRKSRC}/samples/${file} > ${WRKSRC}/samples/${file}.sed + @${INSTALL_SCRIPT} ${WRKSRC}/samples/${file}.sed \ + ${PREFIX}/share/examples/dialog/${file} + @${RM} ${WRKSRC}/samples/${file}.sed +.endfor + +.include <../../mk/bsd.pkg.mk> diff --git a/misc/dialog/files/md5 b/misc/dialog/files/md5 new file mode 100644 index 00000000000..60037d80219 --- /dev/null +++ b/misc/dialog/files/md5 @@ -0,0 +1 @@ +MD5 (dialog-0.6z.tar.gz) = 6801259e03d2c07f394bbb4bb26dfc5d diff --git a/misc/dialog/patches/patch-aa b/misc/dialog/patches/patch-aa new file mode 100644 index 00000000000..ca5cb6c8586 --- /dev/null +++ b/misc/dialog/patches/patch-aa @@ -0,0 +1,59 @@ +--- Makefile.orig Thu Jan 9 07:19:34 1997 ++++ Makefile Tue May 26 23:53:37 1998 +@@ -17,8 +17,8 @@ + # can be disabled to make dialog a bit smaller (could be done for more things) + HAVE_GUAGE=true + +-BINDIR = /usr/bin +-MANDIR = /usr/man/man1/ ++BINDIR = ${PREFIX}/bin ++MANDIR = ${PREFIX}/man/man1 + + CC = gcc + CPP = gcc -E +@@ -30,7 +30,7 @@ + # do not edit below this line + + CFLAGS = $(OPTIM) -DLOCALE -DVERSION=\"0.6z\" +-LDFLAGS = -L . ++LDFLAGS = -L . -L${PREFIX}/lib + LDLIBS = -ldialog + + OBJS = checklist.o inputbox.o menubox.o msgbox.o \ +@@ -42,7 +42,8 @@ + OBJS+=mouse.o + endif + ifeq ($(HAVE_NCURSES), true) +-CFLAGS+=-DHAVE_NCURSES -I/usr/include/ncurses ++#CFLAGS+=-DHAVE_NCURSES -I/usr/include/ncurses ++CFLAGS+=-DHAVE_NCURSES -I/usr/pkg/include + LDLIBS+=-lncurses + endif + ifeq ($(HAVE_RC_FILE), true) +@@ -59,7 +60,7 @@ + all: libdialog.a dialog + + libdialog.a: $(OBJS) +- ar rcs libdialog.a $(OBJS) ++ ar rc libdialog.a $(OBJS) + + dialog: dialog.o + +@@ -70,7 +71,7 @@ + include .depend + + install: dialog libdialog.a +- install -s dialog $(BINDIR) ++ ${BSD_INSTALL_PROGRAM} dialog $(BINDIR) + cp dialog.man dialog.1 + ifeq ($(HAVE_RC_FILE),false) + mv dialog.1 dialog.in +@@ -82,7 +83,7 @@ + endif + mv dialog.1 dialog.in + sed -e "/COMMENTSTART/,/COMMENTEND/d" dialog.in >dialog.1 +- install -m 644 dialog.1 $(MANDIR) ++ ${BSD_INSTALL_MAN} dialog.1 $(MANDIR) + # install -m 644 libdialog.a /usr/lib/ + + depend: diff --git a/misc/dialog/patches/patch-ab b/misc/dialog/patches/patch-ab new file mode 100644 index 00000000000..61100d1893d --- /dev/null +++ b/misc/dialog/patches/patch-ab @@ -0,0 +1,53 @@ +--- checklist.c.orig Fri Jan 23 17:37:12 1998 ++++ checklist.c Fri Jan 23 18:15:04 1998 +@@ -64,7 +64,7 @@ + int list_height, int item_no, const char * const * items, int flag, + int separate_output) + { +- int i, x, y, cur_x, cur_y, box_x, box_y; ++ int i, j, x, y, cur_x, cur_y, box_x, box_y; + int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; + WINDOW *dialog, *list; + +@@ -83,6 +83,26 @@ + + max_choice = MIN (list_height, item_no); + ++ /* Find length of longest item in order to center checklist */ ++ check_x = 0; ++ item_x = 0; ++ for (i = 0; i < item_no; i++) { ++ check_x = MAX (check_x, strlen (items[i * 3]) ++ + strlen (items[i * 3 + 1]) + 6); ++ item_x = MAX (item_x, strlen (items[i * 3])); ++ } ++ ++ /* Choose useful default height and width if they are negative */ ++ if (height < 0) ++ height = strheight(prompt) + list_height + 4 + 2; ++ if (width < 0) { ++ i = strwidth(prompt); ++ j = ((title != NULL) ? strwidth(title) : 0); ++ width = MAX (i, j); ++ width = MAX (width, check_x + 4) + 4; ++ } ++ width = MAX (width, MIN_DIALOG_WIDTH); ++ + /* center dialog box on screen */ + x = (COLS - width) / 2; + y = (LINES - height) / 2; +@@ -131,14 +151,6 @@ + draw_box (dialog, box_y, box_x, list_height + 2, list_width + 2, + menubox_border_attr, menubox_attr); + +- check_x = 0; +- item_x = 0; +- /* Find length of longest item in order to center checklist */ +- for (i = 0; i < item_no; i++) { +- check_x = MAX (check_x, strlen (items[i * 3]) +- + strlen (items[i * 3 + 1]) + 6); +- item_x = MAX (item_x, strlen (items[i * 3])); +- } + check_x = (list_width - check_x) / 2; + item_x = check_x + item_x + 6; + diff --git a/misc/dialog/patches/patch-ac b/misc/dialog/patches/patch-ac new file mode 100644 index 00000000000..e424f4323e6 --- /dev/null +++ b/misc/dialog/patches/patch-ac @@ -0,0 +1,33 @@ +--- dialog.h.orig Fri Jan 23 17:37:12 1998 ++++ dialog.h Fri Jan 23 18:14:38 1998 +@@ -28,8 +28,12 @@ + #ifdef ultrix + #include + #else ++#ifdef __NetBSD__ ++#include ++#else + #include + #endif ++#endif + + /* + * Change these if you want +@@ -42,6 +46,7 @@ + #define TAB 9 + #define MAX_LEN 2048 + #define BUF_SIZE (10*1024) ++#define MIN_DIALOG_WIDTH 24 + #define MIN(x,y) (x < y ? x : y) + #define MAX(x,y) (x > y ? x : y) + +@@ -150,6 +155,9 @@ + #ifdef HAVE_NCURSES + void draw_shadow (WINDOW * win, int y, int x, int height, int width); + #endif ++ ++int strheight (const char *p); ++int strwidth (const char *p); + + int dialog_yesno (const char *title, const char *prompt, int height, int width); + int dialog_msgbox (const char *title, const char *prompt, int height, diff --git a/misc/dialog/patches/patch-ad b/misc/dialog/patches/patch-ad new file mode 100644 index 00000000000..81e0dfa5dbf --- /dev/null +++ b/misc/dialog/patches/patch-ad @@ -0,0 +1,14 @@ +--- guage.c.orig Fri Jan 23 17:37:12 1998 ++++ guage.c Fri Jan 23 17:37:12 1998 +@@ -38,6 +38,11 @@ + char prompt_buf[1024]; + WINDOW *dialog; + ++ if (height < 0 || width < 0) { ++ fprintf(stderr, "\nAutosizing is impossible in dialog_textbox().\n"); ++ return(-1); ++ } ++ + /* center dialog box on screen */ + x = (COLS - width) / 2; + y = (LINES - height) / 2; diff --git a/misc/dialog/patches/patch-ae b/misc/dialog/patches/patch-ae new file mode 100644 index 00000000000..a8917a7a2da --- /dev/null +++ b/misc/dialog/patches/patch-ae @@ -0,0 +1,24 @@ +--- inputbox.c.orig Fri Jan 23 17:37:12 1998 ++++ inputbox.c Fri Jan 23 18:15:24 1998 +@@ -29,10 +29,20 @@ + dialog_inputbox (const char *title, const char *prompt, int height, int width, + const char *init) + { +- int i, x, y, box_y, box_x, box_width; ++ int i, j, x, y, box_y, box_x, box_width; + int input_x = 0, scroll = 0, key = 0, button = -1; + unsigned char *instr = dialog_input_result; + WINDOW *dialog; ++ ++ /* Choose useful default height and width if they are negative */ ++ if (height < 0) ++ height = strheight(prompt) + 4 + 2; ++ if (width < 0) { ++ i = strwidth(prompt); ++ j = ((title != NULL) ? strwidth(title) : 0); ++ width = MAX (i, j) + 4; ++ } ++ width = MAX (width, MIN_DIALOG_WIDTH); + + /* center dialog box on screen */ + x = (COLS - width) / 2; diff --git a/misc/dialog/patches/patch-af b/misc/dialog/patches/patch-af new file mode 100644 index 00000000000..5fcc6bf80bc --- /dev/null +++ b/misc/dialog/patches/patch-af @@ -0,0 +1,51 @@ +--- menubox.c.orig Fri Jan 23 17:37:12 1998 ++++ menubox.c Fri Jan 23 18:15:46 1998 +@@ -53,12 +53,32 @@ + dialog_menu (const char *title, const char *prompt, int height, int width, + int menu_height, int item_no, const char * const * items) + { +- int i, x, y, cur_x, cur_y, box_x, box_y; ++ int i, j, x, y, cur_x, cur_y, box_x, box_y; + int key = 0, button = 0, choice = 0, scroll = 0, max_choice; + WINDOW *dialog, *menu; + + max_choice = MIN (menu_height, item_no); + ++ /* Find length of longest item in order to center menu */ ++ tag_x = 0; ++ item_x = 0; ++ for (i = 0; i < item_no; i++) { ++ tag_x = MAX (tag_x, ++ strlen (items[i * 2]) + strlen (items[i * 2 + 1]) + 2); ++ item_x = MAX (item_x, strlen (items[i * 2])); ++ } ++ ++ /* Choose useful default height and width if they are negative */ ++ if (height < 0) ++ height = strheight(prompt) + menu_height + 4 + 2; ++ if (width < 0) { ++ i = strwidth(prompt); ++ j = ((title != NULL) ? strwidth(title) : 0); ++ width = MAX (i, j); ++ width = MAX (width, tag_x + 4) + 4; ++ } ++ width = MAX (width, MIN_DIALOG_WIDTH); ++ + /* center dialog box on screen */ + x = (COLS - width) / 2; + y = (LINES - height) / 2; +@@ -107,14 +127,6 @@ + draw_box (dialog, box_y, box_x, menu_height + 2, menu_width + 2, + menubox_border_attr, menubox_attr); + +- tag_x = 0; +- item_x = 0; +- /* Find length of longest item in order to center menu */ +- for (i = 0; i < item_no; i++) { +- tag_x = MAX (tag_x, +- strlen (items[i * 2]) + strlen (items[i * 2 + 1]) + 2); +- item_x = MAX (item_x, strlen (items[i * 2])); +- } + tag_x = (menu_width - tag_x) / 2; + item_x = tag_x + item_x + 2; + diff --git a/misc/dialog/patches/patch-ag b/misc/dialog/patches/patch-ag new file mode 100644 index 00000000000..d8d846ced13 --- /dev/null +++ b/misc/dialog/patches/patch-ag @@ -0,0 +1,23 @@ +--- msgbox.c.orig Fri Jan 23 17:37:13 1998 ++++ msgbox.c Fri Jan 23 18:16:53 1998 +@@ -28,8 +28,19 @@ + dialog_msgbox (const char *title, const char *prompt, int height, int width, + int pause) + { +- int i, x, y, key = 0; ++ int i, j, x, y, key = 0; + WINDOW *dialog; ++ ++ /* Choose useful default height and width if they are negative */ ++ if (height < 0) ++ height = strheight(prompt) + 2 + 2 * (!!pause); ++ if (width < 0) { ++ i = strwidth(prompt); ++ j = ((title != NULL) ? strwidth(title) : 0); ++ width = MAX (i, j) + 4; ++ } ++ if (pause) ++ width = MAX (width, 10); + + /* center dialog box on screen */ + x = (COLS - width) / 2; diff --git a/misc/dialog/patches/patch-ah b/misc/dialog/patches/patch-ah new file mode 100644 index 00000000000..e6e03f0b31e --- /dev/null +++ b/misc/dialog/patches/patch-ah @@ -0,0 +1,14 @@ +--- textbox.c.orig Fri Jan 23 17:37:13 1998 ++++ textbox.c Fri Jan 23 17:37:12 1998 +@@ -45,6 +45,11 @@ + char search_term[MAX_LEN + 1], *tempptr, *found; + WINDOW *dialog, *text; + ++ if (height < 0 || width < 0) { ++ fprintf(stderr, "\nAutosizing is impossible in dialog_textbox().\n"); ++ return(-1); ++ } ++ + search_term[0] = '\0'; /* no search term entered yet */ + + /* Open input file for reading */ diff --git a/misc/dialog/patches/patch-ai b/misc/dialog/patches/patch-ai new file mode 100644 index 00000000000..c867e5f183d --- /dev/null +++ b/misc/dialog/patches/patch-ai @@ -0,0 +1,55 @@ +--- util.c.orig Fri Jan 23 17:37:13 1998 ++++ util.c Fri Jan 23 17:37:12 1998 +@@ -361,3 +361,52 @@ + } + } + #endif ++ ++int strwidth(const char *p) ++{ ++ int i = 0, len, incr; ++ const char *start, *s, *s1, *s2; ++ ++ for (start = s = p; ; start = (s += incr)) { ++ s1 = strchr(s, '\n'); ++ s2 = strstr(s, "\\n"); ++ if (s2 == NULL) ++ s = s1; ++ else if (s1 == NULL) ++ s = s2; ++ else ++ s = MIN(s1, s2); ++ if (s == NULL) ++ break; ++ incr = 1 + (s == s2); ++ len = s - start; ++ if (len > i) ++ i = len; ++ } ++ len = strlen(start); ++ if (len > i) ++ i = len; ++ return i; ++} ++ ++int strheight(const char *p) ++{ ++ int i = 1, incr; ++ const char *s, *s1, *s2; ++ ++ for (s = p; ; s += incr) { ++ s1 = strchr(s, '\n'); ++ s2 = strstr(s, "\\n"); ++ if (s2 == NULL) ++ s = s1; ++ else if (s1 == NULL) ++ s = s2; ++ else ++ s = MIN(s1, s2); ++ if (s == NULL) ++ break; ++ incr = 1 + (s == s2); ++ i++; ++ } ++ return i; ++} diff --git a/misc/dialog/patches/patch-aj b/misc/dialog/patches/patch-aj new file mode 100644 index 00000000000..a2285abc21a --- /dev/null +++ b/misc/dialog/patches/patch-aj @@ -0,0 +1,22 @@ +--- yesno.c.orig Fri Jan 23 17:37:13 1998 ++++ yesno.c Fri Jan 23 18:17:16 1998 +@@ -26,8 +26,18 @@ + int + dialog_yesno (const char *title, const char *prompt, int height, int width) + { +- int i, x, y, key = 0, button = 0; ++ int i, j, x, y, key = 0, button = 0; + WINDOW *dialog; ++ ++ /* Choose useful default height and width if they are negative */ ++ if (height < 0) ++ height = strheight(prompt) + 4; ++ if (width < 0) { ++ i = strwidth(prompt); ++ j = ((title != NULL) ? strwidth(title) : 0); ++ width = MAX (i, j) + 4; ++ } ++ width = MAX (width, MIN_DIALOG_WIDTH); + + /* center dialog box on screen */ + x = (COLS - width) / 2; diff --git a/misc/dialog/patches/patch-ak b/misc/dialog/patches/patch-ak new file mode 100644 index 00000000000..c12c90a25c9 --- /dev/null +++ b/misc/dialog/patches/patch-ak @@ -0,0 +1,9 @@ +--- samples/infobox.orig Thu Jan 9 01:45:24 1997 ++++ samples/infobox Fri Jan 23 18:34:07 1998 +@@ -1,5 +1,5 @@ + #!/bin/sh +-$DIALOG=${DIALOG=../dialog} ++DIALOG=${DIALOG=../dialog} + + $DIALOG --backtitle "dialog 0.6z - samples/infobox" --title "INFO BOX" \ + --infobox "Hi, this is an information box. It is diff --git a/misc/dialog/pkg/COMMENT b/misc/dialog/pkg/COMMENT new file mode 100644 index 00000000000..bc32174ea98 --- /dev/null +++ b/misc/dialog/pkg/COMMENT @@ -0,0 +1 @@ +Display dialog boxes from shell scripts. diff --git a/misc/dialog/pkg/DESCR b/misc/dialog/pkg/DESCR new file mode 100644 index 00000000000..d4014c3b2d1 --- /dev/null +++ b/misc/dialog/pkg/DESCR @@ -0,0 +1,5 @@ +Dialog is a program that will let you to present a variety of questions +or display messages using dialog boxes from a shell script. Currently, +these types of dialog boxes are implemented: +yes/no box, menu box, input box, message box, text box, info box, +guage box, checklist box, and radiolist box. diff --git a/misc/dialog/pkg/PLIST b/misc/dialog/pkg/PLIST new file mode 100644 index 00000000000..0b4c3492bf0 --- /dev/null +++ b/misc/dialog/pkg/PLIST @@ -0,0 +1,13 @@ +@comment $NetBSD: PLIST,v 1.1 1998/05/26 22:07:21 tron Exp $ +bin/dialog +man/man1/dialog.1.gz +share/examples/dialog/checklist +share/examples/dialog/guage +share/examples/dialog/infobox +share/examples/dialog/inputbox +share/examples/dialog/menubox +share/examples/dialog/msgbox +share/examples/dialog/radiolist +share/examples/dialog/textbox +share/examples/dialog/yesno +@dirrm share/examples/dialog -- cgit v1.2.3