Index: /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/Makefile.in
===================================================================
--- /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/Makefile.in	(revision 18442)
+++ /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/Makefile.in	(revision 18442)
@@ -0,0 +1,82 @@
+###########################################################################
+#
+# Makefile -- common-src/src/gdbmedit/gdbmdel
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999-2008  The New Zealand Digital Library Project
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+GSDL_DIR = ../../../..
+COMMON_DIR = $(GSDL_DIR)/common-src
+
+COMMON_PACKAGES_DIR = $(COMMON_DIR)/packages
+
+
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@ @COMPAT32BITFLAGS@
+DEFS = @DEFS@
+GSDLOS = @gsdlos@
+INCLUDES = -I$(COMMON_PACKAGES_DIR)/gdbm/include -I$(COMMON_DIR)/src/lib
+INSTALL = @INSTALL@
+LDFLAGS = @LDFLAGS@ @COMPAT32BITFLAGS@
+LIBS = @LIBS@ $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a
+
+
+CXXCOMPILE = $(CXX) -c $(CXXFLAGS) $(DEFS) $(INCLUDES)
+CXXLINK = $(CXX) $(LDFLAGS) -o $@
+
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o
+.cpp.o:
+	$(CXXCOMPILE) $< 
+
+
+SOURCES = \
+	gdbmdel.cpp
+
+OBJECTS = \
+	gdbmdel.o
+
+EXECUTABLE_OBJECTS = \
+	$(OBJECTS)
+
+EXECUTABLE = gdbmdel
+
+
+# Default target: make the gdbmdel executable
+all: $(EXECUTABLE)
+
+gdbmdel: $(EXECUTABLE_OBJECTS)
+	$(CXXLINK) $(EXECUTABLE_OBJECTS) $(LIBS)
+
+install: $(EXECUTABLE)
+	$(INSTALL) -d $(GSDL_DIR)/bin/$(GSDLOS)
+	$(INSTALL) -m 755 -s $(EXECUTABLE) $(GSDL_DIR)/bin/$(GSDLOS)
+
+clean:
+	rm -f $(OBJECTS) $(EXECUTABLE)
+
+distclean:
+	rm -f $(OBJECTS) $(EXECUTABLE) Makefile
+
+depend:
+	makedepend -Y -- $(DEFS) $(INCLUDES) $(CXXFLAGS) -- $(SOURCES)
Index: /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/gdbmdel.cpp
===================================================================
--- /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/gdbmdel.cpp	(revision 18442)
+++ /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/gdbmdel.cpp	(revision 18442)
@@ -0,0 +1,102 @@
+/**********************************************************************
+ *
+ * gdbmdel -- retrieve a single value from the GDBM database
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *********************************************************************/
+
+#ifdef __WIN32__
+#include "autoconf.h"
+#include "systems.h"
+#include "gdbmconst.h"
+#include "gdbm.h"
+
+#else
+#include <gdbm.h>
+#endif
+
+#include "gsdlconf.h"
+#include <stdlib.h>
+
+#if defined(GSDL_USE_OBJECTSPACE)
+#include <ospace\std\iostream>
+#elif defined(GSDL_USE_IOS_H)
+#include <iostream.h>
+#else
+#include <iostream>
+#endif
+
+// use the standard namespace
+#if !defined (GSDL_NAMESPACE_BROKEN)
+#if defined(GSDL_USE_OBJECTSPACE)
+using namespace ospace::std;
+#else
+using namespace std;
+#endif
+#endif
+
+void 
+print_usage (char *program_name) 
+{
+  cerr << "usage: " << program_name << " <database_path> <key>" << endl;
+  cerr << endl;
+}
+
+
+int main (int argc, char *argv[]) 
+{
+  int block_size = 0;
+  GDBM_FILE dbf;
+  datum key;
+  
+  // sanity check
+  if (argc != 3) 
+    {
+      print_usage (argv[0]);
+      exit (-1);
+    }
+  
+  // open the database
+#ifdef __WIN32__
+  dbf = gdbm_open (argv[1], block_size, GDBM_READER, 00664, NULL, 0);
+#else
+  dbf = gdbm_open  (argv[1], block_size, GDBM_READER, 00664, NULL);
+#endif
+  if (dbf == NULL) 
+    {
+      cerr << "couldn't create " << argv[1] << endl;
+      exit (-1);
+    }
+  
+  key.dsize = strlen(argv[2]);
+  key.dptr = argv[2];
+
+  int status = gdbm_delete (dbf, key); 
+  
+  // status:
+  //   0 == delete OK
+  //  -1 == key does not exist or there was an error
+
+  gdbm_close (dbf);
+
+  return status; 
+}
+
Index: /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/win32.mak
===================================================================
--- /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/win32.mak	(revision 18442)
+++ /gsdl/trunk/common-src/src/gdbmedit/gdbmdel/win32.mak	(revision 18442)
@@ -0,0 +1,79 @@
+###########################################################################
+#
+# win32 makefile -- gdbmdel
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999  The New Zealand Digital Library Project
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+GSDLHOME = ..\..\..\..
+COMMON_DIR = $(GSDLHOME)\common-src
+
+USE_STLPORT = 0
+STLPATH = "$(COMMON_DIR)\packages\windows\stlport\stlport"
+
+AR = lib
+CC = cl
+CPPFLAGS = 
+LDFLAGS =
+
+DEFS = -D__WIN32__ -DHAVE_CONFIG_H
+INCLUDES = -I"$(COMMON_DIR)\src\gdbmedit\gdbmdel" -I"$(COMMON_DIR)\src\lib" -I"$(COMMON_DIR)\indexers\mg\lib" \
+	   -I"$(COMMON_DIR)\packages\gdbm\gdbm-1.8.3" -I"$(COMMON_DIR)\packages\gdbm\gdbm-1.8.3\windows"
+!IF $(USE_STLPORT)
+DEFS=$(DEFS) -DGSDL_NAMESPACE_BROKEN -DGSDL_USE_IOS_H -D__STL_NO_NEW_IOSTREAMS
+INCLUDES = $(INCLUDES) -I$(STLPATH)
+!ENDIF
+
+LIBS = "$(COMMON_DIR)\packages\gdbm\gdbm-1.8.3\gdbm.lib"
+
+COMPILE = $(CC) -c -GX $(DEFS) $(INCLUDES)
+LINK = $(CC) $(LDFLAGS)
+
+.SUFFIXES:
+.SUFFIXES: .cpp .obj
+.cpp.obj:
+	$(COMPILE) $<
+
+ANSI2KNR = 
+o = .obj
+e = .exe
+
+HEADERS = 
+
+SOURCES = gdbmdel.cpp
+
+OBJECTS = gdbmdel$o
+
+EXEC = gdbmdel$e
+
+all : $(EXEC)
+
+install: $(EXEC)
+	if NOT EXIST "$(GSDLHOME)\bin\windows" mkdir "$(GSDLHOME)\bin\windows"
+	copy $(EXEC) "$(GSDLHOME)\bin\windows"
+
+clean:
+	del *$o
+	del $(EXEC)
+
+gdbmdel$e: $(OBJECTS) $(LIBS)
+	  $(LINK) $(OBJECTS) $(LIBS)
Index: /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/Makefile.in
===================================================================
--- /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/Makefile.in	(revision 18442)
+++ /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/Makefile.in	(revision 18442)
@@ -0,0 +1,82 @@
+###########################################################################
+#
+# Makefile -- common-src/src/gdbmedit/gdbmkeys
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999-2008  The New Zealand Digital Library Project
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+GSDL_DIR = ../../../..
+COMMON_DIR = $(GSDL_DIR)/common-src
+
+COMMON_PACKAGES_DIR = $(COMMON_DIR)/packages
+
+
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@ @COMPAT32BITFLAGS@
+DEFS = @DEFS@
+GSDLOS = @gsdlos@
+INCLUDES = -I$(COMMON_PACKAGES_DIR)/gdbm/include -I$(COMMON_DIR)/src/lib
+INSTALL = @INSTALL@
+LDFLAGS = @LDFLAGS@ @COMPAT32BITFLAGS@
+LIBS = @LIBS@ $(COMMON_PACKAGES_DIR)/gdbm/lib/libgdbm.a
+
+
+CXXCOMPILE = $(CXX) -c $(CXXFLAGS) $(DEFS) $(INCLUDES)
+CXXLINK = $(CXX) $(LDFLAGS) -o $@
+
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o
+.cpp.o:
+	$(CXXCOMPILE) $< 
+
+
+SOURCES = \
+	gdbmkeys.cpp
+
+OBJECTS = \
+	gdbmkeys.o
+
+EXECUTABLE_OBJECTS = \
+	$(OBJECTS)
+
+EXECUTABLE = gdbmkeys
+
+
+# Default target: make the gdbmkeys executable
+all: $(EXECUTABLE)
+
+gdbmkeys: $(EXECUTABLE_OBJECTS)
+	$(CXXLINK) $(EXECUTABLE_OBJECTS) $(LIBS)
+
+install: $(EXECUTABLE)
+	$(INSTALL) -d $(GSDL_DIR)/bin/$(GSDLOS)
+	$(INSTALL) -m 755 -s $(EXECUTABLE) $(GSDL_DIR)/bin/$(GSDLOS)
+
+clean:
+	rm -f $(OBJECTS) $(EXECUTABLE)
+
+distclean:
+	rm -f $(OBJECTS) $(EXECUTABLE) Makefile
+
+depend:
+	makedepend -Y -- $(DEFS) $(INCLUDES) $(CXXFLAGS) -- $(SOURCES)
Index: /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/gdbmkeys.cpp
===================================================================
--- /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/gdbmkeys.cpp	(revision 18442)
+++ /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/gdbmkeys.cpp	(revision 18442)
@@ -0,0 +1,109 @@
+/**********************************************************************
+ *
+ * gdbmkeys -- retrieve a single value from the GDBM database
+ * Copyright (C) 1999  The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *********************************************************************/
+
+#ifdef __WIN32__
+#include "autoconf.h"
+#include "systems.h"
+#include "gdbmconst.h"
+#include "gdbm.h"
+
+#else
+#include <gdbm.h>
+#endif
+
+#include "gsdlconf.h"
+#include <stdlib.h>
+
+#if defined(GSDL_USE_OBJECTSPACE)
+#include <ospace\std\iostream>
+#elif defined(GSDL_USE_IOS_H)
+#include <iostream.h>
+#else
+#include <iostream>
+#endif
+
+// use the standard namespace
+#if !defined (GSDL_NAMESPACE_BROKEN)
+#if defined(GSDL_USE_OBJECTSPACE)
+using namespace ospace::std;
+#else
+using namespace std;
+#endif
+#endif
+
+void 
+print_usage (char *program_name) 
+{
+  cerr << "usage: " << program_name << " <database_path>" << endl;
+  cerr << endl;
+}
+
+
+
+
+int main (int argc, char *argv[]) {
+  int block_size = 0, i;
+  GDBM_FILE dbf;
+  datum key, nextkey;
+      
+  // sanity check
+  if (argc != 2) {
+    print_usage (argv[0]);
+    exit (0);
+  }
+  
+  // open the database
+#ifdef __WIN32__
+  dbf = gdbm_open (argv[1], block_size, GDBM_READER, 00664, NULL, 0);
+#else
+  dbf = gdbm_open  (argv[1], block_size, GDBM_READER, 00664, NULL);
+#endif
+  if (dbf == NULL) {
+    cerr << "couldn't open " << argv[1] << endl;
+    exit (0);
+  }
+
+  key = gdbm_firstkey (dbf);
+  while (key.dptr != NULL) {
+    for (i = 0; i < key.dsize; ++i) {
+      cout << key.dptr[i];
+    }
+    cout << endl;
+
+    /* get next key */
+    nextkey = gdbm_nextkey (dbf, key);
+
+    /* free old key's dptr, otherwise causes memory leak */
+    free(key.dptr); 
+    
+    /* can now safely copy content of nextkey into key */
+    key = nextkey;
+  }
+  
+  gdbm_close (dbf);
+  return 0;
+}
+
+
Index: /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/win32.mak
===================================================================
--- /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/win32.mak	(revision 18442)
+++ /gsdl/trunk/common-src/src/gdbmedit/gdbmkeys/win32.mak	(revision 18442)
@@ -0,0 +1,79 @@
+###########################################################################
+#
+# win32 makefile -- gdbmkeys
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999  The New Zealand Digital Library Project
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+GSDLHOME = ..\..\..\..
+COMMON_DIR = $(GSDLHOME)\common-src
+
+USE_STLPORT = 0
+STLPATH = "$(COMMON_DIR)\packages\windows\stlport\stlport"
+
+AR = lib
+CC = cl
+CPPFLAGS = 
+LDFLAGS =
+
+DEFS = -D__WIN32__ -DHAVE_CONFIG_H
+INCLUDES = -I"$(COMMON_DIR)\src\gdbmedit\gdbmkeys" -I"$(COMMON_DIR)\src\lib" -I"$(COMMON_DIR)\indexers\mg\lib" \
+	   -I"$(COMMON_DIR)\packages\gdbm\gdbm-1.8.3" -I"$(COMMON_DIR)\packages\gdbm\gdbm-1.8.3\windows"
+!IF $(USE_STLPORT)
+DEFS=$(DEFS) -DGSDL_NAMESPACE_BROKEN -DGSDL_USE_IOS_H -D__STL_NO_NEW_IOSTREAMS
+INCLUDES = $(INCLUDES) -I$(STLPATH)
+!ENDIF
+
+LIBS = "$(COMMON_DIR)\packages\gdbm\gdbm-1.8.3\gdbm.lib"
+
+COMPILE = $(CC) -c -GX $(DEFS) $(INCLUDES)
+LINK = $(CC) $(LDFLAGS)
+
+.SUFFIXES:
+.SUFFIXES: .cpp .obj
+.cpp.obj:
+	$(COMPILE) $<
+
+ANSI2KNR = 
+o = .obj
+e = .exe
+
+HEADERS = 
+
+SOURCES = gdbmkeys.cpp
+
+OBJECTS = gdbmkeys$o
+
+EXEC = gdbmkeys$e
+
+all : $(EXEC)
+
+install: $(EXEC)
+	if NOT EXIST "$(GSDLHOME)\bin\windows" mkdir "$(GSDLHOME)\bin\windows"
+	copy $(EXEC) "$(GSDLHOME)\bin\windows"
+
+clean:
+	del *$o
+	del $(EXEC)
+
+gdbmkeys$e: $(OBJECTS) $(LIBS)
+	  $(LINK) $(OBJECTS) $(LIBS)
