summaryrefslogtreecommitdiff
path: root/db-4.8.30/build_vxworks/dbdemo
diff options
context:
space:
mode:
Diffstat (limited to 'db-4.8.30/build_vxworks/dbdemo')
-rw-r--r--db-4.8.30/build_vxworks/dbdemo/README39
-rw-r--r--db-4.8.30/build_vxworks/dbdemo/dbdemo.c177
-rwxr-xr-xdb-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj158
-rwxr-xr-xdb-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj192
4 files changed, 566 insertions, 0 deletions
diff --git a/db-4.8.30/build_vxworks/dbdemo/README b/db-4.8.30/build_vxworks/dbdemo/README
new file mode 100644
index 0000000..1a2c7c7
--- /dev/null
+++ b/db-4.8.30/build_vxworks/dbdemo/README
@@ -0,0 +1,39 @@
+This README describes the steps needed to run a demo example of BerkeleyDB.
+
+1. Read the pages in the Reference Guide that describe building
+ BerkeleyDB on VxWorks:
+
+ $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/intro.html
+ $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/notes.html
+ $(WIND_BASE)/target/src/BerkeleyDB/docs/ref/build_vxworks/faq.html
+
+2. Launch Tornado 2.0 and open up the BerkeleyDB project.
+
+3. Add the demo project to that workspace:
+
+ $(WIND_BASE)/target/src/BerkeleyDB/build_vxworks/demo/dbdemo.wpj
+
+4. Build BerkeleyDB as described in the Reference Guide.
+
+5. Build the dbdemo project.
+
+6. Download BerkeleyDB onto the target.
+
+7. Download the dbdemo project onto the target.
+
+8. Open a windsh to the target and run the demo:
+
+ -> dbdemo "<pathname>/<dbname>"
+
+ Where pathname is a pathname string pointing to a directory that the
+ demo can create a database in. That directory should already exist.
+ The dbname is the name for the database. For example:
+
+ -> dbdemo "/tmp/demo.db"
+
+9. The demo program will ask for input. You can type in any string.
+ The program will add an entry to the database with that string as
+ the key and the reverse of that string as the data item for that key.
+ It will continue asking for input until you hit ^D or enter "quit".
+ Upon doing so, the demo program will display all the keys you have
+ entered as input and their data items.
diff --git a/db-4.8.30/build_vxworks/dbdemo/dbdemo.c b/db-4.8.30/build_vxworks/dbdemo/dbdemo.c
new file mode 100644
index 0000000..6a18b41
--- /dev/null
+++ b/db-4.8.30/build_vxworks/dbdemo/dbdemo.c
@@ -0,0 +1,177 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 1997-2009 Oracle. All rights reserved.
+ *
+ * $Id$
+ */
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef _WIN32
+extern int getopt(int, char * const *, const char *);
+#else
+#include <unistd.h>
+#endif
+
+#include <db_config.h>
+#include <db_int.h>
+
+#define DATABASE "access.db"
+int dbdemo_main __P((int, char *[]));
+int dbdemo_usage __P((void));
+
+int
+dbdemo(args)
+ char *args;
+{
+ int argc;
+ char **argv;
+
+ __db_util_arg("dbdemo", args, &argc, &argv);
+ return (dbdemo_main(argc, argv) ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
+#include <stdio.h>
+#define ERROR_RETURN ERROR
+
+int
+dbdemo_main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ extern int optind, __db_getopt_reset;
+ DB *dbp;
+ DBC *dbcp;
+ DBT key, data;
+ size_t len;
+ int ch, ret, rflag;
+ char *database, *p, *t, buf[1024], rbuf[1024];
+ const char *progname = "dbdemo"; /* Program name. */
+
+ rflag = 0;
+ __db_getopt_reset = 1;
+ while ((ch = getopt(argc, argv, "r")) != EOF)
+ switch (ch) {
+ case 'r':
+ rflag = 1;
+ break;
+ case '?':
+ default:
+ return (dbdemo_usage());
+ }
+ argc -= optind;
+ argv += optind;
+
+ /* Accept optional database name. */
+ database = *argv == NULL ? DATABASE : argv[0];
+
+ /* Optionally discard the database. */
+ if (rflag)
+ (void)remove(database);
+
+ /* Create and initialize database object, open the database. */
+ if ((ret = db_create(&dbp, NULL, 0)) != 0) {
+ fprintf(stderr,
+ "%s: db_create: %s\n", progname, db_strerror(ret));
+ return (EXIT_FAILURE);
+ }
+ dbp->set_errfile(dbp, stderr);
+ dbp->set_errpfx(dbp, progname);
+ if ((ret = dbp->set_pagesize(dbp, 1024)) != 0) {
+ dbp->err(dbp, ret, "set_pagesize");
+ goto err1;
+ }
+ if ((ret = dbp->set_cachesize(dbp, 0, 32 * 1024, 0)) != 0) {
+ dbp->err(dbp, ret, "set_cachesize");
+ goto err1;
+ }
+ if ((ret = dbp->open(dbp,
+ NULL, database, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
+ dbp->err(dbp, ret, "%s: open", database);
+ goto err1;
+ }
+
+ /*
+ * Insert records into the database, where the key is the user
+ * input and the data is the user input in reverse order.
+ */
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+ for (;;) {
+ printf("input> ");
+ fflush(stdout);
+ if (fgets(buf, sizeof(buf), stdin) == NULL)
+ break;
+ if (strcmp(buf, "exit\n") == 0 || strcmp(buf, "quit\n") == 0)
+ break;
+ if ((len = strlen(buf)) <= 1)
+ continue;
+ for (t = rbuf, p = buf + (len - 2); p >= buf;)
+ *t++ = *p--;
+ *t++ = '\0';
+
+ key.data = buf;
+ data.data = rbuf;
+ data.size = key.size = (u_int32_t)len - 1;
+
+ switch (ret =
+ dbp->put(dbp, NULL, &key, &data, DB_NOOVERWRITE)) {
+ case 0:
+ break;
+ default:
+ dbp->err(dbp, ret, "DB->put");
+ if (ret != DB_KEYEXIST)
+ goto err1;
+ break;
+ }
+ }
+ printf("\n");
+
+ /* Acquire a cursor for the database. */
+ if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->cursor");
+ goto err1;
+ }
+
+ /* Initialize the key/data pair so the flags aren't set. */
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+
+ /* Walk through the database and print out the key/data pairs. */
+ while ((ret = dbcp->get(dbcp, &key, &data, DB_NEXT)) == 0)
+ printf("%.*s : %.*s\n",
+ (int)key.size, (char *)key.data,
+ (int)data.size, (char *)data.data);
+ if (ret != DB_NOTFOUND) {
+ dbp->err(dbp, ret, "DBcursor->get");
+ goto err2;
+ }
+
+ /* Close everything down. */
+ if ((ret = dbcp->close(dbcp)) != 0) {
+ dbp->err(dbp, ret, "DBcursor->close");
+ goto err1;
+ }
+ if ((ret = dbp->close(dbp, 0)) != 0) {
+ fprintf(stderr,
+ "%s: DB->close: %s\n", progname, db_strerror(ret));
+ return (EXIT_FAILURE);
+ }
+ return (EXIT_SUCCESS);
+
+err2: (void)dbcp->close(dbcp);
+err1: (void)dbp->close(dbp, 0);
+ return (EXIT_FAILURE);
+}
+
+int
+dbdemo_usage()
+{
+ (void)fprintf(stderr, "usage: ex_access [-r] [database]\n");
+ return (EXIT_FAILURE);
+}
diff --git a/db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj b/db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj
new file mode 100755
index 0000000..04e5edd
--- /dev/null
+++ b/db-4.8.30/build_vxworks/dbdemo/dbdemo20.wpj
@@ -0,0 +1,158 @@
+Document file - DO NOT EDIT
+
+<BEGIN> BUILD_PENTIUMgnu_BUILDRULE
+dbdemo20.out
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_AR
+ar386
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_ARCHIVE
+$(PRJ_DIR)/PENTIUMgnu/dbdemo20.a
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_AS
+cc386
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_CC
+cc386
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS
+-g \
+ -mpentium \
+ -ansi \
+ -nostdinc \
+ -DRW_MULTI_THREAD \
+ -D_REENTRANT \
+ -fvolatile \
+ -nostdlib \
+ -fno-builtin \
+ -fno-defer-pop \
+ -I$(PRJ_DIR)/.. \
+ -I$(PRJ_DIR)/../.. \
+ -I$(WIND_BASE)/target/h \
+ -DCPU=PENTIUM
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_CFLAGS_AS
+-g \
+ -mpentium \
+ -ansi \
+ -nostdinc \
+ -fvolatile \
+ -nostdlib \
+ -fno-builtin \
+ -fno-defer-pop \
+ -P \
+ -x \
+ assembler-with-cpp \
+ -I$(WIND_BASE)/target/h \
+ -DCPU=PENTIUM
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_CPP
+cc386 -E -P -xc
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_LD
+ld386
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_LDDEPS
+
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_LDFLAGS
+-X -N
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_LD_PARTIAL_FLAGS
+-X -r
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_NM
+nm386 -g
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_DEFINE_MACRO
+-D
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_OPTION_INCLUDE_DIR
+-I
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_POST_BUILD_RULE
+
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_PRJ_LIBS
+
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_MACRO_SIZE
+size386
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_RO_DEPEND_PATH
+{$(WIND_BASE)/target/h/} \
+ {$(WIND_BASE)/target/src/} \
+ {$(WIND_BASE)/target/config/}
+<END>
+
+<BEGIN> BUILD_PENTIUMgnu_TC
+::tc_PENTIUMgnu
+<END>
+
+<BEGIN> BUILD_RULE_archive
+
+<END>
+
+<BEGIN> BUILD_RULE_dbdemo20.out
+
+<END>
+
+<BEGIN> BUILD_RULE_objects
+
+<END>
+
+<BEGIN> BUILD__CURRENT
+PENTIUMgnu
+<END>
+
+<BEGIN> BUILD__LIST
+PENTIUMgnu
+<END>
+
+<BEGIN> CORE_INFO_TYPE
+::prj_vxApp
+<END>
+
+<BEGIN> CORE_INFO_VERSION
+2.0
+<END>
+<BEGIN> FILE_dbdemo.c_dependDone
+FALSE
+<END>
+
+<BEGIN> FILE_dbdemo.c_dependencies
+<END>
+
+<BEGIN> FILE_dbdemo.c_objects
+dbdemo.o
+<END>
+
+<BEGIN> FILE_dbdemo.c_tool
+C/C++ compiler
+<END>
+
+<BEGIN> PROJECT_FILES
+$(PRJ_DIR)/dbdemo.c
+<END>
+
+<BEGIN> userComments
+dbdemo
+<END>
diff --git a/db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj b/db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj
new file mode 100755
index 0000000..d2b15f8
--- /dev/null
+++ b/db-4.8.30/build_vxworks/dbdemo/dbdemo22.wpj
@@ -0,0 +1,192 @@
+Document file - DO NOT EDIT
+
+<BEGIN> BUILD_PENTIUM2gnu_BUILDRULE
+dbdemo22.out
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_AR
+arpentium
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_ARCHIVE
+$(PRJ_DIR)/PENTIUM2gnu/dbdemo22.a
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_AS
+ccpentium
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC
+ccpentium
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_CC_ARCH_SPEC
+-mcpu=pentiumpro -march=pentiumpro
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS
+-g \
+ -mcpu=pentiumpro \
+ -march=pentiumpro \
+ -ansi \
+ -nostdlib \
+ -DRW_MULTI_THREAD \
+ -D_REENTRANT \
+ -fvolatile \
+ -fno-builtin \
+ -fno-defer-pop \
+ -I$(PRJ_DIR)/.. \
+ -I$(PRJ_DIR)/../.. \
+ -I$(WIND_BASE)/target/h \
+ -DCPU=PENTIUM2 \
+ -DTOOL_FAMILY=gnu \
+ -DTOOL=gnu
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_CFLAGS_AS
+-g \
+ -mcpu=pentiumpro \
+ -march=pentiumpro \
+ -ansi \
+ -nostdlib \
+ -fno-builtin \
+ -fno-defer-pop \
+ -P \
+ -xassembler-with-cpp \
+ -I$(WIND_BASE)/target/h \
+ -DCPU=PENTIUM2 \
+ -DTOOL_FAMILY=gnu \
+ -DTOOL=gnu
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_CPP
+ccpentium -E -P
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_HEX_FLAGS
+
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD
+ldpentium
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_LDFLAGS
+-X -N
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL
+ccpentium -r -nostdlib -Wl,-X
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_LD_PARTIAL_FLAGS
+-X -r
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_NM
+nmpentium -g
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEFINE_MACRO
+-D
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_DEPEND
+-M -w
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_GENERATE_DEPENDENCY_FILE
+-MD
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_INCLUDE_DIR
+-I
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_LANG_C
+-xc
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_OPTION_UNDEFINE_MACRO
+-U
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_POST_BUILD_RULE
+
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_PRJ_LIBS
+
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_SIZE
+sizepentium
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_MACRO_TOOL_FAMILY
+gnu
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_RO_DEPEND_PATH
+{$(WIND_BASE)/target/h/} \
+ {$(WIND_BASE)/target/src/} \
+ {$(WIND_BASE)/target/config/}
+<END>
+
+<BEGIN> BUILD_PENTIUM2gnu_TC
+::tc_PENTIUM2gnu
+<END>
+
+<BEGIN> BUILD_RULE_archive
+
+<END>
+
+<BEGIN> BUILD_RULE_dbdemo22.out
+
+<END>
+
+<BEGIN> BUILD_RULE_dbdemo22.pl
+
+<END>
+
+<BEGIN> BUILD_RULE_objects
+
+<END>
+
+<BEGIN> BUILD__CURRENT
+PENTIUM2gnu
+<END>
+
+<BEGIN> BUILD__LIST
+PENTIUM2gnu
+<END>
+
+<BEGIN> CORE_INFO_TYPE
+::prj_vxApp
+<END>
+
+<BEGIN> CORE_INFO_VERSION
+2.2
+<END>
+<BEGIN> FILE_dbdemo.c_dependDone
+FALSE
+<END>
+
+<BEGIN> FILE_dbdemo.c_dependencies
+<END>
+
+<BEGIN> FILE_dbdemo.c_objects
+dbdemo.o
+<END>
+
+<BEGIN> FILE_dbdemo.c_tool
+C/C++ compiler
+<END>
+
+<BEGIN> PROJECT_FILES
+$(PRJ_DIR)/dbdemo.c
+<END>
+
+<BEGIN> userComments
+dbdemo
+<END>