2001-08-25  Guerrero, Juan Manuel  <st001906@hrz1.hrz.tu-darmstadt.de>

	* aclocal.m4, ltconfig, ltmain.sh: Files updated to libtool 1.35
	  for better MSDOS/DJGPP support.

	* configure.in (AC_CONFIG_HEADER): DOS filename restriction.
	  Package will use autoconf.h-in instead of defaulting to autoconf.h.in.
	  (AC_PROG_LIBTOOL): Updated from autoconf 2.12 to 2.13.
	  Package will use AC_PROG_LIBTOOL instead of AM_PROG_LIBTOOL.

	* dbm.h: Add structure tag to data structure. This inhibits
	  warning about anonymous struct using if g++ 2.95.2 is used.

	* gdbm.3: Typo fixed.

	* gdbm.proto: Add structure tag to data and GDBM_FILE structures.
	  This inhibits warning about anonymous struct using if g++ 2.95.2
	  is used.

	* gdbm.texinfo: Add a @direntry command.

	* gdbmopen.c (gdbm_open): Case GDBM_OPENMASK replaced with GDBM_WRITER.

	* gdbmreorg.c (gdbm_reorganize): Free memory referenced by new_dbf->name
	  before deleting the new_dbf structure.
	  (gdbm_reorganize) (IS_DIR_SEPARTOR): DOS-style paths may contain mixed
	  slash, backslash and colon as directory separator.
	  (gdbm_reorganize) [O_BINARY]: close old and new database files before
	  renaming it.

	* gdbmsetopts.c (gdbm_setopt): The cases for GDBM_CENTFREE and
	  GDBM_COALESCEBLKS both set dbf->fast_write, which is an unrelated
	  flag, and do not set dbf->central_free or dbf->coalesce_blocks as
	  they should.

	* Makefile.in: Change hardcoded values of CFLAGS and LDFLAGS to
	  @CFLAGS@ and @LDFLAGS@.
	  Change hardcoded values of prefix, exec_prefix, libdir, includedir,
	  infodir and man3dir to @prefix@, @exec_prefix@, @libdir@, @includedir@,
	  @infodir@ and @mandir@/man3. 
	  Added LIBTOOL commands --mode=link and --mode=install where appropiated.
	  DOS filename restriction: gdbm.proto2 renamed to gdbm.pr2.
	  html and ps docs targets added.

	* ndbm.h: Add structure tag to data and DBM structures. This inhibits
	  warning about anonymous struct using if g++ 2.95.2 is used.

	* systems.h [__DJGPP__]: DJGPP 2.03 implementation of fcntl() does
	  not support F_GETLK, F_SETLK nor F_SETLKW. Macros UNLOCK_FILE,
	  READLOCK_FILE and WRITELOCK_FILE will always return success.
	  [O_BINARY] (open): New macro. Open file in binary mode.
	  [O_BINARY] (IS_DIR_SEPARATOR): New macro. Check for DOS-style
	  dir separators.

	* testdbm.c [HAVE_STDLIB_H]: Include stdlib.h if available.

	* testndbm.c [HAVE_STDLIB_H]: Include stdlib.h if available.


diff -acprNC5 gdbm-1.8.0.orig/configure.in gdbm-1.8.0.djgpp/configure.in
*** gdbm-1.8.0.orig/configure.in	Wed May 19 00:17:02 1999
--- gdbm-1.8.0.djgpp/configure.in	Sat Aug 25 01:49:16 2001
***************
*** 1,13 ****
  dnl Process this file with autoconf to produce a configure script.
  dnl Initialize
  AC_INIT(gdbmdefs.h)
! AC_CONFIG_HEADER(autoconf.h)
  AC_PROG_CC
  AC_PROG_CPP
  AC_PROG_INSTALL
! AM_PROG_LIBTOOL
  dnl AC_PROG_RANLIB
  dnl AC_WORDS_BIGENDIAN
  AC_CONST
  AC_HAVE_HEADERS(stdlib.h string.h sys/file.h unistd.h fcntl.h sys/types.h)
  AC_HAVE_HEADERS(memory.h)
