summaryrefslogtreecommitdiffstats
path: root/debian/htdig/htdig-3.2.0b6/htdb
diff options
context:
space:
mode:
Diffstat (limited to 'debian/htdig/htdig-3.2.0b6/htdb')
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/.cvsignore11
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/Makefile.am18
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/Makefile.in494
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/htdb_dump.cc609
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/htdb_load.cc973
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/htdb_stat.cc980
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/mifluzdict.cc105
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/mifluzdump.cc74
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/mifluzload.cc104
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/util_sig.cc69
-rw-r--r--debian/htdig/htdig-3.2.0b6/htdb/util_sig.h7
11 files changed, 3444 insertions, 0 deletions
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/.cvsignore b/debian/htdig/htdig-3.2.0b6/htdb/.cvsignore
new file mode 100644
index 00000000..7976e9f9
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/.cvsignore
@@ -0,0 +1,11 @@
+Makefile
+*.lo
+*.la
+.purify
+.pure
+.deps
+.libs
+htdb_dump
+htdb_load
+htdb_stat
+
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/Makefile.am b/debian/htdig/htdig-3.2.0b6/htdb/Makefile.am
new file mode 100644
index 00000000..9691a6fd
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/Makefile.am
@@ -0,0 +1,18 @@
+include $(top_srcdir)/Makefile.config
+
+bin_PROGRAMS = htdb_load htdb_dump htdb_stat
+
+htdb_load_SOURCES = htdb_load.cc
+htdb_load_DEPENDENCIES = $(HTLIBS)
+htdb_load_LDFLAGS = $(PROFILING) ${extra_ldflags}
+htdb_load_LDADD = $(HTLIBS)
+
+htdb_dump_SOURCES = htdb_dump.cc
+htdb_dump_DEPENDENCIES = $(HTLIBS)
+htdb_dump_LDFLAGS = $(PROFILING) ${extra_ldflags}
+htdb_dump_LDADD = $(HTLIBS)
+
+htdb_stat_SOURCES = htdb_stat.cc
+htdb_stat_DEPENDENCIES = $(HTLIBS)
+htdb_stat_LDFLAGS = $(PROFILING) ${extra_ldflags}
+htdb_stat_LDADD = $(HTLIBS)
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/Makefile.in b/debian/htdig/htdig-3.2.0b6/htdb/Makefile.in
new file mode 100644
index 00000000..bf7e4a66
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/Makefile.in
@@ -0,0 +1,494 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# To compile with profiling do the following:
+#
+# make CFLAGS=-g CXXFLAGS=-g PROFILING=-p all
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+APACHE = @APACHE@
+APACHE_MODULES = @APACHE_MODULES@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CGIBIN_DIR = @CGIBIN_DIR@
+COMMON_DIR = @COMMON_DIR@
+CONFIG_DIR = @CONFIG_DIR@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATABASE_DIR = @DATABASE_DIR@
+DEFAULT_CONFIG_FILE = @DEFAULT_CONFIG_FILE@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FIND = @FIND@
+GUNZIP = @GUNZIP@
+HAVE_SSL = @HAVE_SSL@
+HTDIG_MAJOR_VERSION = @HTDIG_MAJOR_VERSION@
+HTDIG_MICRO_VERSION = @HTDIG_MICRO_VERSION@
+HTDIG_MINOR_VERSION = @HTDIG_MINOR_VERSION@
+IMAGE_DIR = @IMAGE_DIR@
+IMAGE_URL_PREFIX = @IMAGE_URL_PREFIX@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MV = @MV@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+RANLIB = @RANLIB@
+RRDTOOL = @RRDTOOL@
+SEARCH_DIR = @SEARCH_DIR@
+SEARCH_FORM = @SEARCH_FORM@
+SED = @SED@
+SENDMAIL = @SENDMAIL@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TAR = @TAR@
+TESTS_FALSE = @TESTS_FALSE@
+TESTS_TRUE = @TESTS_TRUE@
+TIME = @TIME@
+TIMEV = @TIMEV@
+USER = @USER@
+VERSION = @VERSION@
+YACC = @YACC@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+extra_ldflags = @extra_ldflags@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+INCLUDES = -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" \
+ -I$(top_srcdir)/include -I$(top_srcdir)/htlib \
+ -I$(top_srcdir)/htnet -I$(top_srcdir)/htcommon \
+ -I$(top_srcdir)/htword \
+ -I$(top_srcdir)/db -I$(top_builddir)/db \
+ $(LOCAL_DEFINES) $(PROFILING)
+
+
+HTLIBS = $(top_builddir)/htnet/libhtnet.la \
+ $(top_builddir)/htcommon/libcommon.la \
+ $(top_builddir)/htword/libhtword.la \
+ $(top_builddir)/htlib/libht.la \
+ $(top_builddir)/htcommon/libcommon.la \
+ $(top_builddir)/htword/libhtword.la \
+ $(top_builddir)/db/libhtdb.la \
+ $(top_builddir)/htlib/libht.la
+
+
+bin_PROGRAMS = htdb_load htdb_dump htdb_stat
+
+htdb_load_SOURCES = htdb_load.cc
+htdb_load_DEPENDENCIES = $(HTLIBS)
+htdb_load_LDFLAGS = $(PROFILING) ${extra_ldflags}
+htdb_load_LDADD = $(HTLIBS)
+
+htdb_dump_SOURCES = htdb_dump.cc
+htdb_dump_DEPENDENCIES = $(HTLIBS)
+htdb_dump_LDFLAGS = $(PROFILING) ${extra_ldflags}
+htdb_dump_LDADD = $(HTLIBS)
+
+htdb_stat_SOURCES = htdb_stat.cc
+htdb_stat_DEPENDENCIES = $(HTLIBS)
+htdb_stat_LDFLAGS = $(PROFILING) ${extra_ldflags}
+htdb_stat_LDADD = $(HTLIBS)
+subdir = htdb
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+bin_PROGRAMS = htdb_load$(EXEEXT) htdb_dump$(EXEEXT) htdb_stat$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS)
+
+am_htdb_dump_OBJECTS = htdb_dump.$(OBJEXT)
+htdb_dump_OBJECTS = $(am_htdb_dump_OBJECTS)
+am_htdb_load_OBJECTS = htdb_load.$(OBJEXT)
+htdb_load_OBJECTS = $(am_htdb_load_OBJECTS)
+am_htdb_stat_OBJECTS = htdb_stat.$(OBJEXT)
+htdb_stat_OBJECTS = $(am_htdb_stat_OBJECTS)
+
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp =
+am__depfiles_maybe =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(htdb_dump_SOURCES) $(htdb_load_SOURCES) \
+ $(htdb_stat_SOURCES)
+DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/Makefile.config \
+ Makefile.am
+SOURCES = $(htdb_dump_SOURCES) $(htdb_load_SOURCES) $(htdb_stat_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/Makefile.config $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign htdb/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+ rm -f $(DESTDIR)$(bindir)/$$f; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+htdb_dump$(EXEEXT): $(htdb_dump_OBJECTS) $(htdb_dump_DEPENDENCIES)
+ @rm -f htdb_dump$(EXEEXT)
+ $(CXXLINK) $(htdb_dump_LDFLAGS) $(htdb_dump_OBJECTS) $(htdb_dump_LDADD) $(LIBS)
+htdb_load$(EXEEXT): $(htdb_load_OBJECTS) $(htdb_load_DEPENDENCIES)
+ @rm -f htdb_load$(EXEEXT)
+ $(CXXLINK) $(htdb_load_LDFLAGS) $(htdb_load_OBJECTS) $(htdb_load_LDADD) $(LIBS)
+htdb_stat$(EXEEXT): $(htdb_stat_OBJECTS) $(htdb_stat_DEPENDENCIES)
+ @rm -f htdb_stat$(EXEEXT)
+ $(CXXLINK) $(htdb_stat_LDFLAGS) $(htdb_stat_OBJECTS) $(htdb_stat_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.cc.o:
+ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.cc.obj:
+ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.cc.lo:
+ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ $(mkinstalldirs) $(distdir)/..
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/htdb_dump.cc b/debian/htdig/htdig-3.2.0b6/htdb/htdb_dump.cc
new file mode 100644
index 00000000..07c01315
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/htdb_dump.cc
@@ -0,0 +1,609 @@
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 1996, 1997, 1998, 1999
+ * Sleepycat Software. All rights reserved.
+ */
+
+#include "db_config.h"
+#include "htconfig.h"
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1996, 1997, 1998, 1999\n\
+ Sleepycat Software Inc. All rights reserved.\n";
+static const char sccsid[] = "@(#)db_dump.c 11.12 (Sleepycat) 11/10/99";
+#endif
+
+#ifndef NO_SYSTEM_INCLUDES
+#include <sys/types.h>
+
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+#endif
+
+extern "C" {
+#include "db_int.h"
+#include "db_page.h"
+#include "db_shash.h"
+#include "btree.h"
+#include "hash.h"
+#include "lock.h"
+}
+
+#include "WordContext.h"
+#include "WordDBCompress.h"
+
+void configure __P((char *));
+int db_init __P((char *, int));
+int dump __P((DB *, int, int));
+int dump_sub __P((DB *, char *, int, int));
+int is_sub __P((DB *, int *));
+int main __P((int, char *[]));
+void onint __P((int));
+int pheader __P((DB *, char *, int, int));
+int show_subs __P((DB *));
+void siginit __P((void));
+void usage __P((void));
+
+DB_ENV *dbenv;
+int interrupted;
+const char
+ *progname = "htdb_dump"; /* Program name. */
+
+int
+main(int argc, char *argv[])
+{
+ extern char *optarg;
+ extern int optind;
+ DB *dbp;
+ int ch, d_close;
+ int e_close, exitval, lflag, Nflag, pflag, ret, subs, keyflag;
+ char *dopt, *home, *subname;
+ int compress = 0;
+ int wordlist = 0;
+ u_int32_t cachesize = 0;
+ Configuration *config = 0;
+
+ dbp = NULL;
+ d_close = e_close = exitval = lflag = Nflag = pflag = 0;
+ keyflag = 0;
+ dopt = home = subname = NULL;
+ while ((ch = getopt(argc, argv, "d:f:h:klNps:C:zW")) != EOF)
+ switch (ch) {
+ case 'd':
+ dopt = optarg;
+ break;
+ case 'f':
+ if (freopen(optarg, "w", stdout) == NULL) {
+ fprintf(stderr, "%s: %s: reopen: %s\n",
+ progname, optarg, strerror(errno));
+ exit (1);
+ }
+ break;
+ case 'h':
+ home = optarg;
+ break;
+ case 'k':
+ keyflag = 1;
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'N':
+ Nflag = 1;
+ break;
+ case 'p':
+ pflag = 1;
+ break;
+ case 's':
+ subname = optarg;
+ break;
+ case 'C':
+ cachesize = atoi(optarg);
+ break;
+ case 'z':
+ compress = DB_COMPRESS;
+ break;
+ case 'W':
+ wordlist = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 1)
+ usage();
+
+ if (dopt != NULL && pflag) {
+ fprintf(stderr,
+ "%s: the -d and -p options may not both be specified\n",
+ progname);
+ exit (1);
+ }
+ if (lflag && subname != NULL) {
+ fprintf(stderr,
+ "%s: the -l and -s options may not both be specified\n",
+ progname);
+ exit (1);
+ }
+
+ /* Handle possible interruptions. */
+ siginit();
+
+ if(wordlist && compress) {
+ static ConfigDefaults defaults[] = {
+ { "wordlist_wordkey_description", "Word/DocID 32/Flag 8/Location 16"},
+ { "wordlist_env_skip", "true"},
+ { 0, 0, 0 }
+ };
+ config = WordContext::Initialize(defaults);
+ }
+
+ /*
+ * Create an environment object and initialize it for error
+ * reporting.
+ */
+ if ((ret = CDB_db_env_create(&dbenv, 0)) != 0) {
+ fprintf(stderr,
+ "%s: CDB_db_env_create: %s\n", progname, CDB_db_strerror(ret));
+ exit (1);
+ }
+
+ e_close = 1;
+ dbenv->set_errfile(dbenv, stderr);
+ dbenv->set_errpfx(dbenv, progname);
+ if(compress && wordlist) dbenv->mp_cmpr_info = (new WordDBCompress)->CmprInfo();
+
+ /* Initialize the environment. */
+ if (db_init(home, Nflag) != 0)
+ goto err;
+
+ /* Create the DB object and open the file. */
+ if ((ret = CDB_db_create(&dbp, dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "CDB_db_create");
+ goto err;
+ }
+ if(cachesize > 0) dbp->set_cachesize(dbp, 0, cachesize, 1);
+ d_close = 1;
+ if ((ret = dbp->open(dbp,
+ argv[0], subname, DB_UNKNOWN, (DB_RDONLY | compress), 0)) != 0) {
+ dbp->err(dbp, ret, "open: %s", argv[0]);
+ goto err;
+ }
+
+ if (dopt != NULL) {
+ if (CDB___db_dump(dbp, dopt, NULL)) {
+ dbp->err(dbp, ret, "CDB___db_dump: %s", argv[0]);
+ goto err;
+ }
+ } else if (lflag) {
+ if (is_sub(dbp, &subs))
+ goto err;
+ if (subs == 0) {
+ dbp->errx(dbp,
+ "%s: does not contain subdatabases", argv[0]);
+ goto err;
+ }
+ if (show_subs(dbp))
+ goto err;
+ } else {
+ subs = 0;
+ if (subname == NULL && is_sub(dbp, &subs))
+ goto err;
+ if (subs) {
+ if (dump_sub(dbp, argv[0], pflag, keyflag))
+ goto err;
+ } else
+ if (pheader(dbp, NULL, pflag, keyflag)
+ || dump(dbp, pflag, keyflag))
+ goto err;
+ }
+
+ if (0) {
+err: exitval = 1;
+ }
+ if (d_close && (ret = dbp->close(dbp, 0)) != 0) {
+ exitval = 1;
+ dbp->err(dbp, ret, "close");
+ }
+ if (e_close && (ret = dbenv->close(dbenv, 0)) != 0) {
+ exitval = 1;
+ fprintf(stderr,
+ "%s: dbenv->close: %s\n", progname, CDB_db_strerror(ret));
+ }
+
+ if (interrupted) {
+ (void)signal(interrupted, SIG_DFL);
+ (void)raise(interrupted);
+ /* NOTREACHED */
+ }
+
+ if(config) {
+ WordContext::Finish();
+ delete config;
+ }
+
+ return (exitval);
+}
+
+/*
+ * db_init --
+ * Initialize the environment.
+ */
+int
+db_init(char *home, int Nflag)
+{
+ u_int32_t flags;
+ int ret;
+
+ /* Optionally turn mutexes off. */
+ if (Nflag) {
+ if ((ret = dbenv->set_mutexlocks(dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "set_mutexlocks");
+ return (1);
+ }
+ if ((ret = dbenv->set_panic(dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "set_panic");
+ return (1);
+ }
+ }
+
+ /*
+ * Try and use the shared memory pool region when dumping a database,
+ * so our information is as up-to-date as possible, even if the mpool
+ * cache hasn't been flushed.
+ */
+ flags = DB_USE_ENVIRON | DB_INIT_MPOOL | DB_INIT_LOCK;
+ if (dbenv->open(dbenv, home, NULL, flags, 0) == 0)
+ return (0);
+
+ /*
+ * An environment is required because we may be trying to look at
+ * databases in directories other than the current one. We could
+ * avoid using an environment iff the -h option wasn't specified,
+ * but that seems like more work than it's worth.
+ *
+ * No environment exists (or, at least no environment that includes
+ * an mpool region exists). Create one, but make it private so that
+ * no files are actually created.
+ */
+ LF_SET(DB_CREATE | DB_PRIVATE);
+ if ((ret = dbenv->open(dbenv, home, NULL, flags, 0)) == 0)
+ return (0);
+
+ /* An environment is required. */
+ dbenv->err(dbenv, ret, "open");
+ return (1);
+}
+
+/*
+ * pheader --
+ * Write out the header information.
+ */
+int
+pheader(DB *dbp, char *subname, int pflag, int keyflag)
+{
+ DB_BTREE_STAT *btsp;
+ DB_HASH_STAT *hsp;
+ DB_QUEUE_STAT *qsp;
+ int ret;
+
+ printf("VERSION=2\n");
+ printf("format=%s\n", pflag ? "print" : "bytevalue");
+ if (subname != NULL)
+ printf("subdatabase=%s\n", subname);
+ switch (dbp->type) {
+ case DB_BTREE:
+ printf("type=btree\n");
+ if ((ret = dbp->stat(dbp, &btsp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->stat");
+ return (1);
+ }
+ if (F_ISSET(dbp, BTM_RECNUM))
+ printf("recnum=1\n");
+ if (btsp->bt_maxkey != 0)
+ printf("bt_maxkey=%lu\n", (u_long)btsp->bt_maxkey);
+ if (btsp->bt_minkey != 0 && btsp->bt_minkey != DEFMINKEYPAGE)
+ printf("bt_minkey=%lu\n", (u_long)btsp->bt_minkey);
+ break;
+ case DB_HASH:
+ printf("type=hash\n");
+ if ((ret = dbp->stat(dbp, &hsp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->stat");
+ return (1);
+ }
+ if (hsp->hash_ffactor != 0)
+ printf("h_ffactor=%lu\n", (u_long)hsp->hash_ffactor);
+ if (hsp->hash_nelem != 0 || hsp->hash_nrecs != 0)
+ printf("h_nelem=%lu\n",
+ hsp->hash_nelem > hsp->hash_nrecs ?
+ (u_long)hsp->hash_nelem : (u_long)hsp->hash_nrecs);
+ break;
+ case DB_QUEUE:
+ printf("type=queue\n");
+ if ((ret = dbp->stat(dbp, &qsp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->stat");
+ return (1);
+ }
+ printf("re_len=%lu\n", (u_long)qsp->qs_re_len);
+ if (qsp->qs_re_pad != 0 && qsp->qs_re_pad != ' ')
+ printf("re_pad=%#x\n", qsp->qs_re_pad);
+ break;
+ case DB_RECNO:
+ printf("type=recno\n");
+ if ((ret = dbp->stat(dbp, &btsp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->stat");
+ return (1);
+ }
+ if (F_ISSET(dbp, BTM_RENUMBER))
+ printf("renumber=1\n");
+ if (F_ISSET(dbp, BTM_FIXEDLEN))
+ printf("re_len=%lu\n", (u_long)btsp->bt_re_len);
+ if (btsp->bt_re_pad != 0 && btsp->bt_re_pad != ' ')
+ printf("re_pad=%#x\n", btsp->bt_re_pad);
+ break;
+ case DB_UNKNOWN:
+ abort(); /* Impossible. */
+ /* NOTREACHED */
+ }
+
+ if (F_ISSET(dbp, DB_AM_DUP))
+ printf("duplicates=1\n");
+
+ if (!F_ISSET(dbp, DB_AM_PGDEF))
+ printf("db_pagesize=%lu\n", (u_long)dbp->pgsize);
+
+ if (keyflag)
+ printf("keys=1\n");
+
+ printf("HEADER=END\n");
+ return (0);
+}
+
+/*
+ * is_sub --
+ * Return if the database contains subdatabases.
+ */
+int
+is_sub(DB *dbp, int *yesno)
+{
+ DB_BTREE_STAT *btsp;
+ DB_HASH_STAT *hsp;
+ int ret;
+
+ switch (dbp->type) {
+ case DB_BTREE:
+ case DB_RECNO:
+ if ((ret = dbp->stat(dbp, &btsp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->stat");
+ break;
+ }
+ *yesno = btsp->bt_metaflags & BTM_SUBDB ? 1 : 0;
+ free(btsp);
+ break;
+ case DB_HASH:
+ if ((ret = dbp->stat(dbp, &hsp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->stat");
+ break;
+ }
+ *yesno = hsp->hash_metaflags & DB_HASH_SUBDB ? 1 : 0;
+ free(hsp);
+ break;
+ case DB_QUEUE:
+ return (0);
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+ return (ret);
+}
+
+/*
+ * dump_sub --
+ * Dump out the records for a DB containing subdatabases.
+ */
+int
+dump_sub(DB *parent_dbp, char *parent_name, int pflag, int keyflag)
+{
+ DB *dbp;
+ DBC *dbcp;
+ DBT key, data;
+ int ret;
+ char *subdb;
+
+ /*
+ * Get a cursor and step through the database, dumping out each
+ * subdatabase.
+ */
+ if ((ret = parent_dbp->cursor(parent_dbp, NULL, &dbcp, 0)) != 0) {
+ dbenv->err(dbenv, ret, "DB->cursor");
+ return (1);
+ }
+
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ while ((ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT)) == 0) {
+ /* Nul terminate the subdatabase name. */
+ if ((subdb = (char*)malloc(key.size + 1)) == NULL) {
+ dbenv->err(dbenv, ENOMEM, NULL);
+ return (1);
+ }
+ memcpy(subdb, key.data, key.size);
+ subdb[key.size] = '\0';
+
+ /* Create the DB object and open the file. */
+ if ((ret = CDB_db_create(&dbp, dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "CDB_db_create");
+ free(subdb);
+ return (1);
+ }
+ if ((ret = dbp->open(dbp,
+ parent_name, subdb, DB_UNKNOWN, DB_RDONLY, 0)) != 0)
+ dbp->err(dbp, ret,
+ "DB->open: %s:%s", parent_name, subdb);
+ if (ret == 0 &&
+ (pheader(dbp, subdb, pflag, keyflag) ||
+ dump(dbp, pflag, keyflag)))
+ ret = 1;
+ (void)dbp->close(dbp, 0);
+ free(subdb);
+ if (ret != 0)
+ return (1);
+ }
+ if (ret != DB_NOTFOUND) {
+ dbp->err(dbp, ret, "DBcursor->get");
+ return (1);
+ }
+
+ if ((ret = dbcp->c_close(dbcp)) != 0) {
+ dbp->err(dbp, ret, "DBcursor->close");
+ return (1);
+ }
+
+ return (0);
+}
+
+/*
+ * show_subs --
+ * Display the subdatabases for a database.
+ */
+int
+show_subs(DB *dbp)
+{
+ DBC *dbcp;
+ DBT key, data;
+ int ret;
+
+ /*
+ * Get a cursor and step through the database, printing out the key
+ * of each key/data pair.
+ */
+ if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->cursor");
+ return (1);
+ }
+
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ while ((ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT)) == 0) {
+ if ((ret = CDB___db_prdbt(&key, 1, NULL, stdout, 0)) != 0) {
+ dbp->errx(dbp, NULL);
+ return (1);
+ }
+ }
+ if (ret != DB_NOTFOUND) {
+ dbp->err(dbp, ret, "DBcursor->get");
+ return (1);
+ }
+
+ if ((ret = dbcp->c_close(dbcp)) != 0) {
+ dbp->err(dbp, ret, "DBcursor->close");
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * dump --
+ * Dump out the records for a DB.
+ */
+int
+dump(DB *dbp, int pflag, int keyflag)
+{
+ DBC *dbcp;
+ DBT key, data;
+ int ret, is_recno;
+
+ /*
+ * Get a cursor and step through the database, printing out each
+ * key/data pair.
+ */
+ if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->cursor");
+ return (1);
+ }
+
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ is_recno = (dbp->type == DB_RECNO || dbp->type == DB_QUEUE);
+ keyflag = is_recno ? keyflag : 1;
+ while ((ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT)) == 0)
+ if ((keyflag && (ret =
+ CDB___db_prdbt(&key, pflag, " ", stdout, is_recno)) != 0) ||
+ (ret = CDB___db_prdbt(&data, pflag, " ", stdout, 0)) != 0) {
+ dbp->errx(dbp, NULL);
+ return (1);
+ }
+ if (ret != DB_NOTFOUND) {
+ dbp->err(dbp, ret, "DBcursor->get");
+ return (1);
+ }
+
+ if ((ret = dbcp->c_close(dbcp)) != 0) {
+ dbp->err(dbp, ret, "DBcursor->close");
+ return (1);
+ }
+
+ printf("DATA=END\n");
+ return (0);
+}
+
+/*
+ * siginit --
+ * Initialize the set of signals for which we want to clean up.
+ * Generally, we try not to leave the shared regions locked if
+ * we can.
+ */
+void
+siginit()
+{
+#ifdef SIGHUP
+ (void)signal(SIGHUP, onint);
+#endif
+ (void)signal(SIGINT, onint);
+#ifdef SIGPIPE
+ (void)signal(SIGPIPE, onint);
+#endif
+ (void)signal(SIGTERM, onint);
+}
+
+/*
+ * onint --
+ * Interrupt signal handler.
+ */
+void
+onint(int signo)
+{
+ if ((interrupted = signo) == 0)
+ interrupted = SIGINT;
+}
+
+/*
+ * usage --
+ * Display the usage message.
+ */
+void
+usage()
+{
+ (void)fprintf(stderr,
+"usage: htdb_dump [-klNpWz] [-C cachesize] [-d ahr] [-f file] [-h home] [-s subdb] db_file\n");
+ exit(1);
+}
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/htdb_load.cc b/debian/htdig/htdig-3.2.0b6/htdb/htdb_load.cc
new file mode 100644
index 00000000..b52dd1ad
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/htdb_load.cc
@@ -0,0 +1,973 @@
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 1996, 1997, 1998, 1999
+ * Sleepycat Software. All rights reserved.
+ */
+
+#include "db_config.h"
+#include "htconfig.h"
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1996, 1997, 1998, 1999\n\
+ Sleepycat Software Inc. All rights reserved.\n";
+static const char sccsid[] = "@(#)db_load.c 11.6 (Sleepycat) 11/10/99";
+#endif
+
+#ifndef NO_SYSTEM_INCLUDES
+#include <sys/types.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+#endif
+
+extern "C" {
+#include "db_int.h"
+#include "db_page.h"
+#include "db_am.h"
+}
+
+#include "WordDBCompress.h"
+#include "WordContext.h"
+#include "WordKey.h"
+
+
+void badend __P((void));
+void badnum __P((void));
+int configure __P((DB *, char **, char **, int *));
+int db_init __P((char *));
+int dbt_rdump __P((DBT *));
+int dbt_rprint __P((DBT *));
+int dbt_rrecno __P((DBT *));
+int digitize __P((int, int *));
+int linetorn __P((char *, db_recno_t *));
+int load __P((char *, DBTYPE, char **, int, u_int32_t, int, int));
+int main __P((int, char *[]));
+void onint __P((int));
+int rheader __P((DB *, DBTYPE *, char **, int *, int*));
+void siginit __P((void));
+void usage __P((void));
+
+int endodata; /* Reached the end of a database. */
+int endofile; /* Reached the end of the input. */
+int existed; /* Tried to load existing key. */
+u_long lineno; /* Input file line number. */
+int version = 1; /* Input version. */
+
+DB_ENV *dbenv;
+int interrupted;
+const char
+ *progname = "htdb_load"; /* Program name. */
+
+int
+main(int argc, char* argv[])
+{
+ extern char *optarg;
+ extern int optind;
+ DBTYPE dbtype;
+ u_int32_t cachesize = 0;
+ u_int32_t db_nooverwrite;
+ int ch, e_close, exitval, no_header, ret;
+ char **clist, **clp, *home;
+ int compress = 0;
+ int wordlist = 0;
+ Configuration *config = 0;
+
+ home = NULL;
+ db_nooverwrite = 0;
+ e_close = exitval = no_header = 0;
+ dbtype = DB_UNKNOWN;
+
+ /* Allocate enough room for configuration arguments. */
+ if ((clp = clist = (char **)calloc(argc + 1, sizeof(char *))) == NULL) {
+ fprintf(stderr, "%s: %s\n", progname, strerror(ENOMEM));
+ exit(1);
+ }
+
+ while ((ch = getopt(argc, argv, "c:f:h:nTt:C:S:zW")) != EOF)
+ switch (ch) {
+ case 'c':
+ *clp++ = optarg;
+ break;
+ case 'f':
+ if (freopen(optarg, "r", stdin) == NULL) {
+ fprintf(stderr, "%s: %s: reopen: %s\n",
+ progname, optarg, strerror(errno));
+ exit(1);
+ }
+ break;
+ case 'h':
+ home = optarg;
+ break;
+ case 'n':
+ db_nooverwrite = DB_NOOVERWRITE;
+ break;
+ case 'T':
+ no_header = 1;
+ break;
+ case 't':
+ if (strcmp(optarg, "btree") == 0) {
+ dbtype = DB_BTREE;
+ break;
+ }
+ if (strcmp(optarg, "hash") == 0) {
+ dbtype = DB_HASH;
+ break;
+ }
+ if (strcmp(optarg, "recno") == 0) {
+ dbtype = DB_RECNO;
+ break;
+ }
+ if (strcmp(optarg, "queue") == 0) {
+ dbtype = DB_QUEUE;
+ break;
+ }
+ usage();
+ /* NOTREACHED */
+ case 'C':
+ cachesize = atoi(optarg);
+ break;
+ case 'z':
+ compress = DB_COMPRESS;
+ break;
+ case 'W':
+ wordlist = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 1)
+ usage();
+
+ /* Handle possible interruptions. */
+ siginit();
+
+ if(wordlist) {
+ static ConfigDefaults defaults[] = {
+ { "wordlist_wordkey_description", "Word/DocID 32/Flag 8/Location 16"},
+ { "wordlist_env_skip", "true"},
+ { 0, 0, 0 }
+ };
+ config = WordContext::Initialize(defaults);
+ }
+
+ /*
+ * Create an environment object and initialize it for error
+ * reporting.
+ */
+ if ((ret = CDB_db_env_create(&dbenv, 0)) != 0) {
+ fprintf(stderr,
+ "%s: CDB_db_env_create: %s\n", progname, CDB_db_strerror(ret));
+ exit (1);
+ }
+
+ dbenv->set_errfile(dbenv, stderr);
+ dbenv->set_errpfx(dbenv, progname);
+ if(cachesize > 0) dbenv->set_cachesize(dbenv, 0, cachesize, 1);
+ if(compress && wordlist) dbenv->mp_cmpr_info = (new WordDBCompress)->CmprInfo();
+
+ if (db_init(home) != 0)
+ goto shutdown;
+
+ while (!endofile)
+ if (load(argv[0],
+ dbtype, clist, no_header, db_nooverwrite, compress, wordlist) != 0)
+ goto shutdown;
+
+ if (0) {
+shutdown: exitval = 1;
+ }
+ if ((ret = dbenv->close(dbenv, 0)) != 0) {
+ exitval = 1;
+ fprintf(stderr,
+ "%s: dbenv->close: %s\n", progname, CDB_db_strerror(ret));
+ }
+
+ if (interrupted) {
+ (void)signal(interrupted, SIG_DFL);
+ (void)raise(interrupted);
+ /* NOTREACHED */
+ }
+
+ if(config) {
+ WordContext::Finish();
+ delete config;
+ }
+
+ free(clist);
+
+ /* Return 0 on success, 1 if keys existed already, and 2 on failure. */
+ return (exitval == 0 ? (existed == 0 ? 0 : 1) : 2);
+}
+
+/*
+ * load --
+ * Load a database.
+ */
+int
+load(char *name, DBTYPE argtype, char **clist, int no_header, u_int32_t db_nooverwrite, int compress, int wordlist)
+{
+ DB *dbp;
+ DBT key, rkey, data, *readp, *writep;
+ DBTYPE dbtype;
+ db_recno_t recno, datarecno;
+ int checkprint, ret, rval, keys;
+ int keyflag, ascii_recno;
+ char *subdb;
+
+ endodata = 0;
+ subdb = NULL;
+ memset(&key, 0, sizeof(DBT));
+ memset(&data, 0, sizeof(DBT));
+
+ /* Create the DB object. */
+ if ((ret = CDB_db_create(&dbp, dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "CDB_db_create");
+ return (1);
+ }
+
+ if(wordlist) dbp->set_bt_compare(dbp, word_db_cmp);
+
+ dbtype = DB_UNKNOWN;
+ keys = -1;
+ keyflag = -1;
+ /* Read the header -- if there's no header, we expect flat text. */
+ if (no_header) {
+ checkprint = 1;
+ dbtype = argtype;
+ } else {
+ if (rheader(dbp, &dbtype, &subdb, &checkprint, &keys) != 0)
+ goto err;
+ if (endofile)
+ goto done;
+ }
+
+ /*
+ * Apply command-line configuration changes. (We apply command-line
+ * configuration changes to all databases that are loaded, e.g., all
+ * subdatabases.)
+ */
+ if (configure(dbp, clist, &subdb, &keyflag))
+ goto err;
+
+ if (keys != 1) {
+ if (keyflag == 1) {
+ dbp->err(dbp, EINVAL, "No keys specified in file");
+ goto err;
+ }
+ }
+ else if (keyflag == 0) {
+ dbp->err(dbp, EINVAL, "Keys specified in file");
+ goto err;
+ }
+ else
+ keyflag = 1;
+
+ if (dbtype == DB_BTREE || dbtype == DB_HASH) {
+ if (keyflag == 0)
+ dbp->err(dbp,
+ EINVAL, "Btree and Hash must specify keys");
+ else
+ keyflag = 1;
+ }
+
+ if (argtype != DB_UNKNOWN) {
+
+ if (dbtype == DB_RECNO || dbtype == DB_QUEUE)
+ if (keyflag != 1 && argtype != DB_RECNO
+ && argtype != DB_QUEUE){
+ dbenv->errx(dbenv,
+ "improper database type conversion specified");
+ goto err;
+ }
+ dbtype = argtype;
+ }
+
+ if (dbtype == DB_UNKNOWN) {
+ dbenv->errx(dbenv, "no database type specified");
+ goto err;
+ }
+
+ if (keyflag == -1)
+ keyflag = 0;
+
+ if (keyflag == 1 && (dbtype == DB_RECNO || dbtype == DB_QUEUE))
+ ascii_recno = 1;
+ else
+ ascii_recno = 0;
+
+ /* Open the DB file. */
+ if ((ret = dbp->open(dbp,
+ name, subdb, dbtype, (DB_CREATE | compress), CDB___db_omode("rwrwrw"))) != 0) {
+ dbp->err(dbp, ret, "DB->open: %s", name);
+ goto err;
+ }
+
+ /* Initialize the key/data pair. */
+ readp = &key;
+ writep = &key;
+ if (dbtype == DB_RECNO || dbtype == DB_QUEUE) {
+ key.size = sizeof(recno);
+ if (keyflag) {
+ key.data = &datarecno;
+ if (checkprint) {
+ readp = &rkey;
+ goto key_data;
+ }
+ }
+ else
+ key.data = &recno;
+ } else
+key_data: if ((readp->data =
+ (void *)malloc(readp->ulen = 1024)) == NULL) {
+ dbenv->err(dbenv, ENOMEM, NULL);
+ goto err;
+ }
+ if ((data.data = (void *)malloc(data.ulen = 1024)) == NULL) {
+ dbenv->err(dbenv, ENOMEM, NULL);
+ goto err;
+ }
+
+ /* Get each key/data pair and add them to the database. */
+ for (recno = 1; !interrupted; ++recno) {
+ if (!keyflag)
+ if (checkprint) {
+ if (dbt_rprint(&data))
+ goto err;
+ } else {
+ if (dbt_rdump(&data))
+ goto err;
+ }
+ else
+ if (checkprint) {
+ if (dbt_rprint(readp))
+ goto err;
+ if (!endodata && dbt_rprint(&data))
+ goto fmt;
+ } else {
+ if (ascii_recno) {
+ if (dbt_rrecno(readp))
+ goto err;
+ } else
+ if (dbt_rdump(readp))
+ goto err;
+ if (!endodata && dbt_rdump(&data)) {
+fmt: dbenv->errx(dbenv,
+ "odd number of key/data pairs");
+ goto err;
+ }
+ }
+ if (endodata)
+ break;
+ if (readp != writep) {
+ if (sscanf((char*)readp->data, "%ud", &datarecno) != 1)
+ dbenv->errx(dbenv,
+ "%s: non-integer key at line: %d",
+ name, !keyflag ? recno : recno * 2 - 1);
+ if (datarecno == 0)
+ dbenv->errx(dbenv, "%s: zero key at line: %d",
+ name,
+ !keyflag ? recno : recno * 2 - 1);
+ }
+ switch (ret =
+ dbp->put(dbp, NULL, writep, &data, db_nooverwrite)) {
+ case 0:
+ break;
+ case DB_KEYEXIST:
+ existed = 1;
+ dbenv->errx(dbenv,
+ "%s: line %d: key already exists, not loaded:",
+ name,
+ !keyflag ? recno : recno * 2 - 1);
+
+ (void)CDB___db_prdbt(&key, checkprint, 0, stderr, 0);
+ break;
+ default:
+ dbenv->err(dbenv, ret, NULL);
+ goto err;
+ }
+ }
+done: rval = 0;
+
+ if (0) {
+err: rval = 1;
+ }
+
+ /* Close the database. */
+ if ((ret = dbp->close(dbp, 0)) != 0) {
+ dbp->err(dbp, ret, "DB->close");
+ rval = 1;
+ }
+
+ /* Free allocated memory. */
+ if (subdb != NULL)
+ free(subdb);
+ if (dbtype != DB_RECNO && dbtype != DB_QUEUE)
+ free(key.data);
+ free(data.data);
+
+ return (rval);
+}
+
+/*
+ * db_init --
+ * Initialize the environment.
+ */
+int
+db_init(char *home)
+{
+ u_int32_t flags;
+ int ret;
+
+ /* We may be loading into a live environment. Try and join. */
+ flags = DB_USE_ENVIRON |
+ DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN;
+ if (dbenv->open(dbenv, home, NULL, flags, 0) == 0)
+ return (0);
+ /*
+ * We're trying to load a database.
+ *
+ * An environment is required because we may be trying to look at
+ * databases in directories other than the current one. We could
+ * avoid using an environment iff the -h option wasn't specified,
+ * but that seems like more work than it's worth.
+ *
+ * No environment exists (or, at least no environment that includes
+ * an mpool region exists). Create one, but make it private so that
+ * no files are actually created.
+ */
+ LF_CLR(DB_INIT_LOG | DB_INIT_TXN);
+ LF_SET(DB_CREATE | DB_PRIVATE);
+ if ((ret = dbenv->open(dbenv, home, NULL, flags, 0)) == 0)
+ return (0);
+
+ /* An environment is required. */
+ dbenv->err(dbenv, ret, "DBENV->open");
+ return (1);
+}
+
+#define FLAG(name, value, keyword, flag) \
+ if (strcmp(name, keyword) == 0) { \
+ switch (*value) { \
+ case '1': \
+ if ((ret = dbp->set_flags(dbp, flag)) != 0) { \
+ dbp->err(dbp, ret, "%s: set_flags: %s", \
+ progname, name); \
+ return (1); \
+ } \
+ break; \
+ case '0': \
+ break; \
+ default: \
+ badnum(); \
+ return (1); \
+ } \
+ continue; \
+ }
+#define NUMBER(name, value, keyword, func) \
+ if (strcmp(name, keyword) == 0) { \
+ if (CDB___db_getlong(dbp, \
+ NULL, value, 1, LONG_MAX, &val) != 0) \
+ return (1); \
+ if ((ret = dbp->func(dbp, val)) != 0) \
+ goto nameerr; \
+ continue; \
+ }
+#define STRING(name, value, keyword, func) \
+ if (strcmp(name, keyword) == 0) { \
+ if ((ret = dbp->func(dbp, value[0])) != 0) \
+ goto nameerr; \
+ continue; \
+ }
+
+/*
+ * configure --
+ * Handle command-line configuration options.
+ */
+int
+configure(DB *dbp, char **clp, char **subdbp, int *keysp)
+{
+ long val;
+ int ret, savech;
+ char *name, *value;
+
+ for (; (name = *clp) != NULL; *--value = savech, ++clp) {
+ if ((value = strchr(name, '=')) == NULL) {
+ dbp->errx(dbp,
+ "command-line configuration uses name=value format");
+ return (1);
+ }
+ savech = *value;
+ *value++ = '\0';
+
+ if (strcmp(name, "subdatabase") == 0) {
+ if ((*subdbp = strdup(value)) == NULL) {
+ dbp->err(dbp, ENOMEM, NULL);
+ return (1);
+ }
+ continue;
+ }
+ if (strcmp(name, "keys") == 0) {
+ if (strcmp(value, "1") == 0)
+ *keysp = 1;
+ else if (strcmp(value, "0") == 0)
+ *keysp = 0;
+ else {
+ badnum();
+ return (1);
+ }
+ continue;
+ }
+
+#ifdef notyet
+ NUMBER(name, value, "bt_maxkey", set_bt_maxkey);
+#endif
+ NUMBER(name, value, "bt_minkey", set_bt_minkey);
+ NUMBER(name, value, "db_lorder", set_lorder);
+ NUMBER(name, value, "db_pagesize", set_pagesize);
+ FLAG(name, value, "duplicates", DB_DUP);
+ NUMBER(name, value, "h_ffactor", set_h_ffactor);
+ NUMBER(name, value, "h_nelem", set_h_nelem);
+ NUMBER(name, value, "re_len", set_re_len);
+ STRING(name, value, "re_pad", set_re_pad);
+ FLAG(name, value, "recnum", DB_RECNUM);
+ FLAG(name, value, "renumber", DB_RENUMBER);
+
+ dbp->errx(dbp,
+ "unknown command-line configuration keyword");
+ return (1);
+ }
+ return (0);
+
+nameerr:
+ dbp->err(dbp, ret, "%s: %s=%s", progname, name, value);
+ return (1);
+}
+
+/*
+ * rheader --
+ * Read the header message.
+ */
+int
+rheader(DB *dbp, DBTYPE *dbtypep, char **subdbp, int *checkprintp, int *keysp)
+{
+ long val;
+ int first, ret;
+ char *name, *value, *p, buf[128];
+
+ *dbtypep = DB_UNKNOWN;
+ *checkprintp = 0;
+
+ for (first = 1;; first = 0) {
+ ++lineno;
+
+ /* If we don't see the expected information, it's an error. */
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ if (!first || ferror(stdin))
+ goto badfmt;
+ endofile = 1;
+ break;
+ }
+ if ((p = strchr(name = buf, '=')) == NULL)
+ goto badfmt;
+ *p++ = '\0';
+ if ((p = strchr(value = p, '\n')) == NULL)
+ goto badfmt;
+ *p = '\0';
+ if (name[0] == '\0' || value[0] == '\0')
+ goto badfmt;
+
+ if (strcmp(name, "HEADER") == 0)
+ break;
+ if (strcmp(name, "VERSION") == 0) {
+ /*
+ * Version 1 didn't have a "VERSION" header line, we
+ * only support versions 1 and 2 of the dump format.
+ */
+ version = atoi(value);
+
+ if (version != 2) {
+ dbp->errx(dbp,
+ "line %lu: VERSION %d is unsupported",
+ lineno, version);
+ return (1);
+ }
+ continue;
+ }
+ if (strcmp(name, "format") == 0) {
+ if (strcmp(value, "bytevalue") == 0) {
+ *checkprintp = 0;
+ continue;
+ }
+ if (strcmp(value, "print") == 0) {
+ *checkprintp = 1;
+ continue;
+ }
+ goto badfmt;
+ }
+ if (strcmp(name, "type") == 0) {
+ if (strcmp(value, "btree") == 0) {
+ *dbtypep = DB_BTREE;
+ continue;
+ }
+ if (strcmp(value, "hash") == 0) {
+ *dbtypep = DB_HASH;
+ continue;
+ }
+ if (strcmp(value, "recno") == 0) {
+ *dbtypep = DB_RECNO;
+ continue;
+ }
+ if (strcmp(value, "queue") == 0) {
+ *dbtypep = DB_QUEUE;
+ continue;
+ }
+ dbp->errx(dbp, "line %lu: unknown type", lineno);
+ return (1);
+ }
+ if (strcmp(name, "subdatabase") == 0) {
+ if ((*subdbp = strdup(value)) == NULL) {
+ dbp->err(dbp, ENOMEM, NULL);
+ return (1);
+ }
+ continue;
+ }
+ if (strcmp(name, "keys") == 0) {
+ if (strcmp(value, "1") == 0)
+ *keysp = 1;
+ else if (strcmp(value, "0") == 0)
+ *keysp = 0;
+ else {
+ badnum();
+ return (1);
+ }
+ continue;
+ }
+
+#ifdef notyet
+ NUMBER(name, value, "bt_maxkey", set_bt_maxkey);
+#endif
+ NUMBER(name, value, "bt_minkey", set_bt_minkey);
+ NUMBER(name, value, "db_lorder", set_lorder);
+ NUMBER(name, value, "db_pagesize", set_pagesize);
+ FLAG(name, value, "duplicates", DB_DUP);
+ NUMBER(name, value, "h_ffactor", set_h_ffactor);
+ NUMBER(name, value, "h_nelem", set_h_nelem);
+ NUMBER(name, value, "re_len", set_re_len);
+ STRING(name, value, "re_pad", set_re_pad);
+ FLAG(name, value, "recnum", DB_RECNUM);
+ FLAG(name, value, "renumber", DB_RENUMBER);
+
+ dbp->errx(dbp,
+ "unknown input-file header configuration keyword");
+ return (1);
+ }
+ return (0);
+
+nameerr:
+ dbp->err(dbp, ret, "%s: %s=%s", progname, name, value);
+ return (1);
+
+badfmt:
+ dbp->errx(dbp, "line %lu: unexpected format", lineno);
+ return (1);
+}
+
+/*
+ * dbt_rprint --
+ * Read a printable line into a DBT structure.
+ */
+int
+dbt_rprint(DBT *dbtp)
+{
+ u_int32_t len;
+ u_int8_t *p;
+ int c1, c2, e, escape, first;
+ char buf[32];
+
+ ++lineno;
+
+ first = 1;
+ e = escape = 0;
+ for (p = (u_int8_t*)dbtp->data, len = 0; (c1 = getchar()) != '\n';) {
+ if (c1 == EOF) {
+ if (len == 0) {
+ endofile = endodata = 1;
+ return (0);
+ }
+ badend();
+ return (1);
+ }
+ if (first) {
+ first = 0;
+ if (version > 1) {
+ if (c1 != ' ') {
+ buf[0] = c1;
+ if (fgets(buf + 1,
+ sizeof(buf) - 1, stdin) == NULL ||
+ strcmp(buf, "DATA=END\n") != 0) {
+ badend();
+ return (1);
+ }
+ endodata = 1;
+ return (0);
+ }
+ continue;
+ }
+ }
+ if (escape) {
+ if (c1 != '\\') {
+ if ((c2 = getchar()) == EOF) {
+ badend();
+ return (1);
+ }
+ c1 = digitize(c1, &e) << 4 | digitize(c2, &e);
+ if (e)
+ return (1);
+ }
+ escape = 0;
+ } else
+ if (c1 == '\\') {
+ escape = 1;
+ continue;
+ }
+ if (len >= dbtp->ulen - 10) {
+ dbtp->ulen *= 2;
+ if ((dbtp->data =
+ (void *)realloc(dbtp->data, dbtp->ulen)) == NULL) {
+ dbenv->err(dbenv, ENOMEM, NULL);
+ return (1);
+ }
+ p = (u_int8_t *)dbtp->data + len;
+ }
+ ++len;
+ *p++ = c1;
+ }
+ dbtp->size = len;
+
+ return (0);
+}
+
+/*
+ * dbt_rdump --
+ * Read a byte dump line into a DBT structure.
+ */
+int
+dbt_rdump(DBT *dbtp)
+{
+ u_int32_t len;
+ u_int8_t *p;
+ int c1, c2, e, first;
+ char buf[32];
+
+ ++lineno;
+
+ first = 1;
+ e = 0;
+ for (p = (u_int8_t*)dbtp->data, len = 0; (c1 = getchar()) != '\n';) {
+ if (c1 == EOF) {
+ if (len == 0) {
+ endofile = endodata = 1;
+ return (0);
+ }
+ badend();
+ return (1);
+ }
+ if (first) {
+ first = 0;
+ if (version > 1) {
+ if (c1 != ' ') {
+ buf[0] = c1;
+ if (fgets(buf + 1,
+ sizeof(buf) - 1, stdin) == NULL ||
+ strcmp(buf, "DATA=END\n") != 0) {
+ badend();
+ return (1);
+ }
+ endodata = 1;
+ return (0);
+ }
+ continue;
+ }
+ }
+ if ((c2 = getchar()) == EOF) {
+ badend();
+ return (1);
+ }
+ if (len >= dbtp->ulen - 10) {
+ dbtp->ulen *= 2;
+ if ((dbtp->data =
+ (void *)realloc(dbtp->data, dbtp->ulen)) == NULL) {
+ dbenv->err(dbenv, ENOMEM, NULL);
+ return (1);
+ }
+ p = (u_int8_t *)dbtp->data + len;
+ }
+ ++len;
+ *p++ = digitize(c1, &e) << 4 | digitize(c2, &e);
+ if (e)
+ return (1);
+ }
+ dbtp->size = len;
+
+ return (0);
+}
+
+/*
+ * dbt_rrecno --
+ * Read a record number dump line into a DBT structure.
+ */
+int
+dbt_rrecno(DBT *dbtp)
+{
+ char buf[32];
+
+ ++lineno;
+
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ endofile = endodata = 1;
+ return (0);
+ }
+
+ if (strcmp(buf, "DATA=END\n") == 0) {
+ endodata = 1;
+ return (0);
+ }
+
+ if (buf[0] != ' ' || linetorn(buf + 1, (db_recno_t *)dbtp->data)) {
+ badend();
+ return (1);
+ }
+
+ dbtp->size = sizeof(db_recno_t);
+ return (0);
+}
+
+/*
+ * linetorn --
+ * Given a character string representing a recno in ASCII text,
+ * return the db_recno_t.
+ */
+int
+linetorn(char *buf, db_recno_t *recno)
+{
+ errno = 0;
+ *recno = strtoul(buf, NULL, 0);
+ return (errno ? 1 : 0);
+}
+
+/*
+ * digitize --
+ * Convert a character to an integer.
+ */
+int
+digitize(int c, int *errorp)
+{
+ switch (c) { /* Don't depend on ASCII ordering. */
+ case '0': return (0);
+ case '1': return (1);
+ case '2': return (2);
+ case '3': return (3);
+ case '4': return (4);
+ case '5': return (5);
+ case '6': return (6);
+ case '7': return (7);
+ case '8': return (8);
+ case '9': return (9);
+ case 'a': return (10);
+ case 'b': return (11);
+ case 'c': return (12);
+ case 'd': return (13);
+ case 'e': return (14);
+ case 'f': return (15);
+ }
+
+ dbenv->errx(dbenv, "unexpected hexadecimal value");
+ *errorp = 1;
+
+ return (0);
+}
+
+/*
+ * badnum --
+ * Display the bad number message.
+ */
+void
+badnum()
+{
+ dbenv->errx(dbenv,
+ "boolean name=value pairs require a value of 0 or 1");
+}
+
+/*
+ * badend --
+ * Display the bad end to input message.
+ */
+void
+badend()
+{
+ dbenv->errx(dbenv, "unexpected end of input data or key/data pair");
+}
+
+/*
+ * siginit --
+ * Initialize the set of signals for which we want to clean up.
+ * Generally, we try not to leave the shared regions locked if
+ * we can.
+ */
+void
+siginit()
+{
+#ifdef SIGHUP
+ (void)signal(SIGHUP, onint);
+#endif
+ (void)signal(SIGINT, onint);
+#ifdef SIGPIPE
+ (void)signal(SIGPIPE, onint);
+#endif
+ (void)signal(SIGTERM, onint);
+}
+
+/*
+ * onint --
+ * Interrupt signal handler.
+ */
+void
+onint(int signo)
+{
+ if ((interrupted = signo) == 0)
+ interrupted = SIGINT;
+}
+
+/*
+ * usage --
+ * Display the usage message.
+ */
+void
+usage()
+{
+ (void)fprintf(stderr, "%s\n\t%s\n",
+ "usage: htdb_load [-nTzW]",
+ "[-c name=value] [-f file] [-h home] [-C cachesize] [-t btree | hash | recno] db_file");
+ exit(1);
+}
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/htdb_stat.cc b/debian/htdig/htdig-3.2.0b6/htdb/htdb_stat.cc
new file mode 100644
index 00000000..00ba80b4
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/htdb_stat.cc
@@ -0,0 +1,980 @@
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 1996, 1997, 1998, 1999
+ * Sleepycat Software. All rights reserved.
+ */
+
+#include "db_config.h"
+#include "htconfig.h"
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1996, 1997, 1998, 1999\n\
+ Sleepycat Software Inc. All rights reserved.\n";
+static const char sccsid[] = "@(#)db_stat.c 11.2 (Sleepycat) 9/14/99";
+#endif
+
+#ifndef NO_SYSTEM_INCLUDES
+#include <sys/types.h>
+
+#if TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+#endif
+
+#include <ctype.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+#endif
+
+extern "C" {
+#include "db_int.h"
+#include "db_page.h"
+#include "db_shash.h"
+#include "lock.h"
+#include "mp.h"
+}
+
+#include "WordDBInfo.h"
+#include "WordDBCompress.h"
+#include "WordContext.h"
+
+#define PCT(f, t, pgsize) \
+ ((t) == 0 ? 0 : \
+ (((double)(((t) * (pgsize)) - (f)) / ((t) * (pgsize))) * 100))
+
+typedef enum { T_NOTSET, T_DB, T_ENV, T_LOCK, T_LOG, T_MPOOL, T_TXN } test_t;
+
+int argcheck __P((char *, const char *));
+int btree_stats __P((DB_ENV *, DB *));
+int db_init __P((char *, test_t));
+void dl __P((const char *, u_long));
+void dl_bytes __P((const char *, u_long, u_long, u_long));
+int env_stats __P((DB_ENV *));
+int hash_stats __P((DB_ENV *, DB *));
+int lock_ok __P((char *));
+int lock_stats __P((DB_ENV *));
+int log_stats __P((DB_ENV *));
+int main __P((int, char *[]));
+int mpool_ok __P((char *));
+int mpool_stats __P((DB_ENV *));
+void onint __P((int));
+void prflags __P((u_int32_t, const FN *));
+int queue_stats __P((DB_ENV *, DB *));
+void siginit __P((void));
+int txn_compare __P((const void *, const void *));
+int txn_stats __P((DB_ENV *));
+void usage __P((void));
+
+DB_ENV *dbenv;
+int interrupted;
+char *stats_internal;
+const char
+ *progname = "htdb_stat"; /* Program name. */
+
+int
+main(int argc, char *argv[])
+{
+ extern char *optarg;
+ extern int optind;
+ DB *dbp;
+ test_t ttype;
+ int ch, d_close, e_close, exitval, Nflag, ret;
+ char *db, *home, *subdb;
+ int compress = 0;
+ int wordlist = 0;
+ Configuration *config = 0;
+
+ dbp = NULL;
+ ttype = T_NOTSET;
+ d_close = e_close = exitval = Nflag = 0;
+ db = home = subdb = NULL;
+ while ((ch = getopt(argc, argv, "C:cd:eh:lM:mNs:tzW")) != EOF)
+ switch (ch) {
+ case 'C':
+ ttype = T_LOCK;
+ if (!argcheck(stats_internal = optarg, "Acflmo"))
+ usage();
+ break;
+ case 'c':
+ ttype = T_LOCK;
+ break;
+ case 'd':
+ db = optarg;
+ ttype = T_DB;
+ break;
+ case 'e':
+ ttype = T_ENV;
+ break;
+ case 'h':
+ home = optarg;
+ break;
+ case 'l':
+ ttype = T_LOG;
+ break;
+ case 'M':
+ ttype = T_MPOOL;
+ if (!argcheck(stats_internal = optarg, "Ahlm"))
+ usage();
+ break;
+ case 'm':
+ ttype = T_MPOOL;
+ break;
+ case 'N':
+ Nflag = 1;
+ break;
+ case 's':
+ subdb = optarg;
+ ttype = T_DB;
+ break;
+ case 't':
+ ttype = T_TXN;
+ break;
+ case 'z':
+ compress = DB_COMPRESS;
+ break;
+ case 'W':
+ wordlist = 1;
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
+
+ switch (ttype) {
+ case T_DB:
+ if (db == NULL)
+ usage();
+ break;
+ case T_NOTSET:
+ usage();
+ /* NOTREACHED */
+ default:
+ break;
+ }
+
+ /* Handle possible interruptions. */
+ siginit();
+
+ if(wordlist && compress) {
+ static ConfigDefaults defaults[] = {
+ { "wordlist_wordkey_description", "Word/DocID 32/Flag 8/Location 16"},
+ { "wordlist_env_skip", "true"},
+ { 0, 0, 0 }
+ };
+ config = WordContext::Initialize(defaults);
+ }
+
+ /*
+ * Create an environment object and initialize it for error
+ * reporting.
+ */
+ if ((ret = CDB_db_env_create(&dbenv, 0)) != 0) {
+ fprintf(stderr,
+ "%s: CDB_db_env_create: %s\n", progname, CDB_db_strerror(ret));
+ exit (1);
+ }
+
+ dbenv->set_errfile(dbenv, stderr);
+ dbenv->set_errpfx(dbenv, progname);
+ if(wordlist && compress) dbenv->mp_cmpr_info = (new WordDBCompress)->CmprInfo();
+
+ /* Optionally turn mutexes and the panic checks off. */
+ if (Nflag) {
+ if ((ret = dbenv->set_mutexlocks(dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "set_mutexlocks");
+ goto shutdown;
+ }
+ if ((ret = dbenv->set_panic(dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "set_panic");
+ goto shutdown;
+ }
+ }
+
+ /* Initialize the environment. */
+ if (db_init(home, ttype) != 0)
+ goto shutdown;
+
+ e_close = 1;
+
+ switch (ttype) {
+ case T_DB:
+ /* Create the DB object and open the file. */
+ if ((ret = CDB_db_create(&dbp, dbenv, 0)) != 0) {
+ dbenv->err(dbenv, ret, "CDB_db_create");
+ goto shutdown;
+ }
+ if ((ret =
+ dbp->open(dbp, db, subdb, DB_UNKNOWN, (DB_RDONLY | compress), 0)) != 0) {
+ dbp->err(dbp, ret, "open: %s", db);
+ goto shutdown;
+ }
+ d_close = 1;
+ switch (dbp->type) {
+ case DB_BTREE:
+ case DB_RECNO:
+ if (btree_stats(dbenv, dbp))
+ goto shutdown;
+ break;
+ case DB_HASH:
+ if (hash_stats(dbenv, dbp))
+ goto shutdown;
+ break;
+ case DB_QUEUE:
+ if (queue_stats(dbenv, dbp))
+ goto shutdown;
+ break;
+ case DB_UNKNOWN:
+ abort(); /* Impossible. */
+ /* NOTREACHED */
+ }
+ break;
+ case T_ENV:
+ if (env_stats(dbenv))
+ exitval = 1;
+ break;
+ case T_LOCK:
+ if (lock_stats(dbenv))
+ exitval = 1;
+ break;
+ case T_LOG:
+ if (log_stats(dbenv))
+ exitval = 1;
+ break;
+ case T_MPOOL:
+ if (mpool_stats(dbenv))
+ exitval = 1;
+ break;
+ case T_TXN:
+ if (txn_stats(dbenv))
+ exitval = 1;
+ break;
+ case T_NOTSET:
+ abort(); /* Impossible. */
+ /* NOTREACHED */
+ }
+
+ if (0) {
+shutdown: exitval = 1;
+ }
+ if (d_close && (ret = dbp->close(dbp, 0)) != 0) {
+ exitval = 1;
+ dbp->err(dbp, ret, "close");
+ }
+ if (e_close && (ret = dbenv->close(dbenv, 0)) != 0) {
+ exitval = 1;
+ fprintf(stderr,
+ "%s: dbenv->close: %s\n", progname, CDB_db_strerror(ret));
+ }
+
+ if (interrupted) {
+ (void)signal(interrupted, SIG_DFL);
+ (void)raise(interrupted);
+ /* NOTREACHED */
+ }
+
+ if(config) {
+ WordContext::Finish();
+ delete config;
+ }
+
+ return (exitval);
+}
+
+/*
+ * env_stats --
+ * Display environment statistics.
+ */
+int
+env_stats(DB_ENV *dbenvp)
+{
+ REGENV renv;
+ REGION *rp, regs[1024];
+ int n, ret;
+ const char *lable;
+
+ n = sizeof(regs) / sizeof(regs[0]);
+ if ((ret = CDB___db_e_stat(dbenvp, &renv, regs, &n)) != 0) {
+ dbenvp->err(dbenvp, ret, "CDB___db_e_stat");
+ return (1);
+ }
+
+ printf("%d.%d.%d\tEnvironment version.\n",
+ renv.majver, renv.minver, renv.patch);
+ printf("%lx\tMagic number.\n", (u_long)renv.magic);
+ printf("%d\tPanic value.\n", renv.panic);
+
+ /* Adjust the reference count for us... */
+ printf("%d\tReferences.\n", renv.refcnt - 1);
+
+ dl("Locks granted without waiting.\n",
+ (u_long)renv.mutex.mutex_set_nowait);
+ dl("Locks granted after waiting.\n",
+ (u_long)renv.mutex.mutex_set_wait);
+
+ while (n > 0) {
+ printf("%s\n", DB_LINE);
+ rp = &regs[--n];
+ switch (rp->id) {
+ case REG_ID_ENV:
+ lable = "Environment";
+ break;
+ case REG_ID_LOCK:
+ lable = "Lock";
+ break;
+ case REG_ID_LOG:
+ lable = "Log";
+ break;
+ case REG_ID_MPOOL:
+ lable = "Mpool";
+ break;
+ case REG_ID_TXN:
+ lable = "Txn";
+ break;
+ default:
+ lable = "Unknown";
+ break;
+ }
+ printf("%s Region: %d.\n", lable, rp->id);
+ dl_bytes("Size.\n", (u_long)0, (u_long)0, (u_long)rp->size);
+ printf("%d\tSegment ID.\n", rp->segid);
+ dl("Locks granted without waiting.\n",
+ (u_long)rp->mutex.mutex_set_nowait);
+ dl("Locks granted after waiting.\n",
+ (u_long)rp->mutex.mutex_set_wait);
+ }
+
+ return (0);
+}
+
+/*
+ * btree_stats --
+ * Display btree/recno statistics.
+ */
+int
+btree_stats(DB_ENV *dbenvp, DB *dbp)
+{
+ static const FN fn[] = {
+ { BTM_DUP, "duplicates" },
+ { BTM_FIXEDLEN, "fixed-length" },
+ { BTM_RECNO, "recno" },
+ { BTM_RECNUM, "record-numbers" },
+ { BTM_RENUMBER, "renumber" },
+ { BTM_SUBDB, "subdatabases" },
+ { 0, NULL }
+ };
+ DB_BTREE_STAT *sp;
+ int ret;
+
+ COMPQUIET(dbenvp, NULL);
+
+ if ((ret = dbp->stat(dbp, &sp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "dbp->stat");
+ return (1);
+ }
+
+ printf("%lx\tBtree magic number.\n", (u_long)sp->bt_magic);
+ printf("%lu\tBtree version number.\n", (u_long)sp->bt_version);
+ prflags(sp->bt_metaflags, fn);
+ if (dbp->type == DB_BTREE) {
+#ifdef NOT_IMPLEMENTED
+ dl("Maximum keys per-page.\n", (u_long)sp->bt_maxkey);
+#endif
+ dl("Minimum keys per-page.\n", (u_long)sp->bt_minkey);
+ }
+ if (dbp->type == DB_RECNO) {
+ dl("Fixed-length record size.\n", (u_long)sp->bt_re_len);
+ if (isprint(sp->bt_re_pad))
+ printf("%c\tFixed-length record pad.\n",
+ (int)sp->bt_re_pad);
+ else
+ printf("0x%x\tFixed-length record pad.\n",
+ (int)sp->bt_re_pad);
+ }
+ dl("Underlying database page size.\n", (u_long)sp->bt_pagesize);
+ dl("Number of levels in the tree.\n", (u_long)sp->bt_levels);
+ dl("Number of keys in the tree.\n", (u_long)sp->bt_nrecs);
+
+ dl("Number of tree internal pages.\n", (u_long)sp->bt_int_pg);
+ dl("Number of bytes free in tree internal pages",
+ (u_long)sp->bt_int_pgfree);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->bt_int_pgfree, sp->bt_int_pg, sp->bt_pagesize));
+
+ dl("Number of tree leaf pages.\n", (u_long)sp->bt_leaf_pg);
+ dl("Number of bytes free in tree leaf pages",
+ (u_long)sp->bt_leaf_pgfree);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->bt_leaf_pgfree, sp->bt_leaf_pg, sp->bt_pagesize));
+
+ dl("Number of tree duplicate pages.\n", (u_long)sp->bt_dup_pg);
+ dl("Number of bytes free in tree duplicate pages",
+ (u_long)sp->bt_dup_pgfree);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->bt_dup_pgfree, sp->bt_dup_pg, sp->bt_pagesize));
+
+ dl("Number of tree overflow pages.\n", (u_long)sp->bt_over_pg);
+ dl("Number of bytes free in tree overflow pages",
+ (u_long)sp->bt_over_pgfree);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->bt_over_pgfree, sp->bt_over_pg, sp->bt_pagesize));
+
+ dl("Number of pages on the free list.\n", (u_long)sp->bt_free);
+
+ free(sp);
+
+ return (0);
+}
+
+/*
+ * hash_stats --
+ * Display hash statistics.
+ */
+int
+hash_stats(DB_ENV *dbenvp, DB *dbp)
+{
+ static const FN fn[] = {
+ { DB_HASH_DUP, "duplicates" },
+ { DB_HASH_SUBDB,"subdatabases" },
+ { 0, NULL }
+ };
+ DB_HASH_STAT *sp;
+ int ret;
+
+ COMPQUIET(dbenvp, NULL);
+
+ if ((ret = dbp->stat(dbp, &sp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "dbp->stat");
+ return (1);
+ }
+
+ printf("%lx\tHash magic number.\n", (u_long)sp->hash_magic);
+ printf("%lu\tHash version number.\n", (u_long)sp->hash_version);
+ prflags(sp->hash_metaflags, fn);
+ dl("Underlying database page size.\n", (u_long)sp->hash_pagesize);
+ dl("Number of keys in the database.\n", (u_long)sp->hash_nrecs);
+
+ dl("Number of hash buckets.\n", (u_long)sp->hash_buckets);
+ dl("Number of bytes free on bucket pages", (u_long)sp->hash_bfree);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->hash_bfree, sp->hash_buckets, sp->hash_pagesize));
+
+ dl("Number of overflow pages.\n", (u_long)sp->hash_bigpages);
+ dl("Number of bytes free in overflow pages",
+ (u_long)sp->hash_big_bfree);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->hash_big_bfree, sp->hash_bigpages, sp->hash_pagesize));
+
+ dl("Number of bucket overflow pages.\n", (u_long)sp->hash_overflows);
+ dl("Number of bytes free in bucket overflow pages",
+ (u_long)sp->hash_ovfl_free);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->hash_ovfl_free, sp->hash_overflows, sp->hash_pagesize));
+
+ dl("Number of duplicate pages.\n", (u_long)sp->hash_dup);
+ dl("Number of bytes free in duplicate pages",
+ (u_long)sp->hash_dup_free);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->hash_dup_free, sp->hash_dup, sp->hash_pagesize));
+
+ dl("Number of pages on the free list.\n", (u_long)sp->hash_free);
+
+ return (0);
+}
+
+/*
+ * queue_stats --
+ * Display queue statistics.
+ */
+int
+queue_stats(DB_ENV *dbenvp, DB *dbp)
+{
+ DB_QUEUE_STAT *sp;
+ int ret;
+
+ COMPQUIET(dbenvp, NULL);
+
+ if ((ret = dbp->stat(dbp, &sp, NULL, 0)) != 0) {
+ dbp->err(dbp, ret, "dbp->stat");
+ return (1);
+ }
+
+ printf("%lx\tQueue magic number.\n", (u_long)sp->qs_magic);
+ printf("%lu\tQueue version number.\n", (u_long)sp->qs_version);
+ dl("Fixed-length record size.\n", (u_long)sp->qs_re_len);
+ if (isprint(sp->qs_re_pad))
+ printf("%c\tFixed-length record pad.\n", (int)sp->qs_re_pad);
+ else
+ printf("0x%x\tFixed-length record pad.\n", (int)sp->qs_re_pad);
+ dl("Underlying tree page size.\n", (u_long)sp->qs_pagesize);
+ dl("Number of records in the database.\n", (u_long)sp->qs_nrecs);
+ dl("Number of database pages.\n", (u_long)sp->qs_pages);
+ dl("Number of bytes free in database pages", (u_long)sp->qs_pgfree);
+ printf(" (%.0f%% ff).\n",
+ PCT(sp->qs_pgfree, sp->qs_pages, sp->qs_pagesize));
+ printf("%lu\tFirst undeleted record.\n", (u_long)sp->qs_first_recno);
+ printf(
+ "%lu\tLast allocated record number.\n", (u_long)sp->qs_cur_recno);
+ printf("%lu\tStart offset.\n", (u_long)sp->qs_start);
+
+ return (0);
+}
+
+/*
+ * lock_stats --
+ * Display lock statistics.
+ */
+int
+lock_stats(DB_ENV *dbenvp)
+{
+ DB_LOCK_STAT *sp;
+ int ret;
+
+ if (stats_internal != NULL) {
+ CDB___lock_dump_region(dbenvp, stats_internal, stdout);
+ return (0);
+ }
+
+ if ((ret = CDB_lock_stat(dbenvp, &sp, NULL)) != 0) {
+ dbenvp->err(dbenvp, ret, NULL);
+ return (1);
+ }
+
+ dl("Last allocated locker ID.\n", (u_long)sp->st_lastid);
+ dl("Number of lock modes.\n", (u_long)sp->st_nmodes);
+ dl("Maximum number of locks possible.\n", (u_long)sp->st_maxlocks);
+ dl("Current lockers.\n", (u_long)sp->st_nlockers);
+ dl("Maximum current lockers.\n", (u_long)sp->st_nlockers);
+ dl("Number of lock requests.\n", (u_long)sp->st_nrequests);
+ dl("Number of lock releases.\n", (u_long)sp->st_nreleases);
+ dl("Number of lock conflicts.\n", (u_long)sp->st_nconflicts);
+ dl("Number of deadlocks.\n", (u_long)sp->st_ndeadlocks);
+ dl_bytes("Lock region size.\n",
+ (u_long)0, (u_long)0, (u_long)sp->st_regsize);
+ dl("The number of region locks granted without waiting.\n",
+ (u_long)sp->st_region_nowait);
+ dl("The number of region locks granted after waiting.\n",
+ (u_long)sp->st_region_wait);
+
+ return (0);
+}
+
+/*
+ * log_stats --
+ * Display log statistics.
+ */
+int
+log_stats(DB_ENV *dbenvp)
+{
+ DB_LOG_STAT *sp;
+ int ret;
+
+ if ((ret = CDB_log_stat(dbenvp, &sp, NULL)) != 0) {
+ dbenvp->err(dbenvp, ret, NULL);
+ return (1);
+ }
+
+ printf("%lx\tLog magic number.\n", (u_long)sp->st_magic);
+ printf("%lu\tLog version number.\n", (u_long)sp->st_version);
+ dl_bytes("Log region size.\n",
+ (u_long)0, (u_long)0, (u_long)sp->st_regsize);
+ dl_bytes("Log record cache size.\n",
+ (u_long)0, (u_long)0, (u_long)sp->st_lg_bsize);
+ printf("%#o\tLog file mode.\n", sp->st_mode);
+ if (sp->st_lg_max % MEGABYTE == 0)
+ printf("%luMb\tLog file size.\n",
+ (u_long)sp->st_lg_max / MEGABYTE);
+ else if (sp->st_lg_max % 1024 == 0)
+ printf("%luKb\tLog file size.\n", (u_long)sp->st_lg_max / 1024);
+ else
+ printf("%lu\tLog file size.\n", (u_long)sp->st_lg_max);
+ dl_bytes("Log bytes written.\n",
+ (u_long)0, (u_long)sp->st_w_mbytes, (u_long)sp->st_w_bytes);
+ dl_bytes("Log bytes written since last checkpoint.\n",
+ (u_long)0, (u_long)sp->st_wc_mbytes, (u_long)sp->st_wc_bytes);
+ dl("Total log file writes.\n", (u_long)sp->st_wcount);
+ dl("Total log file write due to overflow.\n",
+ (u_long)sp->st_wcount_fill);
+ dl("Total log file flushes.\n", (u_long)sp->st_scount);
+ printf("%lu\tCurrent log file number.\n", (u_long)sp->st_cur_file);
+ printf("%lu\tCurrent log file offset.\n", (u_long)sp->st_cur_offset);
+ dl("The number of region locks granted without waiting.\n",
+ (u_long)sp->st_region_nowait);
+ dl("The number of region locks granted after waiting.\n",
+ (u_long)sp->st_region_wait);
+
+ return (0);
+}
+
+/*
+ * mpool_stats --
+ * Display mpool statistics.
+ */
+int
+mpool_stats(DB_ENV *dbenvp)
+{
+ DB_MPOOL_FSTAT **fsp;
+ DB_MPOOL_STAT *gsp;
+ int ret;
+
+ if (stats_internal != NULL) {
+ CDB___memp_dump_region(dbenvp, stats_internal, stdout);
+ return (1);
+ }
+
+ if ((ret = CDB_memp_stat(dbenvp, &gsp, &fsp, NULL)) != 0) {
+ dbenvp->err(dbenvp, ret, NULL);
+ return (1);
+ }
+
+ dl("Pool region size.\n", (u_long)gsp->st_regsize);
+ dl_bytes("Cache size.\n",
+ (u_long)gsp->st_gbytes, (u_long)0, (u_long)gsp->st_bytes);
+ dl("Requested pages found in the cache", (u_long)gsp->st_cache_hit);
+ if (gsp->st_cache_hit + gsp->st_cache_miss != 0)
+ printf(" (%.0f%%)", ((double)gsp->st_cache_hit /
+ (gsp->st_cache_hit + gsp->st_cache_miss)) * 100);
+ printf(".\n");
+ dl("Requested pages mapped into the process' address space.\n",
+ (u_long)gsp->st_map);
+ dl("Requested pages not found in the cache.\n",
+ (u_long)gsp->st_cache_miss);
+ dl("Pages created in the cache.\n", (u_long)gsp->st_page_create);
+ dl("Pages read into the cache.\n", (u_long)gsp->st_page_in);
+ dl("Pages written from the cache to the backing file.\n",
+ (u_long)gsp->st_page_out);
+ dl("Clean pages forced from the cache.\n",
+ (u_long)gsp->st_ro_evict);
+ dl("Dirty pages forced from the cache.\n",
+ (u_long)gsp->st_rw_evict);
+ dl("Dirty buffers written by trickle-sync thread.\n",
+ (u_long)gsp->st_page_trickle);
+ dl("Current clean buffer count.\n",
+ (u_long)gsp->st_page_clean);
+ dl("Current dirty buffer count.\n",
+ (u_long)gsp->st_page_dirty);
+ dl("Number of hash buckets used for page location.\n",
+ (u_long)gsp->st_hash_buckets);
+ dl("Total number of times hash chains searched for a page.\n",
+ (u_long)gsp->st_hash_searches);
+ dl("The longest hash chain searched for a page.\n",
+ (u_long)gsp->st_hash_longest);
+ dl("Total number of hash buckets examined for page location.\n",
+ (u_long)gsp->st_hash_examined);
+ dl("The number of region locks granted without waiting.\n",
+ (u_long)gsp->st_region_nowait);
+ dl("The number of region locks granted after waiting.\n",
+ (u_long)gsp->st_region_wait);
+
+ for (; fsp != NULL && *fsp != NULL; ++fsp) {
+ printf("%s\n", DB_LINE);
+ printf("Pool File: %s\n", (*fsp)->file_name);
+ dl("Page size.\n", (u_long)(*fsp)->st_pagesize);
+ dl("Requested pages found in the cache",
+ (u_long)(*fsp)->st_cache_hit);
+ if ((*fsp)->st_cache_hit + (*fsp)->st_cache_miss != 0)
+ printf(" (%.0f%%)", ((double)(*fsp)->st_cache_hit /
+ ((*fsp)->st_cache_hit + (*fsp)->st_cache_miss)) *
+ 100);
+ printf(".\n");
+ dl("Requested pages mapped into the process' address space.\n",
+ (u_long)(*fsp)->st_map);
+ dl("Requested pages not found in the cache.\n",
+ (u_long)(*fsp)->st_cache_miss);
+ dl("Pages created in the cache.\n",
+ (u_long)(*fsp)->st_page_create);
+ dl("Pages read into the cache.\n",
+ (u_long)(*fsp)->st_page_in);
+ dl("Pages written from the cache to the backing file.\n",
+ (u_long)(*fsp)->st_page_out);
+ }
+
+ return (0);
+}
+
+/*
+ * txn_stats --
+ * Display transaction statistics.
+ */
+int
+txn_stats(DB_ENV *dbenvp)
+{
+ DB_TXN_STAT *sp;
+ u_int32_t i;
+ int ret;
+ const char *p;
+
+ if ((ret = CDB_txn_stat(dbenvp, &sp, NULL)) != 0) {
+ dbenvp->err(dbenvp, ret, NULL);
+ return (1);
+ }
+
+ p = sp->st_last_ckp.file == 0 ?
+ "No checkpoint LSN." : "File/offset for last checkpoint LSN.";
+ printf("%lu/%lu\t%s\n",
+ (u_long)sp->st_last_ckp.file, (u_long)sp->st_last_ckp.offset, p);
+ p = sp->st_pending_ckp.file == 0 ?
+ "No pending checkpoint LSN." :
+ "File/offset for last pending checkpoint LSN.";
+ printf("%lu/%lu\t%s\n",
+ (u_long)sp->st_pending_ckp.file,
+ (u_long)sp->st_pending_ckp.offset, p);
+ if (sp->st_time_ckp == 0)
+ printf("0\tNo checkpoint timestamp.\n");
+ else
+ printf("%.24s\tCheckpoint timestamp.\n",
+ ctime(&sp->st_time_ckp));
+ printf("%lx\tLast transaction ID allocated.\n",
+ (u_long)sp->st_last_txnid);
+ dl("Maximum number of active transactions possible.\n",
+ (u_long)sp->st_maxtxns);
+ dl("Active transactions.\n", (u_long)sp->st_nactive);
+ dl("Maximum active transactions.\n", (u_long)sp->st_maxnactive);
+ dl("Number of transactions begun.\n", (u_long)sp->st_nbegins);
+ dl("Number of transactions aborted.\n", (u_long)sp->st_naborts);
+ dl("Number of transactions committed.\n", (u_long)sp->st_ncommits);
+ dl_bytes("Transaction region size.\n",
+ (u_long)0, (u_long)0, (u_long)sp->st_regsize);
+ dl("The number of region locks granted without waiting.\n",
+ (u_long)sp->st_region_nowait);
+ dl("The number of region locks granted after waiting.\n",
+ (u_long)sp->st_region_wait);
+ qsort(sp->st_txnarray,
+ sp->st_nactive, sizeof(sp->st_txnarray[0]), txn_compare);
+ for (i = 0; i < sp->st_nactive; ++i)
+ printf("\tid: %lx; initial LSN file/offest %lu/%lu\n",
+ (u_long)sp->st_txnarray[i].txnid,
+ (u_long)sp->st_txnarray[i].lsn.file,
+ (u_long)sp->st_txnarray[i].lsn.offset);
+
+ return (0);
+}
+
+int
+txn_compare(const void *a1, const void *b1)
+{
+ const DB_TXN_ACTIVE *a, *b;
+
+ a = (DB_TXN_ACTIVE*)a1;
+ b = (DB_TXN_ACTIVE*)b1;
+
+ if (a->txnid > b->txnid)
+ return (1);
+ if (a->txnid < b->txnid)
+ return (-1);
+ return (0);
+}
+
+/*
+ * dl --
+ * Display a big value.
+ */
+void
+dl(const char *msg, u_long value)
+{
+ /*
+ * Two formats: if less than 10 million, display as the number, if
+ * greater than 10 million display as ###M.
+ */
+ if (value < 10000000)
+ printf("%lu\t%s", value, msg);
+ else
+ printf("%luM\t%s", value / 1000000, msg);
+}
+
+/*
+ * dl_bytes --
+ * Display a big number of bytes.
+ */
+void
+dl_bytes(const char *msg, u_long gbytes, u_long mbytes, u_long bytes)
+{
+ const char *sep;
+
+ while (bytes > MEGABYTE) {
+ ++mbytes;
+ bytes -= MEGABYTE;
+ }
+ while (mbytes > GIGABYTE / MEGABYTE) {
+ ++gbytes;
+ --mbytes;
+ }
+
+ sep = "";
+ if (gbytes > 0) {
+ printf("%luGB", gbytes);
+ sep = " ";
+ }
+ if (mbytes > 0) {
+ printf("%s%luMB", sep, bytes);
+ sep = " ";
+ }
+ if (bytes > 1024) {
+ printf("%s%luKB", sep, bytes / 1024);
+ bytes %= 1024;
+ sep = " ";
+ }
+ if (bytes > 0)
+ printf("%s%lu", sep, bytes);
+ printf("\t%s", msg);
+}
+
+/*
+ * prflags --
+ * Print out flag values.
+ */
+void
+prflags(u_int32_t flags, const FN *fnp)
+{
+ const char *sep;
+
+ sep = "\t";
+ printf("Flags:");
+ for (; fnp->mask != 0; ++fnp)
+ if (fnp->mask & flags) {
+ printf("%s%s", sep, fnp->name);
+ sep = ", ";
+ }
+ printf("\n");
+}
+
+/*
+ * db_init --
+ * Initialize the environment.
+ */
+int
+db_init(char *home, test_t ttype)
+{
+ u_int32_t flags;
+ int ret;
+
+ /*
+ * Try and use the shared memory pool region when reporting statistics
+ * on the DB databases, so our information is as up-to-date as possible,
+ * even if the mpool cache hasn't been flushed.
+ */
+ flags = DB_USE_ENVIRON;
+ switch (ttype) {
+ case T_ENV:
+ break;
+ case T_DB:
+ case T_MPOOL:
+ LF_SET(DB_INIT_MPOOL);
+ break;
+ case T_LOCK:
+ LF_SET(DB_INIT_LOCK);
+ break;
+ case T_LOG:
+ LF_SET(DB_INIT_LOG);
+ break;
+ case T_TXN:
+ LF_SET(DB_INIT_TXN);
+ break;
+ case T_NOTSET:
+ abort();
+ /* NOTREACHED */
+ }
+
+ /*
+ * If that fails, and we're trying to look at a shared region, it's
+ * a hard failure.
+ */
+ if ((ret = dbenv->open(dbenv, home, NULL, flags, 0)) == 0)
+ return (0);
+ if (ttype != T_DB) {
+ dbenv->err(dbenv, ret, "open");
+ return (1);
+ }
+
+ /*
+ * We're trying to look at a database.
+ *
+ * An environment is required because we may be trying to look at
+ * databases in directories other than the current one. We could
+ * avoid using an environment iff the -h option wasn't specified,
+ * but that seems like more work than it's worth.
+ *
+ *
+ * No environment exists (or, at least no environment that includes
+ * an mpool region exists). Create one, but make it private so that
+ * no files are actually created.
+ */
+ LF_SET(DB_CREATE | DB_PRIVATE);
+ if ((ret = dbenv->open(dbenv, home, NULL, flags, 0)) == 0)
+ return (0);
+
+ /* An environment is required. */
+ dbenv->err(dbenv, ret, "open");
+ return (1);
+}
+
+/*
+ * argcheck --
+ * Return if argument flags are okay.
+ */
+int
+argcheck(char *arg, const char *ok_args)
+{
+ for (; *arg != '\0'; ++arg)
+ if (strchr(ok_args, *arg) == NULL)
+ return (0);
+ return (1);
+}
+
+/*
+ * siginit --
+ * Initialize the set of signals for which we want to clean up.
+ * Generally, we try not to leave the shared regions locked if
+ * we can.
+ */
+void
+siginit()
+{
+#ifdef SIGHUP
+ (void)signal(SIGHUP, onint);
+#endif
+ (void)signal(SIGINT, onint);
+#ifdef SIGPIPE
+ (void)signal(SIGPIPE, onint);
+#endif
+ (void)signal(SIGTERM, onint);
+}
+
+/*
+ * onint --
+ * Interrupt signal handler.
+ */
+void
+onint(int signo)
+{
+ if ((interrupted = signo) == 0)
+ interrupted = SIGINT;
+}
+
+void
+usage()
+{
+ fprintf(stderr,
+"usage: htdb_stat [-celmNtzW] [-C Acflmo] [-d file [-s file]] [-h home] [-M Ahlm]\n");
+ exit (1);
+}
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/mifluzdict.cc b/debian/htdig/htdig-3.2.0b6/htdb/mifluzdict.cc
new file mode 100644
index 00000000..2d49a893
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/mifluzdict.cc
@@ -0,0 +1,105 @@
+//
+// NAME
+//
+// dump the dictionnary of an inverted index.
+//
+// SYNOPSIS
+//
+// mifluzdict file
+//
+// DESCRIPTION
+//
+// mifluzdict writes on <b>stdout</b> a complete ascii description
+// of the <b>file</b> inverted index using the <i>WordList::Write</i>
+// method.
+//
+// ENVIRONMENT
+//
+// <b>MIFLUZ_CONFIG</b>
+// file name of configuration file read by WordContext(3). Defaults to
+// <b>~/.mifluz.</b>
+//
+//
+// END
+//
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+
+#ifdef HAVE_CONFIG_H
+#include "htconfig.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+
+#include <htString.h>
+#include <WordContext.h>
+#include <WordList.h>
+#include <WordDict.h>
+#include <Configuration.h>
+
+typedef struct
+{
+ String prefix;
+} params_t;
+
+static void action(WordContext* context, const String& file, params_t* params)
+{
+ WordList *words = context->List();
+ if(words->Open(file, O_RDONLY) != OK) exit(1);
+ if(params->prefix.empty()) {
+ if(words->WriteDict(stdout) != OK) exit(1);
+ } else {
+ WordDict *dict = words->Dict();
+ WordDictCursor *cursor = dict->CursorPrefix(params->prefix);
+ String word;
+ WordDictRecord record;
+ while(dict->NextPrefix(cursor, word, record) == 0) {
+ printf("%s %d %d\n", (char*)word.get(), record.Id(), record.Count());
+ }
+ }
+ if(words->Close() != OK) exit(1);
+ delete words;
+}
+
+static void usage()
+{
+ fprintf(stderr, "usage: mifluzdict [-p prefix] file\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+ params_t params;
+ extern char *optarg;
+ extern int optind;
+ int ch;
+ while ((ch = getopt(argc, argv, "p:")) != EOF) {
+ switch (ch) {
+ case 'p':
+ params.prefix = optarg;
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+
+ if(optind != argc - 1) usage();
+
+ //
+ // Mandatory to create global data needed for the library.
+ //
+ WordContext *context = new WordContext();
+ if(!context) exit(1);
+ action(context, argv[optind], &params);
+ delete context;
+}
+
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/mifluzdump.cc b/debian/htdig/htdig-3.2.0b6/htdb/mifluzdump.cc
new file mode 100644
index 00000000..638dc8df
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/mifluzdump.cc
@@ -0,0 +1,74 @@
+//
+// NAME
+//
+// dump the content of an inverted index.
+//
+// SYNOPSIS
+//
+// mifluzdump file
+//
+// DESCRIPTION
+//
+// mifluzdump writes on <b>stdout</b> a complete ascii description
+// of the <b>file</b> inverted index using the <i>WordList::Write</i>
+// method.
+//
+// ENVIRONMENT
+//
+// <b>MIFLUZ_CONFIG</b>
+// file name of configuration file read by WordContext(3). Defaults to
+// <b>~/.mifluz.</b>
+//
+//
+// END
+//
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+
+#ifdef HAVE_CONFIG_H
+#include "htconfig.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+
+#include <htString.h>
+#include <WordContext.h>
+#include <WordList.h>
+#include <Configuration.h>
+
+static void action(WordContext* context, const String& file)
+{
+ WordList *words = context->List();
+ if(words->Open(file, O_RDONLY) != OK) exit(1);
+ if(words->Write(stdout) != OK) exit(1);
+ if(words->Close() != OK) exit(1);
+ delete words;
+}
+
+static void usage()
+{
+ fprintf(stderr, "usage: mifluzdump file\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[]) {
+
+ if(argc != 2) usage();
+
+ //
+ // Mandatory to create global data needed for the library.
+ //
+ WordContext *context = new WordContext();
+ if(!context) exit(1);
+ action(context, argv[1]);
+ delete context;
+}
+
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/mifluzload.cc b/debian/htdig/htdig-3.2.0b6/htdb/mifluzload.cc
new file mode 100644
index 00000000..2cd5b31d
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/mifluzload.cc
@@ -0,0 +1,104 @@
+//
+// NAME
+//
+// load the content of an inverted index.
+//
+// SYNOPSIS
+//
+// mifluzload file
+//
+// DESCRIPTION
+//
+// mifluzload reads from <b>stdout</b> a complete ascii description
+// of the <b>file</b> inverted index using the <i>WordList::Read</i>
+// method.
+//
+// ENVIRONMENT
+//
+// <b>MIFLUZ_CONFIG</b>
+// file name of configuration file read by WordContext(3). Defaults to
+// <b>~/.mifluz.</b>
+//
+//
+// END
+//
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+
+#ifdef HAVE_CONFIG_H
+#include "htconfig.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+#include <locale.h>
+
+#include <htString.h>
+#include <WordContext.h>
+#include <WordList.h>
+
+static void action(WordContext* context, const String& file)
+{
+ WordList *words = context->List();
+ if(words->Open(file, O_RDWR | O_TRUNC) != OK) exit(1);
+ if(words->Read(stdin) < 0) exit(1);
+ if(words->Close() != OK) exit(1);
+ delete words;
+}
+
+static void usage()
+{
+ fprintf(stderr, "usage: mifluzload [-zv] file\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+ if(argc < 2) usage();
+
+ setlocale(LC_ALL, "");
+
+ //
+ // Mandatory to create global data needed for the library.
+ //
+ WordContext *context = new WordContext();
+ if(!context) exit(1);
+
+ Configuration& config = context->GetConfiguration();
+
+ // extern char *optarg;
+ extern int optind;
+ int ch;
+ while ((ch = getopt(argc, argv, "zv")) != EOF) {
+ switch (ch) {
+ case 'z':
+ config.Add("wordlist_compress", "true");
+ break;
+ case 'v':
+ {
+ int value = config.Value("wordlist_verbose", 0);
+ value++;
+ char value_string[64];
+ sprintf(value_string, "%d", value);
+ config.Add("wordlist_verbose", value_string);
+ }
+ break;
+ default:
+ usage();
+ break;
+ }
+ }
+
+ context->ReInitialize();
+
+ action(context, argv[optind]);
+ delete context;
+}
+
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/util_sig.cc b/debian/htdig/htdig-3.2.0b6/htdb/util_sig.cc
new file mode 100644
index 00000000..7dc19eb2
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/util_sig.cc
@@ -0,0 +1,69 @@
+// Part of the ht://Dig package <http://www.htdig.org/>
+// Copyright (c) 1999-2004 The ht://Dig Group
+// For copyright details, see the file COPYING in your distribution
+// or the GNU Library General Public License (LGPL) version 2 or later
+// <http://www.gnu.org/copyleft/lgpl.html>
+//
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2000
+ * Sleepycat Software. All rights reserved.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "htconfig.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <sys/types.h>
+#include <signal.h>
+
+extern "C" {
+#include "db_int.h"
+#include "common_ext.h"
+}
+
+static int interrupt;
+static void onint(int);
+
+/*
+ * onint --
+ * Interrupt signal handler.
+ */
+static void onint(int signo)
+{
+ if ((interrupt = signo) == 0)
+ interrupt = SIGINT;
+}
+
+void __db_util_siginit()
+{
+ /*
+ * Initialize the set of signals for which we want to clean up.
+ * Generally, we try not to leave the shared regions locked if
+ * we can.
+ */
+#ifdef SIGHUP
+ (void) signal(SIGHUP, onint);
+#endif
+ (void) signal(SIGINT, onint);
+#ifdef SIGPIPE
+ (void) signal(SIGPIPE, onint);
+#endif
+ (void) signal(SIGTERM, onint);
+}
+
+int __db_util_interrupted()
+{
+ return (interrupt != 0);
+}
+
+void __db_util_sigresend()
+{
+ /* Resend any caught signal. */
+ if (__db_util_interrupted != 0) {
+ (void) signal(interrupt, SIG_DFL);
+ (void) raise(interrupt);
+ /* NOTREACHED */
+ }
+}
diff --git a/debian/htdig/htdig-3.2.0b6/htdb/util_sig.h b/debian/htdig/htdig-3.2.0b6/htdb/util_sig.h
new file mode 100644
index 00000000..347c68ee
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/htdb/util_sig.h
@@ -0,0 +1,7 @@
+#ifndef UTIL_SIG_H
+#define UTIL_SIG_H
+
+void __db_util_siginit();
+int __db_util_interrupted();
+void __db_util_sigresend();
+#endif /* UTIL_SIG_H */