summaryrefslogtreecommitdiffstats
path: root/lib/libforms/examples
diff options
context:
space:
mode:
authorpaul <paul@FreeBSD.org>1994-11-13 06:45:44 +0000
committerpaul <paul@FreeBSD.org>1994-11-13 06:45:44 +0000
commitec3127d29c777128be8df287d32e7ba0f04fb5a7 (patch)
treecd0c6245017543bfc740dc61d4255fac3130ed97 /lib/libforms/examples
parentf427ece6c5f21d208351c2b2a3e1a7eddad1150d (diff)
downloadFreeBSD-src-ec3127d29c777128be8df287d32e7ba0f04fb5a7.zip
FreeBSD-src-ec3127d29c777128be8df287d32e7ba0f04fb5a7.tar.gz
The start of a forms editor library. Currently implements text and
input fields. It reads a template file passed to init_forms(char *) and creates a curses based form editor. See the examples directory for a basic demo.
Diffstat (limited to 'lib/libforms/examples')
-rw-r--r--lib/libforms/examples/Makefile7
-rw-r--r--lib/libforms/examples/example.frm6
-rw-r--r--lib/libforms/examples/tform.c18
3 files changed, 31 insertions, 0 deletions
diff --git a/lib/libforms/examples/Makefile b/lib/libforms/examples/Makefile
new file mode 100644
index 0000000..5e175b5
--- /dev/null
+++ b/lib/libforms/examples/Makefile
@@ -0,0 +1,7 @@
+PROG = tform
+
+CFLAGS = -Wall -I. -I${.CURDIR}
+LDADD = -lforms -lncurses -ll
+DPADD = ${LIBFORMS} ${LIBNCURSES} ${LIBL}
+
+.include <bsd.prog.mk>
diff --git a/lib/libforms/examples/example.frm b/lib/libforms/examples/example.frm
new file mode 100644
index 0000000..f09ded5
--- /dev/null
+++ b/lib/libforms/examples/example.frm
@@ -0,0 +1,6 @@
+Form template: 0 0 24 79
+Text 0 0 "This is non-editable text field"
+Input 1 2 4 2 3 3 2 2 8 "Prompt1:" 2 20 10 25 "First"
+Input 2 3 1 4 2 2 5 2 8 "Prompt2:" 5 20 10 25 "Second"
+Input 3 4 2 4 1 1 2 40 8 "Prompt3:" 2 50 10 25 "Third"
+Input 4 1 2 1 4 4 10 2 8 "Prompt4:" 10 20 10 25 "Fourth"
diff --git a/lib/libforms/examples/tform.c b/lib/libforms/examples/tform.c
new file mode 100644
index 0000000..48f4d48
--- /dev/null
+++ b/lib/libforms/examples/tform.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <ncurses.h>
+#include <dialog.h>
+#include <forms.h>
+
+extern struct form *form;
+
+void
+main()
+{
+ printf("Testing forms code\n");
+
+ if (init_forms("example.frm") == -1)
+ exit(1);
+
+ edit_form(form);
+}
OpenPOWER on IntegriCloud