summaryrefslogtreecommitdiffstats
path: root/gnu/lib/libodialog/TESTS
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/lib/libodialog/TESTS')
-rw-r--r--gnu/lib/libodialog/TESTS/Makefile20
-rw-r--r--gnu/lib/libodialog/TESTS/check1.c83
-rw-r--r--gnu/lib/libodialog/TESTS/check2.c105
-rw-r--r--gnu/lib/libodialog/TESTS/check3.c92
-rw-r--r--gnu/lib/libodialog/TESTS/dselect.c41
-rw-r--r--gnu/lib/libodialog/TESTS/fselect.c44
-rw-r--r--gnu/lib/libodialog/TESTS/ftree1.c45
-rw-r--r--gnu/lib/libodialog/TESTS/ftree1.test73
-rw-r--r--gnu/lib/libodialog/TESTS/ftree2.c47
-rw-r--r--gnu/lib/libodialog/TESTS/ftree2.test73
-rw-r--r--gnu/lib/libodialog/TESTS/gauge.c41
-rw-r--r--gnu/lib/libodialog/TESTS/input1.c45
-rw-r--r--gnu/lib/libodialog/TESTS/input2.c47
-rw-r--r--gnu/lib/libodialog/TESTS/menu1.c96
-rw-r--r--gnu/lib/libodialog/TESTS/menu2.c96
-rw-r--r--gnu/lib/libodialog/TESTS/menu3.c107
-rw-r--r--gnu/lib/libodialog/TESTS/msg.c42
-rw-r--r--gnu/lib/libodialog/TESTS/prgbox.c41
-rw-r--r--gnu/lib/libodialog/TESTS/radio1.c71
-rw-r--r--gnu/lib/libodialog/TESTS/radio2.c89
-rw-r--r--gnu/lib/libodialog/TESTS/radio3.c98
-rw-r--r--gnu/lib/libodialog/TESTS/text.c41
-rw-r--r--gnu/lib/libodialog/TESTS/tree.c111
-rw-r--r--gnu/lib/libodialog/TESTS/yesno.c45
24 files changed, 1593 insertions, 0 deletions
diff --git a/gnu/lib/libodialog/TESTS/Makefile b/gnu/lib/libodialog/TESTS/Makefile
new file mode 100644
index 0000000..65e3d71
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/Makefile
@@ -0,0 +1,20 @@
+# Really quick and evil Makefile for building all the tests. I wish that
+# bmake was friendlier to the concept of multiple progs/libs in the same
+# directory.
+#
+# $FreeBSD$
+
+PROGS= msg yesno prgbox gauge dselect fselect text menu1 menu2 menu3 \
+ input1 input2 check1 check2 check3 radio1 radio2 radio3 \
+ ftree1 ftree2 tree
+
+WARNS?= 2
+CFLAGS+= -Wall -Wstrict-prototypes
+LDFLAGS+= -ldialog
+
+all: ${PROGS}
+
+clean:
+ rm -f ${PROGS}
+
+.include <bsd.prog.mk>
diff --git a/gnu/lib/libodialog/TESTS/check1.c b/gnu/lib/libodialog/TESTS/check1.c
new file mode 100644
index 0000000..a2bec62
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/check1.c
@@ -0,0 +1,83 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Hook functions */
+
+static int
+getBool(dialogMenuItem *self)
+{
+ if (self->data && *((int *)self->data))
+ return TRUE;
+ return FALSE;
+}
+
+static int
+setBool(dialogMenuItem *self)
+{
+ if (self->data) {
+ *((int *)self->data) = !*((int *)self->data);
+ return DITEM_SUCCESS;
+ }
+ return DITEM_FAILURE;
+}
+
+static int german_book, italian_book, slang_book;
+
+static int
+clearBooks(dialogMenuItem *self)
+{
+ german_book = italian_book = slang_book = FALSE;
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+/* menu2 - A more advanced way of using checked and fire hooks to manipulate the backing-variables directly */
+/* prompt title checked fire sel data */
+static dialogMenuItem menu2[] = {
+ { "German", "Buy book on learning German", getBool, setBool, NULL, &german_book},
+ { "Italian", "Buy book on learning Italian", getBool, setBool, NULL, &italian_book },
+ { "Slang", "Buy book on commonly used insults", getBool, setBool, NULL, &slang_book },
+ { "Clear", "Clear book list", NULL, clearBooks, NULL, NULL, ' ', ' ', ' ' },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_checklist("this is a dialog_checklist() in action, test #1",
+ "this checklist menu shows off some of the straight-forward features\n"
+ "of the new menu system's check & fire dispatch hooks", -1, -1, 4, -4, menu2, NULL);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_checklist was %d (%d %d %d)\n", retval, german_book, italian_book, slang_book);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/check2.c b/gnu/lib/libodialog/TESTS/check2.c
new file mode 100644
index 0000000..3608261
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/check2.c
@@ -0,0 +1,105 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Hook functions */
+
+static int
+getBool(dialogMenuItem *self)
+{
+ if (self->data && *((int *)self->data))
+ return TRUE;
+ return FALSE;
+}
+
+static int
+setBool(dialogMenuItem *self)
+{
+ if (self->data) {
+ *((int *)self->data) = !*((int *)self->data);
+ return DITEM_SUCCESS;
+ }
+ return DITEM_FAILURE;
+}
+
+static int german_book, italian_book, slang_book;
+
+static int
+clearBooks(dialogMenuItem *self)
+{
+ german_book = italian_book = slang_book = FALSE;
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+static int
+buyBooks(dialogMenuItem *self)
+{
+ char foo[256];
+
+ if (german_book || italian_book || slang_book) {
+ strcpy(foo, "Ok, you're buying books on");
+ if (german_book)
+ strcat(foo, " german");
+ if (italian_book)
+ strcat(foo, " italian");
+ if (slang_book)
+ strcat(foo, " slang");
+ }
+ else
+ strcpy(foo, "You're not buying any books?");
+ dialog_mesgbox("This is a direct callback for the `Buy' button", foo, -1, -1);
+ return DITEM_SUCCESS;
+}
+
+/* menu3 - Look mom! We can finally use our own OK and Cancel buttons! */
+/* prompt title checked fire sel data */
+static dialogMenuItem menu3[] = {
+ { "Buy!", NULL, NULL, buyBooks }, /* New "OK" button */
+ { "No Way!", NULL, NULL, NULL }, /* New "Cancel" button */
+ { "German", "Buy books on learning German", getBool, setBool, NULL, &german_book },
+ { "Italian", "Buy books on learning Italian", getBool, setBool, NULL, &italian_book },
+ { "Slang", "Buy books on commonly used insults", getBool, setBool, NULL, &slang_book },
+ { "Clear", "Clear book list", NULL, clearBooks, NULL, NULL, ' ', ' ', ' ' },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_checklist("this is dialog_checklist() in action, test #2",
+ "Same as before, but now we relabel the buttons and override the OK action.",
+ -1, -1, 4, -4, menu3 + 2, (char *)TRUE);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_checklist was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/check3.c b/gnu/lib/libodialog/TESTS/check3.c
new file mode 100644
index 0000000..f117bd6
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/check3.c
@@ -0,0 +1,92 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Hook functions */
+
+static int
+getBool(dialogMenuItem *self)
+{
+ if (self->data && *((int *)self->data))
+ return TRUE;
+ return FALSE;
+}
+
+static int
+setBool(dialogMenuItem *self)
+{
+ if (self->data) {
+ *((int *)self->data) = !*((int *)self->data);
+ return DITEM_SUCCESS;
+ }
+ return DITEM_FAILURE;
+}
+
+static int german_book, italian_book, slang_book;
+static int spending;
+
+static int
+check(dialogMenuItem *self)
+{
+ return ((int)(intptr_t)self->data == spending);
+}
+
+static int
+spend(dialogMenuItem *self)
+{
+ spending = (int)(intptr_t)self->data;
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+/* menu4 - Show off a simulated compound menu (group at top is checklist, group at bottom radio) */
+/* prompt title checked fire sel, data lbra mark rbra */
+static dialogMenuItem menu4[] = {
+ { "German", "Buy books on learning German", getBool, setBool, NULL, &german_book },
+ { "Italian","Buy books on learning Italian", getBool, setBool, NULL, &italian_book },
+ { "Slang", "Buy books on commonly used insults", getBool, setBool, NULL, &slang_book },
+ { "-----", "----------------------------------", NULL, NULL, NULL, NULL, ' ', ' ', ' ' },
+ { "1000", "Spend $1,000", check, spend, NULL, (void *)1000, '(', '*', ')' },
+ { "500", "Spend $500", check, spend, NULL, (void *)500, '(', '*', ')' },
+ { "100", "Spend $100", check, spend, NULL, (void *)100, '(', '*', ')' },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+
+ retval = dialog_checklist("this is dialog_checklist() in action, test #3",
+ "Now we show off some of the button 'styles' one can create.",
+ -1, -1, 7, -7, menu4, NULL);
+ dialog_clear();
+ fprintf(stderr, "spent $%d on %s%s%s books\n", spending, german_book ? " german" : "",
+ italian_book ? " italian" : "", slang_book ? " slang" : "");
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/dselect.c b/gnu/lib/libodialog/TESTS/dselect.c
new file mode 100644
index 0000000..1110379
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/dselect.c
@@ -0,0 +1,41 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_dselect(".", "*");
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_dselect was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/fselect.c b/gnu/lib/libodialog/TESTS/fselect.c
new file mode 100644
index 0000000..6cefaf3
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/fselect.c
@@ -0,0 +1,44 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ char *retval;
+
+ init_dialog();
+
+ retval = dialog_fselect(".", "*.[ch]");
+ dialog_clear();
+ if (retval)
+ fprintf(stderr, "returned value for dialog_fselect was %s\n", retval);
+ else
+ fprintf(stderr, "returned value for dialog_fselect was NULL\n");
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/ftree1.c b/gnu/lib/libodialog/TESTS/ftree1.c
new file mode 100644
index 0000000..f21e0e5
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/ftree1.c
@@ -0,0 +1,45 @@
+/*
+ * ftree1.c
+ *
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1998, Anatoly A. Orehovsky
+ *
+ * file ./ftree1.test with xterm widget tree from
+ * direct editres(1) dump needed !!!
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dialog.h>
+
+int
+main(int argc, char **argv)
+{
+ int retval;
+ unsigned char *tresult;
+
+ init_dialog();
+ retval = dialog_ftree("ftree1.test", '\t',
+ "ftree dialog box example",
+ "xterm widget tree from direct editres(1) dump",
+ -1, -1, 15,
+ &tresult);
+
+ dialog_update();
+
+ dialog_clear();
+
+ end_dialog();
+
+ if (!retval)
+ {
+ puts(tresult);
+ free(tresult);
+ }
+
+ exit(retval);
+}
diff --git a/gnu/lib/libodialog/TESTS/ftree1.test b/gnu/lib/libodialog/TESTS/ftree1.test
new file mode 100644
index 0000000..4a8f0fa
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/ftree1.test
@@ -0,0 +1,73 @@
+XTerm login
+ VendorShellExt shellext
+ VT100 vt100
+ SimpleMenu fontMenu
+ SmeBSB menuLabel
+ SmeBSB fontdefault
+ SmeBSB font1
+ SmeBSB font2
+ SmeBSB font3
+ SmeBSB font4
+ SmeBSB font5
+ SmeBSB font6
+ SmeBSB fontescape
+ SmeBSB fontsel
+ SimpleMenu mainMenu
+ SmeBSB menuLabel
+ SmeBSB securekbd
+ SmeBSB allowsends
+ SmeBSB redraw
+ SmeLine line1
+ SmeBSB 8-bit control
+ SmeBSB sun function-keys
+ SmeLine line2
+ SmeBSB suspend
+ SmeBSB continue
+ SmeBSB interrupt
+ SmeBSB hangup
+ SmeBSB terminate
+ SmeBSB kill
+ SmeLine line3
+ SmeBSB quit
+ SimpleMenu vtMenu
+ SmeBSB menuLabel
+ SmeBSB scrollbar
+ SmeBSB jumpscroll
+ SmeBSB reversevideo
+ SmeBSB autowrap
+ SmeBSB reversewrap
+ SmeBSB autolinefeed
+ SmeBSB appcursor
+ SmeBSB appkeypad
+ SmeBSB scrollkey
+ SmeBSB scrollttyoutput
+ SmeBSB allow132
+ SmeBSB cursesemul
+ SmeBSB visualbell
+ SmeBSB marginbell
+ SmeBSB altscreen
+ SmeLine line1
+ SmeBSB softreset
+ SmeBSB hardreset
+ SmeBSB clearsavedlines
+ SmeLine line2
+ SmeBSB tekshow
+ SmeBSB tekmode
+ SmeBSB vthide
+ TopLevelShell tektronix
+ VendorShellExt shellext
+ Tek4014 tek4014
+ SimpleMenu tekMenu
+ SmeBSB menuLabel
+ SmeBSB tektextlarge
+ SmeBSB tektext2
+ SmeBSB tektext3
+ SmeBSB tektextsmall
+ SmeLine line1
+ SmeBSB tekpage
+ SmeBSB tekreset
+ SmeBSB tekcopy
+ SmeLine line2
+ SmeBSB vtshow
+ SmeBSB vtmode
+ SmeBSB tekhide
diff --git a/gnu/lib/libodialog/TESTS/ftree2.c b/gnu/lib/libodialog/TESTS/ftree2.c
new file mode 100644
index 0000000..aa4663a
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/ftree2.c
@@ -0,0 +1,47 @@
+/*
+ * ftree2.c
+ *
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1998, Anatoly A. Orehovsky
+ *
+ * file ./ftree2.test with xterm widget tree from
+ * preprocess editres(1) dump needed !!!
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dialog.h>
+
+int
+main(int argc, char **argv)
+{
+ int retval;
+ unsigned char *tresult;
+
+ init_dialog();
+ use_helpfile("ftree2.test");
+ use_helpline("Press Arrows, Tab, Enter or F1");
+ retval = dialog_ftree("ftree2.test", '\t',
+ "ftree dialog box example",
+ "xterm widget tree from preprocess editres(1) dump",
+ -1, -1, 15,
+ &tresult);
+
+ dialog_update();
+
+ dialog_clear();
+
+ end_dialog();
+
+ if (!retval)
+ {
+ puts(tresult);
+ free(tresult);
+ }
+
+ exit(retval);
+}
diff --git a/gnu/lib/libodialog/TESTS/ftree2.test b/gnu/lib/libodialog/TESTS/ftree2.test
new file mode 100644
index 0000000..0850862
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/ftree2.test
@@ -0,0 +1,73 @@
+XTerm login
+XTerm login VendorShellExt shellext
+XTerm login VT100 vt100
+XTerm login SimpleMenu fontMenu
+XTerm login SimpleMenu fontMenu SmeBSB menuLabel
+XTerm login SimpleMenu fontMenu SmeBSB fontdefault
+XTerm login SimpleMenu fontMenu SmeBSB font1
+XTerm login SimpleMenu fontMenu SmeBSB font2
+XTerm login SimpleMenu fontMenu SmeBSB font3
+XTerm login SimpleMenu fontMenu SmeBSB font4
+XTerm login SimpleMenu fontMenu SmeBSB font5
+XTerm login SimpleMenu fontMenu SmeBSB font6
+XTerm login SimpleMenu fontMenu SmeBSB fontescape
+XTerm login SimpleMenu fontMenu SmeBSB fontsel
+XTerm login SimpleMenu mainMenu
+XTerm login SimpleMenu mainMenu SmeBSB menuLabel
+XTerm login SimpleMenu mainMenu SmeBSB securekbd
+XTerm login SimpleMenu mainMenu SmeBSB allowsends
+XTerm login SimpleMenu mainMenu SmeBSB redraw
+XTerm login SimpleMenu mainMenu SmeLine line1
+XTerm login SimpleMenu mainMenu SmeBSB 8-bit control
+XTerm login SimpleMenu mainMenu SmeBSB sun function-keys
+XTerm login SimpleMenu mainMenu SmeLine line2
+XTerm login SimpleMenu mainMenu SmeBSB suspend
+XTerm login SimpleMenu mainMenu SmeBSB continue
+XTerm login SimpleMenu mainMenu SmeBSB interrupt
+XTerm login SimpleMenu mainMenu SmeBSB hangup
+XTerm login SimpleMenu mainMenu SmeBSB terminate
+XTerm login SimpleMenu mainMenu SmeBSB kill
+XTerm login SimpleMenu mainMenu SmeLine line3
+XTerm login SimpleMenu mainMenu SmeBSB quit
+XTerm login SimpleMenu vtMenu
+XTerm login SimpleMenu vtMenu SmeBSB menuLabel
+XTerm login SimpleMenu vtMenu SmeBSB scrollbar
+XTerm login SimpleMenu vtMenu SmeBSB jumpscroll
+XTerm login SimpleMenu vtMenu SmeBSB reversevideo
+XTerm login SimpleMenu vtMenu SmeBSB autowrap
+XTerm login SimpleMenu vtMenu SmeBSB reversewrap
+XTerm login SimpleMenu vtMenu SmeBSB autolinefeed
+XTerm login SimpleMenu vtMenu SmeBSB appcursor
+XTerm login SimpleMenu vtMenu SmeBSB appkeypad
+XTerm login SimpleMenu vtMenu SmeBSB scrollkey
+XTerm login SimpleMenu vtMenu SmeBSB scrollttyoutput
+XTerm login SimpleMenu vtMenu SmeBSB allow132
+XTerm login SimpleMenu vtMenu SmeBSB cursesemul
+XTerm login SimpleMenu vtMenu SmeBSB visualbell
+XTerm login SimpleMenu vtMenu SmeBSB marginbell
+XTerm login SimpleMenu vtMenu SmeBSB altscreen
+XTerm login SimpleMenu vtMenu SmeLine line1
+XTerm login SimpleMenu vtMenu SmeBSB softreset
+XTerm login SimpleMenu vtMenu SmeBSB hardreset
+XTerm login SimpleMenu vtMenu SmeBSB clearsavedlines
+XTerm login SimpleMenu vtMenu SmeLine line2
+XTerm login SimpleMenu vtMenu SmeBSB tekshow
+XTerm login SimpleMenu vtMenu SmeBSB tekmode
+XTerm login SimpleMenu vtMenu SmeBSB vthide
+XTerm login TopLevelShell tektronix
+XTerm login TopLevelShell tektronix VendorShellExt shellext
+XTerm login TopLevelShell tektronix Tek4014 tek4014
+XTerm login SimpleMenu tekMenu
+XTerm login SimpleMenu tekMenu SmeBSB menuLabel
+XTerm login SimpleMenu tekMenu SmeBSB tektextlarge
+XTerm login SimpleMenu tekMenu SmeBSB tektext2
+XTerm login SimpleMenu tekMenu SmeBSB tektext3
+XTerm login SimpleMenu tekMenu SmeBSB tektextsmall
+XTerm login SimpleMenu tekMenu SmeLine line1
+XTerm login SimpleMenu tekMenu SmeBSB tekpage
+XTerm login SimpleMenu tekMenu SmeBSB tekreset
+XTerm login SimpleMenu tekMenu SmeBSB tekcopy
+XTerm login SimpleMenu tekMenu SmeLine line2
+XTerm login SimpleMenu tekMenu SmeBSB vtshow
+XTerm login SimpleMenu tekMenu SmeBSB vtmode
+XTerm login SimpleMenu tekMenu SmeBSB tekhide
diff --git a/gnu/lib/libodialog/TESTS/gauge.c b/gnu/lib/libodialog/TESTS/gauge.c
new file mode 100644
index 0000000..bf0cfc9
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/gauge.c
@@ -0,0 +1,41 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int i;
+
+ init_dialog();
+
+ for (i = 0; i <= 100; i++) {
+ dialog_gauge("Gas tank", "When this gets 100% full, you'd better yank out the nozzle!", 10, 1, 7, 70, i);
+ usleep(30000);
+ }
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/input1.c b/gnu/lib/libodialog/TESTS/input1.c
new file mode 100644
index 0000000..3751071
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/input1.c
@@ -0,0 +1,45 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+ unsigned char result[128];
+
+ init_dialog();
+
+ strcpy(result, "not this!");
+ retval = dialog_inputbox("this is dialog_inputbox() in action, test #1",
+ "Enter something really profound below, please.",
+ -1, -1, result);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_inputbox was %d (%s)\n", retval, result);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/input2.c b/gnu/lib/libodialog/TESTS/input2.c
new file mode 100644
index 0000000..827c052
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/input2.c
@@ -0,0 +1,47 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+ unsigned char result[128];
+
+ init_dialog();
+
+ result[0]='\0';
+ DialogInputAttrs |= DITEM_NO_ECHO;
+ retval = dialog_inputbox("this is dialog_inputbox() in action, test #2 (no echo)",
+ "Enter something really secret below, please.",
+ -1, -1, result);
+ DialogInputAttrs &= DITEM_NO_ECHO;
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_inputbox was %d (%s)\n", retval, result);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/menu1.c b/gnu/lib/libodialog/TESTS/menu1.c
new file mode 100644
index 0000000..640157a
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/menu1.c
@@ -0,0 +1,96 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Start of hook functions */
+static enum { nowhere, berlin, rome, ny } where;
+
+static int
+_menu1_berlin_action(dialogMenuItem *self)
+{
+ if (where == berlin) {
+ dialog_mesgbox("excuse me?", "But you're already *in* Berlin!", -1, -1);
+ }
+ else {
+ where = berlin;
+ dialog_mesgbox("whoosh!", "Welcome to Berlin! Have a beer!", -1, -1);
+ }
+ return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
+}
+
+static int
+_menu1_rome_action(dialogMenuItem *self)
+{
+ if (where == rome) {
+ dialog_mesgbox("The wine must be getting to you..", "You're already in Rome!", -1, -1);
+ }
+ else {
+ where = rome;
+ dialog_mesgbox("whoosh!", "Welcome to Rome! Have a coffee!", -1, -1);
+ }
+ return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
+}
+
+static int
+_menu1_ny_action(dialogMenuItem *self)
+{
+ if (where == ny) {
+ dialog_mesgbox("Say what?", "You're already there!", -1, -1);
+ }
+ else {
+ where = ny;
+ dialog_mesgbox("whoosh!", "Welcome to New York! Now go someplace else!", -1, -1);
+ }
+ return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
+}
+
+/* menu1 - show off the "fire" action hook */
+/* prompt title checked fire */
+static dialogMenuItem menu1[] = {
+ { "Berlin", "Go visit Germany's new capitol", NULL, _menu1_berlin_action },
+ { "Rome", "Go visit the Roman ruins", NULL, _menu1_rome_action },
+ { "New York", "Go visit the streets of New York", NULL, _menu1_ny_action },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_menu("this is dialog_menu() in action, test #1",
+ "this simple menu shows off some of the straight-forward features\n"
+ "of the new menu system's action dispatch hooks. Select Cancel to leave",
+ -1, -1, 3, -3, menu1, NULL, NULL, NULL);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_menu was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/menu2.c b/gnu/lib/libodialog/TESTS/menu2.c
new file mode 100644
index 0000000..1545cd8
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/menu2.c
@@ -0,0 +1,96 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Start of hook functions */
+static enum { nowhere, berlin, rome, ny } where;
+
+static int
+_menu1_berlin_action(dialogMenuItem *self)
+{
+ if (where == berlin)
+ dialog_mesgbox("excuse me?", "But you're already *in* Berlin!", -1, -1);
+ else {
+ where = berlin;
+ dialog_mesgbox("whoosh!", "Welcome to Berlin! Have a beer!", -1, -1);
+ }
+ return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
+}
+
+static int
+_menu1_rome_action(dialogMenuItem *self)
+{
+ if (where == rome)
+ dialog_mesgbox("The wine must be getting to you..", "You're already in Rome!", -1, -1);
+ else {
+ where = rome;
+ dialog_mesgbox("whoosh!", "Welcome to Rome! Have a coffee!", -1, -1);
+ }
+ return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
+}
+
+static int
+_menu1_ny_action(dialogMenuItem *self)
+{
+ if (where == ny)
+ dialog_mesgbox("Say what?", "You're already there!", -1, -1);
+ else {
+ where = ny;
+ dialog_mesgbox("whoosh!", "Welcome to New York! Now go someplace else!", -1, -1);
+ }
+ return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
+}
+
+/* menu1 - show off the "fire" action hook */
+/* prompt title checked fire */
+static dialogMenuItem menu1[] = {
+ { "Berlin", "Go visit Germany's new capitol", NULL, _menu1_berlin_action },
+ { "Rome", "Go visit the Roman ruins", NULL, _menu1_rome_action },
+ { "New York", "Go visit the streets of New York", NULL, _menu1_ny_action },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ use_helpfile("menu2.c");
+ use_helpline("Type F1 to view the source for this demo");
+ retval = dialog_menu("this is dialog_menu() in action, test #2",
+ "this simple menu shows off some of the straight-forward features\n"
+ "of the new menu system's action dispatch hooks as well as a helpline\n"
+ "and a helpfile. Select Cancel to leave",
+ -1, -1, 3, -3, menu1, NULL, NULL, NULL);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_menu was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/menu3.c b/gnu/lib/libodialog/TESTS/menu3.c
new file mode 100644
index 0000000..3a7a137
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/menu3.c
@@ -0,0 +1,107 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Hook functions */
+
+static int
+stop(dialogMenuItem *self)
+{
+ dialog_mesgbox("!", "I'm no idiot!", -1, -1);
+ return DITEM_SUCCESS;
+}
+
+static int
+maybe(dialogMenuItem *self)
+{
+ dialog_mesgbox("!", "I said don't rush me! I'm THINKING!", -1, -1);
+ return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
+}
+
+/* Dummy menu just to show of the ability */
+static char *insurance[] = {
+ "1,000,000", "Mondo insurance policy", "Off",
+ "5,000,000", "Mega insurance policy", "Off",
+ "10,000,000", "Friend! Most Favored customer!", "On"
+};
+
+static void
+preinsure(dialogMenuItem *self, int is_selected)
+{
+ if (is_selected) {
+ static WINDOW *w;
+
+ /* This has to be here first if you want to see selection traverse properly in the invoking menu */
+ refresh();
+
+ w = dupwin(newscr);
+ DialogX = 1;
+ DialogY = 13;
+ dialog_radiolist("How much insurance would you like to take out?",
+ "If you're really going to do this, we recommend some insurance\n"
+ "first! What kind of life insurance policy would you like?",
+ -1, -1, 3, 3, insurance, NULL);
+ touchwin(w);
+ wrefresh(w);
+ delwin(w);
+ }
+}
+
+/*
+ * Show a simple menu that puts up a sub menu when a certain item is traversed to
+ */
+
+/* prompt title checked fire sel */
+static dialogMenuItem doit[] = {
+ { "Rah!" },
+ { "No way!" },
+ { "Stop", "No, I'm not going to do that!", NULL, stop, NULL },
+ { "Maybe", "I'm still thinking about it, don't rush me!", NULL, maybe, NULL, },
+ { "Go", "Yes! Yes! I want to do it!", NULL, NULL, preinsure },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+
+ DialogX = 5;
+ DialogY = 1;
+ retval = dialog_menu("Do you have the GUTS?",
+ "C'mon, macho man! Do you have what it takes to do something REALLY\n"
+ "dangerous and stupid? WHAT ARE YOU WAITING FOR?!",
+ -1, -1, 3, -3, doit + 2, (char *)TRUE, NULL, NULL);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_menu was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/msg.c b/gnu/lib/libodialog/TESTS/msg.c
new file mode 100644
index 0000000..c6f590f
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/msg.c
@@ -0,0 +1,42 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_msgbox("This is dialog_msgbox() in action with pause on", "Hi there. Please press return now.",
+ -1, -1, 1);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_msgbox was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/prgbox.c b/gnu/lib/libodialog/TESTS/prgbox.c
new file mode 100644
index 0000000..2da4611
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/prgbox.c
@@ -0,0 +1,41 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_prgbox("This is dialog_prgbox() in action with cal(1)", "cal", 14, 50, TRUE, TRUE);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_prgbox was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/radio1.c b/gnu/lib/libodialog/TESTS/radio1.c
new file mode 100644
index 0000000..c4eeffd
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/radio1.c
@@ -0,0 +1,71 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Hook functions */
+
+static int spending;
+
+static int
+check(dialogMenuItem *self)
+{
+ return ((int)(intptr_t)self->data == spending);
+}
+
+static int
+spend(dialogMenuItem *self)
+{
+ spending = (int)(intptr_t)self->data;
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+/* menu5 - Show a simple radiolist menu that inherits the radio appearance by default */
+/* prompt title checked fire sel data */
+static dialogMenuItem menu5[] = {
+ { "1000", "Spend $1,000", check, spend, NULL, (void *)1000 },
+ { "500", "Spend $500", check, spend, NULL, (void *)500 },
+ { "100", "Spend $100", check, spend, NULL, (void *)100 },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+
+ retval = dialog_radiolist("this is dialog_radiolist() in action, test #1",
+ "this radio menu shows off some of the straight-forward features\n"
+ "of the new menu system's check & fire dispatch hooks", -1, -1, 3, -3, menu5, NULL);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_radiolist was %d (money set to %d)\n", retval, spending);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/radio2.c b/gnu/lib/libodialog/TESTS/radio2.c
new file mode 100644
index 0000000..15e353c
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/radio2.c
@@ -0,0 +1,89 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Hook functions */
+
+static char bachelor[10], bachelette[10];
+
+static int
+getBachelor(dialogMenuItem *self)
+{
+ return !strcmp(bachelor, self->prompt);
+}
+
+static int
+setBachelor(dialogMenuItem *self)
+{
+ strcpy(bachelor, self->prompt);
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+static int
+getBachelette(dialogMenuItem *self)
+{
+ return !strcmp(bachelette, self->prompt);
+}
+
+static int
+setBachelette(dialogMenuItem *self)
+{
+ strcpy(bachelette, self->prompt);
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+/* menu6- More complex radiolist menu that creates two groups in a single menu */
+/* prompt title checked fire */
+static dialogMenuItem menu6[] = {
+ { "Tom", "Tom's a dynamic shoe salesman from Tulsa, OK!", getBachelor, setBachelor },
+ { "Dick", "Dick's a retired engine inspector from McDonnell-Douglas!", getBachelor, setBachelor },
+ { "Harry", "Harry's a professional female impersonator from Las Vegas!", getBachelor, setBachelor },
+ { "-----", "----------------------------------", NULL, NULL, NULL, NULL, ' ', ' ', ' ' },
+ { "Jane", "Jane's a twice-divorced housewife from Moose, Oregon!", getBachelette, setBachelette },
+ { "Sally", "Sally's a shy Human Resources Manager for IBM!", getBachelette, setBachelette },
+ { "Mary", "Mary's an energetic serial killer on the lam!", getBachelette, setBachelette },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_radiolist("this is dialog_radiolist() in action, test #2",
+ "Welcome to \"The Love Blender!\" - America's favorite game show\n"
+ "where YOU, the contestant, get to choose which of these two\n"
+ "fine specimens of humanity will go home together, whether they\n"
+ "like it or not!", -1, -1, 7, -7, menu6, NULL);
+ dialog_clear();
+ fprintf(stderr, "I'm sure that %s and %s will be very happy together!\n", bachelor, bachelette);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/radio3.c b/gnu/lib/libodialog/TESTS/radio3.c
new file mode 100644
index 0000000..2175358
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/radio3.c
@@ -0,0 +1,98 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Hook functions */
+
+static int spending;
+
+static int
+check(dialogMenuItem *self)
+{
+ return ((int)(intptr_t)self->data == spending);
+}
+
+static int
+spend(dialogMenuItem *self)
+{
+ spending = (int)(intptr_t)self->data;
+ return DITEM_SUCCESS | DITEM_REDRAW;
+}
+
+static void
+ask(dialogMenuItem *self, int is_selected)
+{
+ if (is_selected) {
+ char *str;
+
+ if (!strcmp(self->prompt, "1000"))
+ str = "You'd better ask both your parents first! ";
+ else if (!strcmp(self->prompt, "500"))
+ str = "You'd better at least ask your Dad! ";
+ else
+ str = "Yes, being frugal is probably a good idea!";
+ DialogX = 15;
+ DialogY = 17;
+ dialog_msgbox("Free Advice", str, -1, -1, 0);
+ }
+}
+
+/*
+ * menu5 - Show a simple radiolist menu that inherits the radio appearance by default and appears at
+ * a different location, leaving room for a msg box below it. This shows off the DialogX/DialogY extensions.
+ */
+
+/* prompt title checked fire sel data */
+static dialogMenuItem menu5[] = {
+ { "1000", "Spend $1,000", check, spend, ask, (void *)1000 },
+ { "500", "Spend $500", check, spend, ask, (void *)500 },
+ { "100", "Spend $100", check, spend, ask, (void *)100 },
+};
+
+/* End of hook functions */
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+
+ DialogX = 5;
+ DialogY = 1;
+ retval = dialog_radiolist("this is dialog_radiolist() in action, test #3",
+ "This radio menu shows off the ability to put dialog menus and other\n"
+ "controls at different locations, as well as the `selected' hook which\n"
+ "lets you follow the traversal of the selection bar as well as what's\n"
+ "selected.",
+ -1, -1, 3, -3, menu5, NULL);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_radiolist was %d (money set to %d)\n", retval, spending);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/text.c b/gnu/lib/libodialog/TESTS/text.c
new file mode 100644
index 0000000..e071937
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/text.c
@@ -0,0 +1,41 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_textbox("This is dialog_textbox() in action with /etc/passwd", "/etc/passwd", 10, 60);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_textbox was %d\n", retval);
+
+ end_dialog();
+ return 0;
+}
diff --git a/gnu/lib/libodialog/TESTS/tree.c b/gnu/lib/libodialog/TESTS/tree.c
new file mode 100644
index 0000000..c69b52e
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/tree.c
@@ -0,0 +1,111 @@
+/*
+ * tree.c
+ *
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1998, Anatoly A. Orehovsky
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dialog.h>
+
+unsigned char *names[] = {
+ "/",
+ "/dev",
+ "/dev/fd",
+ "/tmp",
+ "/usr",
+ "/var",
+ "/home",
+ "/stand",
+ "/stand/etc",
+ "/stand/en_US.ISO8859-1",
+ "/stand/info",
+ "/stand/info/bin",
+ "/stand/info/des",
+ "/stand/info/games",
+ "/stand/info/manpages",
+ "/stand/info/proflibs",
+ "/stand/info/dict",
+ "/stand/info/info",
+ "/stand/info/src",
+ "/etc",
+ "/etc/gnats",
+ "/etc/kerberosIV",
+ "/etc/mtree",
+ "/etc/namedb",
+ "/etc/ppp",
+ "/etc/uucp",
+ "/etc/sliphome",
+ "/proc",
+ "/lkm",
+ "/mnt",
+ "/root",
+ "/sbin",
+ "/bin",
+ 0
+};
+
+unsigned char *names1[] = {
+ "a",
+ "a:b",
+ "a:b:c",
+ "a:d"
+};
+
+int
+main(int argc, char **argv)
+{
+ int retval;
+ unsigned char *tresult;
+ char comstr[BUFSIZ];
+
+ init_dialog();
+ do {
+ use_helpline("Press OK for listing directory");
+ retval = dialog_tree(names,
+ sizeof(names)/sizeof(unsigned char *) - 1,
+ '/',
+ "tree dialog box example",
+ "Typical find -x / -type d output",
+ -1, -1, 15,
+ &tresult);
+
+ if (retval)
+ break;
+
+ use_helpline(NULL);
+ (void)snprintf(comstr, sizeof(comstr),
+ "ls -CF %s", tresult);
+
+ retval = dialog_prgbox(
+ comstr,
+ comstr, 20, 60, TRUE, TRUE);
+
+ dialog_clear();
+
+ retval = dialog_tree(names1,
+ sizeof(names1)/sizeof(unsigned char *),
+ ':',
+ "tree dialog box example",
+ "Other tree",
+ -1, -1, 5,
+ &tresult);
+ if (!retval)
+ {
+ dialog_clear();
+ }
+ } while (!retval);
+
+ dialog_update();
+
+ dialog_clear();
+
+ end_dialog();
+
+ exit(retval);
+}
diff --git a/gnu/lib/libodialog/TESTS/yesno.c b/gnu/lib/libodialog/TESTS/yesno.c
new file mode 100644
index 0000000..647b51c
--- /dev/null
+++ b/gnu/lib/libodialog/TESTS/yesno.c
@@ -0,0 +1,45 @@
+/*
+ * small test-driver for new dialog functionality
+ *
+ * Copyright (c) 1995, Jordan Hubbard
+ *
+ * All rights reserved.
+ *
+ * This source code may be used, modified, copied, distributed, and
+ * sold, in both source and binary form provided that the above
+ * copyright and these terms are retained, verbatim, as the first
+ * lines of this file. Under no circumstances is the author
+ * responsible for the proper functioning of the software nor does
+ * the author assume any responsibility for damages incurred with
+ * its use.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <dialog.h>
+
+/* Kick it off, James! */
+int
+main(int argc, char **argv)
+{
+ int rval1, rval2;
+
+ init_dialog();
+
+ rval1 = dialog_yesno("This is dialog_yesno() in action",
+ "Have you stopped deliberately putting bugs into your code?", -1, -1);
+ dialog_clear();
+ rval2 = dialog_noyes("This is dialog_noyes() in action",
+ "Have you stopped beating your wife?", -1, -1);
+ dialog_clear();
+ end_dialog();
+ fprintf(stderr, "returned value for dialog_yesno was %d\n", rval1);
+ fprintf(stderr, "returned value for dialog_noyes was %d\n", rval2);
+ return 0;
+}
OpenPOWER on IntegriCloud