--- 1,13 ----
  dnl Process this file with autoconf to produce a configure script.
  dnl Initialize
  AC_INIT(gdbmdefs.h)
! AC_CONFIG_HEADER(autoconf.h:autoconf.h-in)
  AC_PROG_CC
  AC_PROG_CPP
  AC_PROG_INSTALL
! AC_PROG_LIBTOOL
  dnl AC_PROG_RANLIB
  dnl AC_WORDS_BIGENDIAN
  AC_CONST
  AC_HAVE_HEADERS(stdlib.h string.h sys/file.h unistd.h fcntl.h sys/types.h)
  AC_HAVE_HEADERS(memory.h)
diff -acprNC5 gdbm-1.8.0.orig/dbm.h gdbm-1.8.0.djgpp/dbm.h
*** gdbm-1.8.0.orig/dbm.h	Wed May 19 00:16:04 1999
--- gdbm-1.8.0.djgpp/dbm.h	Sat Aug 25 01:49:16 2001
***************
*** 25,35 ****
                  Bellingham, WA 98226
         
  *************************************************************************/
  
  /* The data and key structure.  This structure is defined for compatibility. */
! typedef struct {
  	char *dptr;
  	int   dsize;
        } datum;
  
  
--- 25,35 ----
                  Bellingham, WA 98226
         
  *************************************************************************/
  
  /* The data and key structure.  This structure is defined for compatibility. */
! typedef struct __tag_datum {
  	char *dptr;
  	int   dsize;
        } datum;
  
  
diff -acprNC5 gdbm-1.8.0.orig/gdbm.3 gdbm-1.8.0.djgpp/gdbm.3
*** gdbm-1.8.0.orig/gdbm.3	Wed May 19 04:35:08 1999
--- gdbm-1.8.0.djgpp/gdbm.3	Sat Aug 25 01:49:16 2001
*************** writer - if database does not exist crea
*** 282,292 ****
  .br
  .B GDBM_NEWDB
  writer - create new database regardless if one exists
  .br
  For the last three (writers of the database) the following may be added
! added to \fIread_write\fR by bitwise or:
  .B GDBM_SYNC,
  which causes all database operations to be synchronized to the disk, and
  .B GDBM_NOLOCK,
  which prevents the library from performing any locking on the database file.
  The option
--- 282,292 ----
  .br
  .B GDBM_NEWDB
  writer - create new database regardless if one exists
  .br
  For the last three (writers of the database) the following may be added
! to \fIread_write\fR by bitwise or:
  .B GDBM_SYNC,
  which causes all database operations to be synchronized to the disk, and
  .B GDBM_NOLOCK,
  which prevents the library from performing any locking on the database file.
  The option
diff -acprNC5 gdbm-1.8.0.orig/gdbm.proto gdbm-1.8.0.djgpp/gdbm.proto
*** gdbm-1.8.0.orig/gdbm.proto	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/gdbm.proto	Sat Aug 25 01:49:16 2001
***************
*** 51,68 ****
  #define  GDBM_SYNCMODE	3	/* Turn on or off sync operations. */
  #define  GDBM_CENTFREE  4	/* Keep all free blocks in the header. */
  #define  GDBM_COALESCEBLKS 5	/* Attempt to coalesce free blocks. */
  
  /* The data and key structure.  This structure is defined for compatibility. */
! typedef struct {
  	char *dptr;
  	int   dsize;
        } datum;
  
  
  /* The file information header. This is good enough for most applications. */
! typedef struct {int dummy[10];} *GDBM_FILE;
  
  /* Determine if the C(++) compiler requires complete function prototype  */
  #ifndef __P
  #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
  #define __P(x) x
--- 51,68 ----
  #define  GDBM_SYNCMODE	3	/* Turn on or off sync operations. */
  #define  GDBM_CENTFREE  4	/* Keep all free blocks in the header. */
  #define  GDBM_COALESCEBLKS 5	/* Attempt to coalesce free blocks. */
  
  /* The data and key structure.  This structure is defined for compatibility. */
! typedef struct __tag_datum {
  	char *dptr;
  	int   dsize;
        } datum;
  
  
  /* The file information header. This is good enough for most applications. */
! typedef struct __tag_gdbm_file {int dummy[10];} *GDBM_FILE;
  
  /* Determine if the C(++) compiler requires complete function prototype  */
  #ifndef __P
  #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
  #define __P(x) x
diff -acprNC5 gdbm-1.8.0.orig/gdbm.texinfo gdbm-1.8.0.djgpp/gdbm.texinfo
*** gdbm-1.8.0.orig/gdbm.texinfo	Wed May 19 04:35:24 1999
--- gdbm-1.8.0.djgpp/gdbm.texinfo	Sat Aug 25 01:49:16 2001
***************
*** 8,17 ****
--- 8,23 ----
  @iftex
  @finalout
  @end iftex
  
  @ifinfo
+ @direntry
+ * gdbm: (gdbm).                   GNU dbm utility.
+ @end direntry
+ @end ifinfo
+ 
+ @ifinfo
  This file documents the GNU dbm utility.
  
  Copyright (C) 1989-1999 Free Software Foundation, Inc.
  
  Permission is granted to make and distribute verbatim copies of
diff -acprNC5 gdbm-1.8.0.orig/gdbmopen.c gdbm-1.8.0.djgpp/gdbmopen.c
*** gdbm-1.8.0.orig/gdbmopen.c	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/gdbmopen.c	Sat Aug 25 01:49:16 2001
*************** gdbm_open (file, block_size, flags, mode
*** 127,137 ****
      {
        case GDBM_READER:
  	dbf->desc = open (dbf->name, O_RDONLY, 0);
  	break;
  
!       case GDBM_OPENMASK:
  	dbf->desc = open (dbf->name, O_RDWR, 0);
  	break;
  
        case GDBM_NEWDB:
  	dbf->desc = open (dbf->name, O_RDWR|O_CREAT, mode);
--- 127,137 ----
      {
        case GDBM_READER:
  	dbf->desc = open (dbf->name, O_RDONLY, 0);
  	break;
  
!       case GDBM_WRITER:
  	dbf->desc = open (dbf->name, O_RDWR, 0);
  	break;
  
        case GDBM_NEWDB:
  	dbf->desc = open (dbf->name, O_RDWR|O_CREAT, mode);
diff -acprNC5 gdbm-1.8.0.orig/gdbmreorg.c gdbm-1.8.0.djgpp/gdbmreorg.c
*** gdbm-1.8.0.orig/gdbmreorg.c	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/gdbmreorg.c	Sat Aug 25 16:33:02 2001
*************** gdbm_reorganize (dbf)
*** 161,170 ****
--- 161,225 ----
    gdbm_sync (new_dbf);
  
  
    /* Move the new file to old name. */
  
+ #if O_BINARY
+ 
+   /* DOS can not rename an open file.
+      Both source and destination must be closed. */
+ 
+   {
+      char *dbf_name;
+      int dbf_block_size;
+      int dbf_flags;
+      void (*dbf_fatal) ();
+      int status;
+ 
+      gdbm_close (new_dbf);
+ 
+      dbf_name = (char *) malloc (strlen (dbf->name + 1));
+      if (dbf_name == NULL)
+        {
+          gdbm_errno = GDBM_REORGANIZE_FAILED;
+          free (new_name);
+          return -1;
+        }
+      strcpy (dbf_name, dbf->name);
+      dbf_block_size = dbf->header->block_size;
+      dbf_flags = GDBM_WRITER;
+      if (!(dbf->file_locking)) dbf_flags |= GDBM_NOLOCK;
+      if (!(dbf->fast_write))   dbf_flags |= GDBM_SYNC;
+      dbf_fatal = dbf->fatal_err;
+ 
+      gdbm_close (dbf);
+ 
+      status = rename (new_name, dbf_name);
+ 
+      /* Reorganized database will be opened with old file name. */
+      new_dbf = gdbm_open (dbf_name, dbf_block_size, dbf_flags,
+                           fileinfo.st_mode, dbf_fatal);
+      free (dbf_name);
+      if (new_dbf == NULL)
+        /* Database file can not be reopened.
+           Note that gdbm_errno != GDBM_REORGANIZE_FAILED now,
+           and hence the `dbf' is corrupt. */
+        status = -1;
+      else
+        {
+           /* if errno == GDBM_REORGANIZE_FAILED,
+              the caller still has a valid `dbf'. */
+           if (status != 0) gdbm_errno = GDBM_REORGANIZE_FAILED;
+           *dbf = *new_dbf;
+           free (new_dbf);
+        }
+ 
+      return status;  /* If status == 0 then renaming *and* reopening worked. */
+   }
+ 
+ #else  /* not O_BINARY */
+ 
    if (rename (new_name, dbf->name) != 0)
      {
        gdbm_errno = GDBM_REORGANIZE_FAILED;
        gdbm_close (new_dbf);
        free (new_name);
*************** gdbm_reorganize (dbf)
*** 201,210 ****
--- 256,266 ----
    dbf->header_changed    = new_dbf->header_changed;
    dbf->directory_changed = new_dbf->directory_changed;
    dbf->bucket_changed    = new_dbf->bucket_changed;
    dbf->second_changed    = new_dbf->second_changed;
        
+   free (new_dbf->name);
    free (new_dbf);
    free (new_name);
  
    /* Make sure the new database is all on disk. */
    fsync (dbf->desc);
*************** gdbm_reorganize (dbf)
*** 212,217 ****
--- 268,275 ----
    /* Force the right stuff for a correct bucket cache. */
    dbf->cache_entry    = &dbf->bucket_cache[0];
    _gdbm_get_bucket (dbf, 0);
  
    return 0;
+ 
+ #endif /* not O_BINARY */
  }
diff -acprNC5 gdbm-1.8.0.orig/gdbmsetopt.c gdbm-1.8.0.djgpp/gdbmsetopt.c
*** gdbm-1.8.0.orig/gdbmsetopt.c	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/gdbmsetopt.c	Sat Aug 25 01:49:16 2001
*************** gdbm_setopt(dbf, optflag, optval, optlen
*** 86,107 ****
  	  {
  	    gdbm_errno = GDBM_OPT_ILLEGAL;
  	    return(-1);
  	  }
  
! 	dbf->fast_write = *optval;
  	break;
  
        case GDBM_COALESCEBLKS:
        	/* Optval will point to either true or false. */
  	if ((*optval != TRUE) && (*optval != FALSE))
  	  {
  	    gdbm_errno = GDBM_OPT_ILLEGAL;
  	    return(-1);
  	  }
  
! 	dbf->fast_write = *optval;
  	break;
  
        default:
          gdbm_errno = GDBM_OPT_ILLEGAL;
          return(-1);
--- 86,107 ----
  	  {
  	    gdbm_errno = GDBM_OPT_ILLEGAL;
  	    return(-1);
  	  }
  
! 	dbf->central_free = *optval;
  	break;
  
        case GDBM_COALESCEBLKS:
        	/* Optval will point to either true or false. */
  	if ((*optval != TRUE) && (*optval != FALSE))
  	  {
  	    gdbm_errno = GDBM_OPT_ILLEGAL;
  	    return(-1);
  	  }
  
! 	dbf->coalesce_blocks = *optval;
  	break;
  
        default:
          gdbm_errno = GDBM_OPT_ILLEGAL;
          return(-1);
diff -acprNC5 gdbm-1.8.0.orig/Makefile.in gdbm-1.8.0.djgpp/Makefile.in
*** gdbm-1.8.0.orig/Makefile.in	Wed May 19 03:16:06 1999
--- gdbm-1.8.0.djgpp/Makefile.in	Sat Aug 25 01:49:16 2001
*************** INSTALL_DATA = @INSTALL_DATA@
*** 18,50 ****
  BINOWN = bin
  BINGRP = bin
  
  MAKEINFO = makeinfo
  TEXI2DVI = texi2dvi
  
  DEFS =
  
  # Where the system [n]dbm routines are...
  LIBS = @LIBS@ -lc
  
  # SunOS 4 users might wish to add '-fpcc-struct-return' to CFLAGS. see INSTALL.
! CFLAGS = -O
! LDFLAGS =
  
  # Common prefix for installation directories
! prefix = /usr/local
! exec_prefix = $(prefix)
! binprefix = $(exec_prefix)
! manprefix = $(prefix)
  
  # Directory in which to put libgdbm.a.
! libdir = $(exec_prefix)/lib
  # The include directory for gdbm.h and dbm.h.
! includedir = $(prefix)/include
  # Info and man directories.
! infodir = $(prefix)/info
! man3dir = $(prefix)/man/man3
  manext = 3
  
  #### End of system configuration section. ####
  
  .SUFFIXES:
--- 18,49 ----
  BINOWN = bin
  BINGRP = bin
  
  MAKEINFO = makeinfo
  TEXI2DVI = texi2dvi
+ DVIPS = dvips
  
  DEFS =
  
  # Where the system [n]dbm routines are...
  LIBS = @LIBS@ -lc
  
  # SunOS 4 users might wish to add '-fpcc-struct-return' to CFLAGS. see INSTALL.
! CFLAGS = @CFLAGS@
! LDFLAGS = @LDFLAGS@
  
  # Common prefix for installation directories
! prefix = @prefix@
! exec_prefix = @exec_prefix@
  
  # Directory in which to put libgdbm.a.
! libdir = @libdir@
  # The include directory for gdbm.h and dbm.h.
! includedir = @includedir@
  # Info and man directories.
! infodir = @infodir@
! man3dir = @mandir@/man3
  manext = 3
  
  #### End of system configuration section. ####
  
  .SUFFIXES:
*************** LOBJS = $(DBM_LOF) $(NDBM_LOF) $(GDBM_LO
*** 106,116 ****
  
  HDRS = gdbmdefs.h extern.h gdbmerrno.h systems.h dbm.h ndbm.h gdbmconst.h \
  	proto.h
  
  MSCFILES = COPYING ChangeLog Makefile.in README gdbm.3 gdbm.texinfo \
! 	gdbm.info NEWS INSTALL gdbm.proto gdbm.proto2 conv2gdbm.c \
  	configure configure.in getopt.c getopt.h samp1.cc \
  	autoconf.h.in install-sh mkinstalldirs config.guess config.sub \
  	aclocal.m4 ltconfig ltmain.sh
  
  DISTFILES = $(SRCS) $(HDRS) $(MSCFILES)
--- 105,115 ----
  
  HDRS = gdbmdefs.h extern.h gdbmerrno.h systems.h dbm.h ndbm.h gdbmconst.h \
  	proto.h
  
  MSCFILES = COPYING ChangeLog Makefile.in README gdbm.3 gdbm.texinfo \
! 	gdbm.info NEWS INSTALL gdbm.proto gdbm.pr2 conv2gdbm.c \
  	configure configure.in getopt.c getopt.h samp1.cc \
  	autoconf.h.in install-sh mkinstalldirs config.guess config.sub \
  	aclocal.m4 ltconfig ltmain.sh
  
  DISTFILES = $(SRCS) $(HDRS) $(MSCFILES)
*************** all: libgdbm.la
*** 119,141 ****
  
  progs: $(PROGS)
  
  install: libgdbm.la gdbm.h gdbm.info
  	$(srcdir)/mkinstalldirs $(libdir) $(includedir) $(man3dir) $(infodir)
! 	$(LIBTOOL) install -c libgdbm.la $(libdir)/libgdbm.la
! 	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) gdbm.h $(includedir)/gdbm.h
! 	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.3 \
! 		$(man3dir)/gdbm.3
! 	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.info \
! 		$(infodir)/gdbm.info
  
  install-compat:
  	$(srcdir)/mkinstalldirs $(includedir)
! 	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/dbm.h \
! 		$(includedir)/dbm.h
! 	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/ndbm.h \
! 		$(includedir)/ndbm.h
  
  #libgdbm.a: $(OBJS) gdbm.h
  #	rm -f libgdbm.a
  #	ar q libgdbm.a $(OBJS)
  #	$(RANLIB) libgdbm.a
--- 118,136 ----
  
  progs: $(PROGS)
  
  install: libgdbm.la gdbm.h gdbm.info
  	$(srcdir)/mkinstalldirs $(libdir) $(includedir) $(man3dir) $(infodir)
! 	$(LIBTOOL) --mode=install $(INSTALL_DATA) libgdbm.la $(libdir)/libgdbm.la
! 	$(INSTALL_DATA) gdbm.h $(includedir)/gdbm.h
! 	$(INSTALL_DATA) $(srcdir)/gdbm.3 $(man3dir)/gdbm.3
! 	$(INSTALL_DATA) gdbm.info $(infodir)/gdbm.info
  
  install-compat:
  	$(srcdir)/mkinstalldirs $(includedir)
! 	$(INSTALL_DATA) $(srcdir)/dbm.h $(includedir)/dbm.h
! 	$(INSTALL_DATA) $(srcdir)/ndbm.h $(includedir)/ndbm.h
  
  #libgdbm.a: $(OBJS) gdbm.h
  #	rm -f libgdbm.a
  #	ar q libgdbm.a $(OBJS)
  #	$(RANLIB) libgdbm.a
*************** install-compat:
*** 143,185 ****
  libgdbm.la: $(LOBJS) gdbm.h
  	rm -f libgdbm.la
  	$(LIBTOOL) --mode=link $(CC) -o libgdbm.la -rpath $(libdir) \
  		-version-info $(SHLIB_VER) $(LOBJS)
  
! gdbm.h:	gdbm.proto gdbmerrno.h gdbm.proto2
  	rm -f gdbm.h
  	cp $(srcdir)/gdbm.proto gdbm.h
  	chmod +w gdbm.h
  	grep _ $(srcdir)/gdbmerrno.h >> gdbm.h
! 	cat $(srcdir)/gdbm.proto2 >> gdbm.h
  	chmod -w gdbm.h
  
  testgdbm: testgdbm.o libgdbm.la @LIBOBJS@
! 	$(LIBTOOL) $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
  
  testdbm: testdbm.o libgdbm.la
! 	$(LIBTOOL) $(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.la
  
  tdbm: testdbm.o
  	$(CC) $(LDFLAGS) -o tdbm testdbm.o $(LIBS)
  
  testndbm.o: testndbm.c
  	$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) -DGNU $(srcdir)/testndbm.c
  
  testndbm: testndbm.o libgdbm.la
! 	$(LIBTOOL) $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.la
  
  tndbm.o: testndbm.c
  	cp $(srcdir)/testndbm.c ./tndbm.c
  	$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) ./tndbm.c
  	rm -f ./tndbm.c
  
  tndbm: tndbm.o
  	$(CC) $(LDFLAGS) -o tndbm tndbm.o $(LIBS)
  
  conv2gdbm: conv2gdbm.o libgdbm.la @LIBOBJS@
! 	$(LIBTOOL) $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm.la @LIBOBJS@
  
  lintgdbm: 
  	lint $(DEFS) $(LFLAGS) $(DBM_CF) $(NDBM_CF) $(GDBM_CF) testgdbm.c
  
  TAGS: $(SRCS)
--- 138,180 ----
  libgdbm.la: $(LOBJS) gdbm.h
  	rm -f libgdbm.la
  	$(LIBTOOL) --mode=link $(CC) -o libgdbm.la -rpath $(libdir) \
  		-version-info $(SHLIB_VER) $(LOBJS)
  
! gdbm.h:	gdbm.proto gdbmerrno.h gdbm.pr2
  	rm -f gdbm.h
  	cp $(srcdir)/gdbm.proto gdbm.h
  	chmod +w gdbm.h
  	grep _ $(srcdir)/gdbmerrno.h >> gdbm.h
! 	cat $(srcdir)/gdbm.pr2 >> gdbm.h
  	chmod -w gdbm.h
  
  testgdbm: testgdbm.o libgdbm.la @LIBOBJS@
! 	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
  
  testdbm: testdbm.o libgdbm.la
! 	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.la
  
  tdbm: testdbm.o
  	$(CC) $(LDFLAGS) -o tdbm testdbm.o $(LIBS)
  
  testndbm.o: testndbm.c
  	$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) -DGNU $(srcdir)/testndbm.c
  
  testndbm: testndbm.o libgdbm.la
! 	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.la
  
  tndbm.o: testndbm.c
  	cp $(srcdir)/testndbm.c ./tndbm.c
  	$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) ./tndbm.c
  	rm -f ./tndbm.c
  
  tndbm: tndbm.o
  	$(CC) $(LDFLAGS) -o tndbm tndbm.o $(LIBS)
  
  conv2gdbm: conv2gdbm.o libgdbm.la @LIBOBJS@
! 	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm.la @LIBOBJS@
  
  lintgdbm: 
  	lint $(DEFS) $(LFLAGS) $(DBM_CF) $(NDBM_CF) $(GDBM_CF) testgdbm.c
  
  TAGS: $(SRCS)
*************** TAGS: $(SRCS)
*** 188,202 ****
--- 183,207 ----
  info: gdbm.info
  
  gdbm.info:
  	$(MAKEINFO) $(srcdir)/gdbm.texinfo
  
+ html: gdbm.html
+ 
+ gdbm.html:
+ 	$(MAKEINFO) --html $(srcdir)/gdbm.texinfo
+ 
  dvi: gdbm.dvi
  
  gdbm.dvi:
  	$(TEXI2DVI) $(srcdir)/gdbm.texinfo
  
+ ps: gdbm.ps
+ 
+ gdbm.ps: dvi
+ 	$(DVIPS) gdbm.dvi -o gdbm.ps
+ 
  clean:
  	rm -rf $(PROGS) $(TEX_F) *.a *.la *.o *.lo core *.core junk* \
  		.libs _libs
  
  mostlyclean: clean
diff -acprNC5 gdbm-1.8.0.orig/ndbm.h gdbm-1.8.0.djgpp/ndbm.h
*** gdbm-1.8.0.orig/ndbm.h	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/ndbm.h	Sat Aug 25 01:49:16 2001
***************
*** 30,47 ****
  #define  DBM_INSERT  0
  #define  DBM_REPLACE 1
  
  
  /* The data and key structure.  This structure is defined for compatibility. */
! typedef struct {
  	char *dptr;
  	int   dsize;
        } datum;
  
  
  /* The file information header. This is good enough for most applications. */
! typedef struct {int dummy[10];} DBM;
  
  
  /* These are the routines (with some macros defining them!) */
  
  extern DBM 	*dbm_open ();
--- 30,47 ----
  #define  DBM_INSERT  0
  #define  DBM_REPLACE 1
  
  
  /* The data and key structure.  This structure is defined for compatibility. */
! typedef struct __tag_datum {
  	char *dptr;
  	int   dsize;
        } datum;
  
  
  /* The file information header. This is good enough for most applications. */
! typedef struct __tag_dbm {int dummy[10];} DBM;
  
  
  /* These are the routines (with some macros defining them!) */
  
  extern DBM 	*dbm_open ();
diff -acprNC5 gdbm-1.8.0.orig/systems.h gdbm-1.8.0.djgpp/systems.h
*** gdbm-1.8.0.orig/systems.h	Wed May 19 02:09:46 1999
--- gdbm-1.8.0.djgpp/systems.h	Sat Aug 25 06:38:00 2001
***************
*** 85,94 ****
--- 85,108 ----
  
  #else
  
  /* Assume it is done like System V. */
  
+ #ifdef __DJGPP__
+   /* DJGPP 2.03 implementation of fcntl() does not support F_GETLK, F_SETLK
+      nor F_SETLKW. To make this package work, the macros below will *NEVER*
+      invoke fcntl() at all and *ALWAYS* return success.
+      All this means that READLOCK_FILE(dbf) and WRITELOCK_FILE(dbf)
+      will set lock_val = 0 simulating file locking/unlocking success
+      when there have been done **NO** file locking/unlocking at all.
+   */
+ 
+ # define UNLOCK_FILE(dbf)    0
+ # define READLOCK_FILE(dbf)  lock_val = 0; /* simulate success. */
+ # define WRITELOCK_FILE(dbf) lock_val = 0; /* simulate success. */
+ #else /* !__DJGPP */
+ 
  #define UNLOCK_FILE(dbf) \
  	{					\
  	  struct flock flock;			\
  	  flock.l_type = F_UNLCK;		\
  	  flock.l_whence = SEEK_SET;		\
***************
*** 109,118 ****
--- 123,135 ----
  	  flock.l_type = F_WRLCK;		\
  	  flock.l_whence = SEEK_SET;			\
  	  flock.l_start = flock.l_len = 0L;	\
  	  lock_val = fcntl (dbf->desc, F_SETLK, &flock);	\
  	}
+ 
+ #endif /* !__DJGPP */
+ 
  #endif
  
  /* Do we have bcopy?  */
  #if !HAVE_BCOPY
  #if HAVE_MEMORY_H
***************
*** 144,148 ****
--- 161,181 ----
  #endif
  
  #ifndef STDERR_FILENO
  #define STDERR_FILENO 2
  #endif
+ 
+ /* For systems that distinguish between text and binary I/O.
+    O_BINARY is usually declared in fcntl.h  */
+ #if !defined O_BINARY && defined _O_BINARY
+   /* For MSC-compatible compilers.  */
+ # define O_BINARY _O_BINARY
+ #endif
+ #if O_BINARY
+   /* Files must be opened in BINARY mode. */
+ # define open(x, y, z)  open ((x), (y) | O_BINARY, (z))
+ # define IS_DIR_SEPARATOR(c) ((c) == ':' || (c) == '/' || (c) == '\\')
+ #else /* not O_BINARY */
+ # define O_BINARY
+ # define IS_DIR_SEPARATOR(c) ((c) == '/')
+ #endif /* not O_BINARY */
+ 
diff -acprNC5 gdbm-1.8.0.orig/testdbm.c gdbm-1.8.0.djgpp/testdbm.c
*** gdbm-1.8.0.orig/testdbm.c	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/testdbm.c	Sat Aug 25 01:49:16 2001
***************
*** 29,38 ****
--- 29,41 ----
  
  /* include system configuration before all else. */
  #include "autoconf.h"
  
  #include <stdio.h>
+ #if HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
  #include <sys/types.h>
  #if HAVE_SYS_FILE_H
  #include <sys/file.h>
  #endif
  #include <sys/stat.h>
diff -acprNC5 gdbm-1.8.0.orig/testndbm.c gdbm-1.8.0.djgpp/testndbm.c
*** gdbm-1.8.0.orig/testndbm.c	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/testndbm.c	Sat Aug 25 01:49:16 2001
***************
*** 29,38 ****
--- 29,41 ----
  
  /* include system configuration before all else. */
  #include "autoconf.h"
  
  #include <stdio.h>
+ #if HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
  #include <sys/types.h>
  #if HAVE_FILE_H
  #include <sys/file.h>
  #endif
  #include <sys/stat.h>
diff -acprNC5 gdbm-1.8.0.orig/version.c gdbm-1.8.0.djgpp/version.c
*** gdbm-1.8.0.orig/version.c	Wed May 19 00:16:06 1999
--- gdbm-1.8.0.djgpp/version.c	Sat Aug 25 01:49:36 2001
***************
*** 28,33 ****
  
  #include "autoconf.h"
  
  /* Keep a string with the version number in it! */
  const char * gdbm_version =
! 	"This is GDBM version 1.8.0, as of May 19, 1999.";
--- 28,33 ----
  
  #include "autoconf.h"
  
  /* Keep a string with the version number in it! */
  const char * gdbm_version =
! 	"This is GDBM version 1.8.0, as of May 19, 1999 (DJGPP port 2001-08-25).";
