home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-09-22 | 107.2 KB | 3,518 lines |
- diff -cBdNp e:/gnu/gdbm/gnu/bucket.c ./bucket.c
- *** e:/gnu/gdbm/gnu/bucket.c Thu Aug 16 10:48:58 1990
- --- ./bucket.c Thu Aug 16 10:50:08 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/bucket.c'v 1.4.0.1 90/08/16 09:22:04 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- ***************
- *** 37,42 ****
- --- 55,61 ----
-
-
- /* Initializing a new hash buckets sets all bucket entries to -1 hash value. */
- + VOID
- _gdbm_new_bucket (dbf, bucket, bits)
- gdbm_file_info *dbf;
- hash_bucket *bucket;
- *************** _gdbm_new_bucket (dbf, bucket, bits)
- *** 63,75 ****
- is already in memory. If not, a bucket may be tossed to read the new
- bucket. In any case, the requested bucket is make the "current" bucket
- and dbf->bucket points to the correct bucket. */
- ! int
- _gdbm_get_bucket (dbf, dir_index)
- gdbm_file_info *dbf;
- int dir_index;
- {
- ! int bucket_adr; /* The address of the correct hash bucket. */
- ! int num_bytes; /* The number of bytes read. */
- int index; /* Loop index. */
-
- /* Initial set up. */
- --- 82,94 ----
- is already in memory. If not, a bucket may be tossed to read the new
- bucket. In any case, the requested bucket is make the "current" bucket
- and dbf->bucket points to the correct bucket. */
- ! VOID
- _gdbm_get_bucket (dbf, dir_index)
- gdbm_file_info *dbf;
- int dir_index;
- {
- ! LONG bucket_adr; /* The address of the correct hash bucket. */
- ! LONG num_bytes; /* The number of bytes read. */
- int index; /* Loop index. */
-
- /* Initial set up. */
- *************** _gdbm_get_bucket (dbf, dir_index)
- *** 101,107 ****
- --- 120,131 ----
- if (num_bytes != bucket_adr)
- _gdbm_fatal (dbf, "lseek error");
-
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = read (dbf->desc,
- + (char *)dbf->bucket, dbf->header->bucket_size);
- + #else /* not MSDOS */
- num_bytes = read (dbf->desc, dbf->bucket, dbf->header->bucket_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->bucket_size)
- _gdbm_fatal (dbf, "read error");
- }
- *************** _gdbm_get_bucket (dbf, dir_index)
- *** 115,123 ****
- are stored in the buckets. Splitting the current bucket may require
- doubling the size of the hash directory. */
-
- _gdbm_split_bucket (dbf, next_insert)
- gdbm_file_info *dbf;
- ! int next_insert;
- {
- hash_bucket *bucket[2]; /* Pointers to the new buckets. */
-
- --- 139,148 ----
- are stored in the buckets. Splitting the current bucket may require
- doubling the size of the hash directory. */
-
- + VOID
- _gdbm_split_bucket (dbf, next_insert)
- gdbm_file_info *dbf;
- ! LONG next_insert;
- {
- hash_bucket *bucket[2]; /* Pointers to the new buckets. */
-
- *************** _gdbm_split_bucket (dbf, next_insert)
- *** 124,131 ****
- int new_bits; /* The number of bits for the new buckets. */
- int cache_0; /* Location in the cache for the buckets. */
- int cache_1;
- ! int adr_0; /* File address of the new bucket 0. */
- ! int adr_1; /* File address of the new bucket 1. */
- avail_elem old_bucket; /* Avail Struct for the old bucket. */
-
- int dir_start0; /* Used in updating the directory. */
- --- 149,156 ----
- int new_bits; /* The number of bits for the new buckets. */
- int cache_0; /* Location in the cache for the buckets. */
- int cache_1;
- ! LONG adr_0; /* File address of the new bucket 0. */
- ! LONG adr_1; /* File address of the new bucket 1. */
- avail_elem old_bucket; /* Avail Struct for the old bucket. */
-
- int dir_start0; /* Used in updating the directory. */
- *************** _gdbm_split_bucket (dbf, next_insert)
- *** 132,141 ****
- int dir_start1;
- int dir_end;
-
- ! int *new_dir; /* Pointer to the new directory. */
- ! int dir_adr; /* Address of the new directory. */
- int dir_size; /* Size of the new directory. */
- ! int old_adr[31]; /* Address of the old directories. */
- int old_size[31]; /* Size of the old directories. */
- int old_count; /* Number of old directories. */
-
- --- 157,166 ----
- int dir_start1;
- int dir_end;
-
- ! LONG *new_dir; /* Pointer to the new directory. */
- ! LONG dir_adr; /* Address of the new directory. */
- int dir_size; /* Size of the new directory. */
- ! LONG old_adr[31]; /* Address of the old directories. */
- int old_size[31]; /* Size of the old directories. */
- int old_count; /* Number of old directories. */
-
- *************** _gdbm_split_bucket (dbf, next_insert)
- *** 185,193 ****
- {
- dir_size = dbf->header->dir_size * 2;
- dir_adr = _gdbm_alloc (dbf, dir_size);
- ! new_dir = (int *) malloc (dir_size);
- if (new_dir == NULL) _gdbm_fatal (dbf, "malloc error");
- ! for (index = 0; index < dbf->header->dir_size/sizeof (int); index++)
- {
- new_dir[2*index] = dbf->dir[index];
- new_dir[2*index+1] = dbf->dir[index];
- --- 210,218 ----
- {
- dir_size = dbf->header->dir_size * 2;
- dir_adr = _gdbm_alloc (dbf, dir_size);
- ! new_dir = (LONG *) malloc (dir_size);
- if (new_dir == NULL) _gdbm_fatal (dbf, "malloc error");
- ! for (index = 0; index < dbf->header->dir_size/sizeof (LONG); index++)
- {
- new_dir[2*index] = dbf->dir[index];
- new_dir[2*index+1] = dbf->dir[index];
- *************** _gdbm_split_bucket (dbf, next_insert)
- *** 212,219 ****
- --- 237,249 ----
- for (index = 0; index < dbf->header->bucket_elems; index++)
- {
- old_el = & (dbf->bucket->h_table[index]);
- + #ifdef MSDOS
- + select = (int) (old_el->hash_value >> (31-new_bits)) & 1;
- + elem_loc = (int) (old_el->hash_value % dbf->header->bucket_elems);
- + #else /* not MSDOS */
- select = (old_el->hash_value >> (31-new_bits)) & 1;
- elem_loc = old_el->hash_value % dbf->header->bucket_elems;
- + #endif /* not MSDOS */
- while (bucket[select]->h_table[elem_loc].hash_value != -1)
- elem_loc = (elem_loc + 1) % dbf->header->bucket_elems;
- bucket[select]->h_table[elem_loc] = *old_el;
- *************** _gdbm_split_bucket (dbf, next_insert)
- *** 263,269 ****
- --- 293,303 ----
- dbf->second_changed = TRUE;
-
- /* Update the cache! */
- + #ifdef MSDOS
- + dbf->bucket_dir = (int) (next_insert >> (31-dbf->header->dir_bits));
- + #else /* not MSDOS */
- dbf->bucket_dir = next_insert >> (31-dbf->header->dir_bits);
- + #endif /* not MSDOS */
-
- /* Invalidate old cache entry. */
- old_bucket.av_adr = dbf->cache_entry->ca_adr;
- *************** _gdbm_split_bucket (dbf, next_insert)
- *** 300,315 ****
- /* The only place where a bucket is written. CA_ENTRY is the
- cache entry containing the bucket to be written. */
-
- _gdbm_write_bucket (dbf, ca_entry)
- gdbm_file_info *dbf;
- cache_elem *ca_entry;
- {
- ! int num_bytes; /* The return value for lseek and write. */
-
- num_bytes = lseek (dbf->desc, ca_entry->ca_adr, L_SET);
- if (num_bytes != ca_entry->ca_adr)
- _gdbm_fatal (dbf, "lseek error");
- num_bytes = write (dbf->desc, ca_entry->ca_bucket, dbf->header->bucket_size);
- if (num_bytes != dbf->header->bucket_size)
- _gdbm_fatal (dbf, "write error");
- ca_entry->ca_changed = FALSE;
- --- 334,355 ----
- /* The only place where a bucket is written. CA_ENTRY is the
- cache entry containing the bucket to be written. */
-
- + VOID
- _gdbm_write_bucket (dbf, ca_entry)
- gdbm_file_info *dbf;
- cache_elem *ca_entry;
- {
- ! LONG num_bytes; /* The return value for lseek and write. */
-
- num_bytes = lseek (dbf->desc, ca_entry->ca_adr, L_SET);
- if (num_bytes != ca_entry->ca_adr)
- _gdbm_fatal (dbf, "lseek error");
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = write (dbf->desc,
- + (char *)ca_entry->ca_bucket, dbf->header->bucket_size);
- + #else /* not MSDOS */
- num_bytes = write (dbf->desc, ca_entry->ca_bucket, dbf->header->bucket_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->bucket_size)
- _gdbm_fatal (dbf, "write error");
- ca_entry->ca_changed = FALSE;
- diff -cBdNp e:/gnu/gdbm/gnu/dbm.h ./dbm.h
- *** e:/gnu/gdbm/gnu/dbm.h Thu Aug 16 10:49:02 1990
- --- ./dbm.h Thu Aug 16 10:50:10 1990
- ***************
- *** 27,32 ****
- --- 27,49 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbm.h'v 1.4.0.1 90/08/16 09:22:56 tho Exp $
- + */
- +
- /* The data and key structure. This structure is defined for compatibility. */
- typedef struct {
- char *dptr;
- *************** typedef struct {
- *** 34,55 ****
- } datum;
-
-
- - /* These are the routines in dbm. */
-
- ! extern int dbminit ();
-
- extern datum fetch ();
- -
- extern int store ();
- -
- - extern int delete ();
- -
- extern int delete ();
- -
- extern datum firstkey ();
- -
- extern datum nextkey ();
- !
- ! /* To make some versions work we need the following define. */
- !
- ! #define dbmclose()
- --- 51,73 ----
- } datum;
-
-
-
- ! /* To make some versions work we need the following define. */
-
- + #define dbmclose()
- + /* These are the routines in dbm. */
- + #ifdef __STDC__
- + extern int dbminit (char *file);
- + extern datum fetch(datum key);
- + extern int store (datum key, datum content);
- + extern int delete (datum key);
- + extern datum firstkey (void);
- + extern datum nextkey (datum key);
- + #else /* not __STDC__ */
- + extern int dbminit ();
- extern datum fetch ();
- extern int store ();
- extern int delete ();
- extern datum firstkey ();
- extern datum nextkey ();
- ! #endif /* not __STDC__ */
- diff -cBdNp e:/gnu/gdbm/gnu/dbmclose.c ./dbmclose.c
- *** e:/gnu/gdbm/gnu/dbmclose.c Thu Aug 16 10:49:04 1990
- --- ./dbmclose.c Thu Aug 16 10:50:12 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmclose.c'v 1.4.0.1 90/08/16 09:22:06 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- diff -cBdNp e:/gnu/gdbm/gnu/dbmdelet.c ./dbmdelet.c
- *** e:/gnu/gdbm/gnu/dbmdelet.c Thu Aug 16 10:49:04 1990
- --- ./dbmdelet.c Thu Aug 16 10:50:14 1990
- ***************
- *** 28,37 ****
- --- 28,55 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmdelet.c'v 1.4.0.1 90/08/16 09:22:08 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/dbmdirfn.c ./dbmdirfn.c
- *** e:/gnu/gdbm/gnu/dbmdirfn.c Thu Aug 16 10:49:06 1990
- --- ./dbmdirfn.c Thu Aug 16 10:50:16 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmdirfn.c'v 1.4.0.1 90/08/16 09:22:09 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- diff -cBdNp e:/gnu/gdbm/gnu/dbmfetch.c ./dbmfetch.c
- *** e:/gnu/gdbm/gnu/dbmfetch.c Thu Aug 16 10:49:08 1990
- --- ./dbmfetch.c Thu Aug 16 10:50:18 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmfetch.c'v 1.4.0.1 90/08/16 09:22:10 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/dbminit.c ./dbminit.c
- *** e:/gnu/gdbm/gnu/dbminit.c Thu Aug 16 10:49:10 1990
- --- ./dbminit.c Thu Aug 16 10:50:20 1990
- ***************
- *** 28,37 ****
- --- 28,55 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbminit.c'v 1.4.0.1 90/08/16 09:22:11 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** dbminit (file)
- *** 92,98 ****
- --- 110,120 ----
- if (stat (dir_file, &dir_stat) == 0)
- {
- if (dir_stat.st_size == 0)
- + #ifdef MSDOS
- + if (open (dir_file, O_RDWR|O_TRUNC, S_IREAD|S_IWRITE) < 0)
- + #else /* not MSDOS */
- if (unlink (dir_file) != 0 || link (pag_file, dir_file) != 0)
- + #endif /* not MSDOS */
- {
- gdbm_errno = GDBM_FILE_OPEN_ERROR;
- gdbm_close (_gdbm_file);
- *************** dbminit (file)
- *** 103,109 ****
- --- 125,135 ----
- {
- /* Since we can't stat it, we assume it is not there and try
- to link the dir_file to the pag_file. */
- + #ifdef MSDOS
- + if (open (dir_file, O_RDWR|O_CREAT, S_IREAD|S_IWRITE) < 0)
- + #else /* not MSDOS */
- if (link (pag_file, dir_file) != 0)
- + #endif /* not MSDOS */
- {
- gdbm_errno = GDBM_FILE_OPEN_ERROR;
- gdbm_close (_gdbm_file);
- *************** dbminit (file)
- *** 110,115 ****
- return -1;
- }
- }
- !
- return 0;
- }
- --- 136,141 ----
- return -1;
- }
- }
- !
- return 0;
- }
- diff -cBdNp e:/gnu/gdbm/gnu/dbmopen.c ./dbmopen.c
- *** e:/gnu/gdbm/gnu/dbmopen.c Thu Aug 16 10:49:12 1990
- --- ./dbmopen.c Thu Aug 16 10:50:22 1990
- ***************
- *** 28,37 ****
- --- 28,55 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmopen.c'v 1.4.0.1 90/08/16 09:22:12 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** dbm_open (file, flags, mode)
- *** 110,116 ****
- --- 129,139 ----
- if (stat (dir_file, &dir_stat) == 0)
- {
- if (dir_stat.st_size == 0)
- + #ifdef MSDOS
- + if (open (dir_file, O_RDWR|O_TRUNC, S_IREAD|S_IWRITE) < 0)
- + #else /* not MSDOS */
- if (unlink (dir_file) != 0 || link (pag_file, dir_file) != 0)
- + #endif /* not MSDOS */
- {
- gdbm_errno = GDBM_FILE_OPEN_ERROR;
- gdbm_close (temp_dbf);
- *************** dbm_open (file, flags, mode)
- *** 121,127 ****
- --- 144,154 ----
- {
- /* Since we can't stat it, we assume it is not there and try
- to link the dir_file to the pag_file. */
- + #ifdef MSDOS
- + if (open (dir_file, O_RDWR|O_CREAT, S_IREAD|S_IWRITE) < 0)
- + #else /* not MSDOS */
- if (link (pag_file, dir_file) != 0)
- + #endif /* not MSDOS */
- {
- gdbm_errno = GDBM_FILE_OPEN_ERROR;
- gdbm_close (temp_dbf);
- *************** dbm_open (file, flags, mode)
- *** 128,133 ****
- return NULL;
- }
- }
- !
- return temp_dbf;
- }
- --- 155,160 ----
- return NULL;
- }
- }
- !
- return temp_dbf;
- }
- diff -cBdNp e:/gnu/gdbm/gnu/dbmpagfn.c ./dbmpagfn.c
- *** e:/gnu/gdbm/gnu/dbmpagfn.c Thu Aug 16 10:49:12 1990
- --- ./dbmpagfn.c Thu Aug 16 10:50:24 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmpagfn.c'v 1.4.0.1 90/08/16 09:22:14 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- diff -cBdNp e:/gnu/gdbm/gnu/dbmseq.c ./dbmseq.c
- *** e:/gnu/gdbm/gnu/dbmseq.c Thu Aug 16 10:49:14 1990
- --- ./dbmseq.c Thu Aug 16 10:50:26 1990
- ***************
- *** 28,37 ****
- --- 28,55 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmseq.c'v 1.4.0.1 90/08/16 09:22:15 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/dbmstore.c ./dbmstore.c
- *** e:/gnu/gdbm/gnu/dbmstore.c Thu Aug 16 10:49:16 1990
- --- ./dbmstore.c Thu Aug 16 10:50:28 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/dbmstore.c'v 1.4.0.1 90/08/16 09:22:17 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/delete.c ./delete.c
- *** e:/gnu/gdbm/gnu/delete.c Thu Aug 16 10:49:18 1990
- --- ./delete.c Thu Aug 16 10:50:30 1990
- ***************
- *** 28,37 ****
- --- 28,55 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/delete.c'v 1.4.0.1 90/08/16 09:22:18 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/extern.h ./extern.h
- *** e:/gnu/gdbm/gnu/extern.h Thu Aug 16 10:49:20 1990
- --- ./extern.h Thu Aug 16 10:50:32 1990
- ***************
- *** 27,32 ****
- --- 27,48 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/extern.h'v 1.4.0.1 90/08/16 09:22:57 tho Exp $
- + */
-
- /* The global variables used for the "original" interface. */
- extern gdbm_file_info *_gdbm_file;
- *************** extern char *_gdbm_fetch_val;
- *** 37,51 ****
-
-
- /* External routines used. */
- !
- extern gdbm_file_info *gdbm_open ();
- -
- extern datum gdbm_fetch ();
- -
- extern datum gdbm_firstkey ();
- -
- extern datum gdbm_nextkey ();
- -
- extern int gdbm_delete ();
- -
- extern int gdbm_store ();
- --- 53,70 ----
-
-
- /* External routines used. */
- ! #ifdef __STDC__
- ! extern gdbm_file_info *gdbm_open (char *file, int block_size, int read_write, int mode, void (*fatal_func)());
- ! extern datum gdbm_fetch (gdbm_file_info *dbf, datum key);
- ! extern datum gdbm_firstkey (gdbm_file_info *dbf);
- ! extern datum gdbm_nextkey (gdbm_file_info *dbf, datum key);
- ! extern int gdbm_delete (gdbm_file_info *dbf, datum key);
- ! extern int gdbm_reorganize (gdbm_file_info *dbf);
- ! #else /* not __STDC__ */
- extern gdbm_file_info *gdbm_open ();
- extern datum gdbm_fetch ();
- extern datum gdbm_firstkey ();
- extern datum gdbm_nextkey ();
- extern int gdbm_delete ();
- extern int gdbm_store ();
- + #endif /* not __STDC__ */
- diff -cBdNp e:/gnu/gdbm/gnu/falloc.c ./falloc.c
- *** e:/gnu/gdbm/gnu/falloc.c Thu Aug 16 10:49:22 1990
- --- ./falloc.c Thu Aug 16 10:50:36 1990
- ***************
- *** 27,45 ****
- --- 27,72 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/falloc.c'v 1.4.0.1 90/08/16 09:22:19 tho Exp $
- + */
- +
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
-
-
- + #ifdef __STDC__
- + static avail_elem get_elem (int size, avail_elem *av_table, int *av_count);
- + static avail_elem get_block (int size, gdbm_file_info *dbf);
- + static VOID push_avail_block (gdbm_file_info *dbf);
- + static VOID pop_avail_block (gdbm_file_info *dbf);
- + static VOID adjust_bucket_avail (gdbm_file_info *dbf);
- + #else /* not __STDC__ */
- static avail_elem get_elem (); /* Get avail_elems from a list. */
- static avail_elem get_block ();
- static push_avail_block ();
- static pop_avail_block ();
- static adjust_bucket_avail ();
- + #endif /* not __STDC__ */
-
- /* Allocate space in the file DBF for a block NUM_BYTES in length. Return
- the file address of the start of the block.
- *************** static adjust_bucket_avail ();
- *** 57,68 ****
- changed by this routine if a change is needed. If an error occurs,
- the value of 0 will be returned. */
-
- ! int
- _gdbm_alloc (dbf, num_bytes)
- gdbm_file_info *dbf;
- int num_bytes;
- {
- ! int file_adr; /* The address of the block. */
- avail_elem av_el; /* For temporary use. */
-
- /* The current bucket is the first place to look for space. */
- --- 84,95 ----
- changed by this routine if a change is needed. If an error occurs,
- the value of 0 will be returned. */
-
- ! LONG
- _gdbm_alloc (dbf, num_bytes)
- gdbm_file_info *dbf;
- int num_bytes;
- {
- ! LONG file_adr; /* The address of the block. */
- avail_elem av_el; /* For temporary use. */
-
- /* The current bucket is the first place to look for space. */
- *************** _gdbm_alloc (dbf, num_bytes)
- *** 104,110 ****
-
- _gdbm_free (dbf, file_adr, num_bytes)
- gdbm_file_info *dbf;
- ! int file_adr;
- int num_bytes;
- {
- avail_elem temp;
- --- 131,137 ----
-
- _gdbm_free (dbf, file_adr, num_bytes)
- gdbm_file_info *dbf;
- ! LONG file_adr;
- int num_bytes;
- {
- avail_elem temp;
- *************** _gdbm_free (dbf, file_adr, num_bytes)
- *** 111,117 ****
-
- /* Is it too small to worry about? */
- if (num_bytes <= IGNORE_SIZE)
- ! return;
-
- /* Initialize the avail element. */
- temp.av_size = num_bytes;
- --- 138,144 ----
-
- /* Is it too small to worry about? */
- if (num_bytes <= IGNORE_SIZE)
- ! return TRUE; /* is that correct (was "return;")? -tho */
-
- /* Initialize the avail element. */
- temp.av_size = num_bytes;
- *************** _gdbm_free (dbf, file_adr, num_bytes)
- *** 150,156 ****
- adjust_bucket_avail (dbf);
-
- /* All work is done. */
- ! return;
- }
-
-
- --- 177,183 ----
- adjust_bucket_avail (dbf);
-
- /* All work is done. */
- ! return TRUE; /* is that correct (was "return;")? -tho */
- }
-
-
- *************** _gdbm_free (dbf, file_adr, num_bytes)
- *** 162,172 ****
- /* Gets the avail block at the top of the stack and loads it into the
- active avail block. It does a "free" for itself! */
-
- ! static
- pop_avail_block (dbf)
- gdbm_file_info *dbf;
- {
- ! int num_bytes; /* For reading. */
- avail_elem temp;
-
- /* Set up variables. */
- --- 189,199 ----
- /* Gets the avail block at the top of the stack and loads it into the
- active avail block. It does a "free" for itself! */
-
- ! static VOID
- pop_avail_block (dbf)
- gdbm_file_info *dbf;
- {
- ! LONG num_bytes; /* For reading. */
- avail_elem temp;
-
- /* Set up variables. */
- *************** pop_avail_block (dbf)
- *** 177,183 ****
- --- 204,215 ----
- /* Read the block. */
- num_bytes = lseek (dbf->desc, temp.av_adr, L_SET);
- if (num_bytes != temp.av_adr) _gdbm_fatal (dbf, "lseek error");
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = read (dbf->desc,
- + (char *) &dbf->header->avail, temp.av_size);
- + #else /* not MSDOS */
- num_bytes = read (dbf->desc, &dbf->header->avail, temp.av_size);
- + #endif /* not MSDOS */
- if (num_bytes != temp.av_size) _gdbm_fatal (dbf, "read error");
-
- /* We changed the header. */
- *************** pop_avail_block (dbf)
- *** 191,203 ****
-
- /* Splits the header avail block and pushes half onto the avail stack. */
-
- ! static
- push_avail_block (dbf)
- gdbm_file_info *dbf;
- {
- ! int num_bytes;
- int av_size;
- ! int av_adr;
- int index;
- avail_block *temp;
- avail_elem new_loc;
- --- 223,235 ----
-
- /* Splits the header avail block and pushes half onto the avail stack. */
-
- ! static VOID
- push_avail_block (dbf)
- gdbm_file_info *dbf;
- {
- ! LONG num_bytes;
- int av_size;
- ! LONG av_adr;
- int index;
- avail_block *temp;
- avail_elem new_loc;
- *************** push_avail_block (dbf)
- *** 217,222 ****
- --- 249,261 ----
-
- /* Split the header block. */
- temp = (avail_block *) alloca (av_size);
- + #ifdef MSDOS
- + if (temp == (avail_block *) 0)
- + {
- + fprintf (stderr, "alloca failed.\n");
- + exit (-2);
- + }
- + #endif /* MSDOS */
- /* Set the size to be correct AFTER the pop_avail_block. */
- temp->size = dbf->header->avail.size;
- temp->count = 0;
- *************** push_avail_block (dbf)
- *** 241,247 ****
- --- 280,291 ----
- /* Update the disk. */
- num_bytes = lseek (dbf->desc, av_adr, L_SET);
- if (num_bytes != av_adr) _gdbm_fatal (dbf, "lseek error");
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = write (dbf->desc, (char *) temp, av_size);
- + #else /* not MSDOS */
- num_bytes = write (dbf->desc, temp, av_size);
- + #endif /* not MSDOS */
- +
- if (num_bytes != av_size) _gdbm_fatal (dbf, "write error");
-
- }
- *************** get_block (size, dbf)
- *** 368,374 ****
-
- /* When the header already needs writing, we can make sure the current
- bucket has its avail block as close to 1/2 full as possible. */
- ! static
- adjust_bucket_avail (dbf)
- gdbm_file_info *dbf;
- {
- --- 412,418 ----
-
- /* When the header already needs writing, we can make sure the current
- bucket has its avail block as close to 1/2 full as possible. */
- ! static VOID
- adjust_bucket_avail (dbf)
- gdbm_file_info *dbf;
- {
- diff -cBdNp e:/gnu/gdbm/gnu/fetch.c ./fetch.c
- *** e:/gnu/gdbm/gnu/fetch.c Thu Aug 16 10:49:24 1990
- --- ./fetch.c Thu Aug 16 10:50:38 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/fetch.c'v 1.4.0.1 90/08/16 09:22:21 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/findkey.c ./findkey.c
- *** e:/gnu/gdbm/gnu/findkey.c Thu Aug 16 10:49:26 1990
- --- ./findkey.c Thu Aug 16 10:50:40 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/findkey.c'v 1.4.0.1 90/08/16 09:22:23 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** _gdbm_read_entry (dbf, elem_loc)
- *** 44,50 ****
- gdbm_file_info *dbf;
- int elem_loc;
- {
- ! int num_bytes; /* For seeking and reading. */
- int key_size;
- int data_size;
- data_cache_elem *data_ca;
- --- 62,68 ----
- gdbm_file_info *dbf;
- int elem_loc;
- {
- ! LONG num_bytes; /* For seeking and reading. */
- int key_size;
- int data_size;
- data_cache_elem *data_ca;
- *************** _gdbm_read_entry (dbf, elem_loc)
- *** 74,81 ****
- if (num_bytes != dbf->bucket->h_table[elem_loc].data_pointer)
- _gdbm_fatal (dbf, "lseek error");
- num_bytes = read (dbf->desc, data_ca->dptr, key_size+data_size);
- if (num_bytes != key_size+data_size) _gdbm_fatal (dbf, "read error");
- !
- return data_ca->dptr;
- }
-
- --- 92,100 ----
- if (num_bytes != dbf->bucket->h_table[elem_loc].data_pointer)
- _gdbm_fatal (dbf, "lseek error");
- num_bytes = read (dbf->desc, data_ca->dptr, key_size+data_size);
- +
- if (num_bytes != key_size+data_size) _gdbm_fatal (dbf, "read error");
- !
- return data_ca->dptr;
- }
-
- *************** _gdbm_findkey (dbf, key, dptr, new_hash_
- *** 91,99 ****
- gdbm_file_info *dbf;
- datum key;
- char **dptr;
- ! int *new_hash_val; /* The new hash value. */
- {
- ! int bucket_hash_val; /* The hash value from the bucket. */
- char *file_key; /* The complete key as stored in the file. */
- int elem_loc; /* The location in the bucket. */
- int home_loc; /* The home location in the bucket. */
- --- 110,118 ----
- gdbm_file_info *dbf;
- datum key;
- char **dptr;
- ! LONG *new_hash_val; /* The new hash value. */
- {
- ! LONG bucket_hash_val; /* The hash value from the bucket. */
- char *file_key; /* The complete key as stored in the file. */
- int elem_loc; /* The location in the bucket. */
- int home_loc; /* The home location in the bucket. */
- *************** _gdbm_findkey (dbf, key, dptr, new_hash_
- *** 101,107 ****
- --- 120,130 ----
-
- /* Compute hash value and load proper bucket. */
- *new_hash_val = _gdbm_hash (key);
- + #ifdef MSDOS /* careful!!!! */
- + _gdbm_get_bucket (dbf, (int) (*new_hash_val>> (31-dbf->header->dir_bits)));
- + #else /* not MSDOS */
- _gdbm_get_bucket (dbf, *new_hash_val>> (31-dbf->header->dir_bits));
- + #endif /* not MSDOS */
-
- /* Is the element the last one found for this bucket? */
- if (*new_hash_val == dbf->cache_entry->ca_data.hash_val
- *************** _gdbm_findkey (dbf, key, dptr, new_hash_
- *** 115,121 ****
- --- 138,148 ----
- }
-
- /* It is not the cached value, search for element in the bucket. */
- + #ifdef MSDOS /* careful!!! */
- + elem_loc = (int) (*new_hash_val % dbf->header->bucket_elems);
- + #else /* not MSDOS */
- elem_loc = *new_hash_val % dbf->header->bucket_elems;
- + #endif /* not MSDOS */
- home_loc = elem_loc;
- bucket_hash_val = dbf->bucket->h_table[elem_loc].hash_value;
- while (bucket_hash_val != -1)
- diff -cBdNp e:/gnu/gdbm/gnu/gdbm.pro ./gdbm.pro
- *** e:/gnu/gdbm/gnu/gdbm.pro Thu Aug 16 10:49:28 1990
- --- ./gdbm.pro Thu Aug 16 10:50:40 1990
- ***************
- *** 1,72 ****
- - /* gdbm.h - The include file for dbm users. */
- -
- - /* This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
- - Copyright (C) 1990 Free Software Foundation, Inc.
- -
- - GDBM 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 1, or (at your option)
- - any later version.
- -
- - GDBM 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 GDBM; see the file COPYING. If not, write to
- - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- -
- - You may contact the author by:
- - e-mail: phil@wwu.edu
- - us-mail: Philip A. Nelson
- - Computer Science Department
- - Western Washington University
- - Bellingham, WA 98226
- - phone: (206) 676-3035
- -
- - *************************************************************************/
- -
- - /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
- - can create the database. */
- - #define GDBM_READER 0 /* A reader. */
- - #define GDBM_WRITER 1 /* A writer. */
- - #define GDBM_WRCREAT 2 /* A writer. Create the db if needed. */
- - #define GDBM_NEWDB 3 /* A writer. Always create a new db. */
- -
- - /* Parameters to gdbm_store for simple insertion or replacement in the
- - case that the key is already in the database. */
- - #define GDBM_INSERT 0 /* Never replace old data with new. */
- - #define GDBM_REPLACE 1 /* Always replace old data with new. */
- -
- -
- - /* 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;
- -
- -
- - /* These are the routines! */
- -
- - extern GDBM_FILE gdbm_open ();
- -
- - extern void gdbm_close ();
- -
- - extern datum gdbm_fetch ();
- -
- - extern int gdbm_store ();
- -
- - extern int gdbm_delete ();
- -
- - extern datum gdbm_firstkey ();
- -
- - extern datum gdbm_nextkey ();
- -
- - extern int gdbm_reorganize ();
- -
- -
- --- 0 ----
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmclos.c ./gdbmclos.c
- *** e:/gnu/gdbm/gnu/gdbmclos.c Thu Aug 16 10:49:28 1990
- --- ./gdbmclos.c Thu Aug 16 10:50:44 1990
- ***************
- *** 27,37 ****
-
- *************************************************************************/
-
- !
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/file.h>
- #include "gdbmdefs.h"
- #include "systems.h"
-
- --- 27,54 ----
-
- *************************************************************************/
-
- ! /*
- ! * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- ! *
- ! * To this port, the same copying conditions apply as to the
- ! * original release.
- ! *
- ! * IMPORTANT:
- ! * This file is not identical to the original GNU release!
- ! * You should have received this code as patch to the official
- ! * GNU release.
- ! *
- ! * MORE IMPORTANT:
- ! * This port comes with ABSOLUTELY NO WARRANTY.
- ! *
- ! * $Header: e:/gnu/gdbm/RCS/gdbmclos.c'v 1.4.0.1 90/08/16 09:22:24 tho Exp $
- ! */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include "gdbmdefs.h"
- #include "systems.h"
-
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmdefs.h ./gdbmdefs.h
- *** e:/gnu/gdbm/gnu/gdbmdefs.h Thu Aug 16 10:49:32 1990
- --- ./gdbmdefs.h Thu Aug 16 10:50:46 1990
- ***************
- *** 27,33 ****
- --- 27,63 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/gdbmdefs.h'v 1.4.0.1 90/08/16 09:22:58 tho Exp $
- + */
- +
- + #ifdef __STDC__
- + #include <stdio.h>
- + #include <stdlib.h>
- + #include <string.h>
- + #define VOID void
- + #else /* not __STDC__ */
- + #define VOID
- + #endif /*not __STDC__ */
-
- + #ifdef MSDOS
- + #define LONG long
- + #else /* not MSDOS */
- + #define LONG int
- + #endif /* not MSDOS */
-
- /* Start with the constant definitions. */
- #define TRUE 1
- *************** typedef struct {
- *** 64,70 ****
- /* The following structure is the element of the avaliable table. */
- typedef struct {
- int av_size; /* The size of the available block. */
- ! int av_adr; /* The file address of the available block. */
- } avail_elem;
-
- /* This is the actual table. The in-memory images of the avail blocks are
- --- 94,100 ----
- /* The following structure is the element of the avaliable table. */
- typedef struct {
- int av_size; /* The size of the available block. */
- ! LONG av_adr; /* The file address of the available block. */
- } avail_elem;
-
- /* This is the actual table. The in-memory images of the avail blocks are
- *************** typedef struct {
- *** 72,78 ****
- typedef struct {
- int size; /* The number of avail elements in the table.*/
- int count; /* The number of entries in the table. */
- ! int next_block; /* The file address of the next avail block. */
- avail_elem av_table[1]; /* The table. Make it look like an array. */
- } avail_block;
-
- --- 102,108 ----
- typedef struct {
- int size; /* The number of avail elements in the table.*/
- int count; /* The number of entries in the table. */
- ! LONG next_block; /* The file address of the next avail block. */
- avail_elem av_table[1]; /* The table. Make it look like an array. */
- } avail_block;
-
- *************** typedef struct {
- *** 85,98 ****
- directory and the free space in the file. */
-
- typedef struct {
- ! int header_magic; /* 0x13579ace to make sure the header is good. */
- int block_size; /* The optimal i/o blocksize from stat. */
- ! int dir; /* File address of hash directory table. */
- int dir_size; /* Size in bytes of the table. */
- int dir_bits; /* The number of address bits used in the table.*/
- int bucket_size; /* Size in bytes of a hash bucket struct. */
- int bucket_elems; /* Number of elements in a hash bucket. */
- ! int next_block; /* The next unallocated block address. */
- avail_block avail; /* This must be last because of the psuedo
- array in avail. This avail grows to fill
- the entire block. */
- --- 115,128 ----
- directory and the free space in the file. */
-
- typedef struct {
- ! LONG header_magic; /* 0x13579ace to make sure the header is good. */
- int block_size; /* The optimal i/o blocksize from stat. */
- ! LONG dir; /* File address of hash directory table. */
- int dir_size; /* Size in bytes of the table. */
- int dir_bits; /* The number of address bits used in the table.*/
- int bucket_size; /* Size in bytes of a hash bucket struct. */
- int bucket_elems; /* Number of elements in a hash bucket. */
- ! LONG next_block; /* The next unallocated block address. */
- avail_block avail; /* This must be last because of the psuedo
- array in avail. This avail grows to fill
- the entire block. */
- *************** typedef struct {
- *** 108,116 ****
- #define SMALL 4
-
- typedef struct {
- ! int hash_value; /* The complete 31 bit value. */
- char key_start[SMALL]; /* Up to the first SMALL bytes of the key. */
- ! int data_pointer; /* The file address of the key record. The
- data record directly follows the key. */
- int key_size; /* Size of key data in the file. */
- int data_size; /* Size of associated data in the file. */
- --- 138,146 ----
- #define SMALL 4
-
- typedef struct {
- ! LONG hash_value; /* The complete 31 bit value. */
- char key_start[SMALL]; /* Up to the first SMALL bytes of the key. */
- ! LONG data_pointer; /* The file address of the key record. The
- data record directly follows the key. */
- int key_size; /* Size of key data in the file. */
- int data_size; /* Size of associated data in the file. */
- *************** typedef struct {
- *** 151,157 ****
- cache. */
-
- typedef struct {
- ! int hash_val;
- int data_size;
- int key_size;
- char *dptr;
- --- 181,187 ----
- cache. */
-
- typedef struct {
- ! LONG hash_val;
- int data_size;
- int key_size;
- char *dptr;
- *************** typedef struct {
- *** 162,168 ****
-
- typedef struct {
- hash_bucket * ca_bucket;
- ! int ca_adr;
- char ca_changed; /* Data in the bucket changed. */
- data_cache_elem ca_data;
- } cache_elem;
- --- 192,198 ----
-
- typedef struct {
- hash_bucket * ca_bucket;
- ! LONG ca_adr;
- char ca_changed; /* Data in the bucket changed. */
- data_cache_elem ca_data;
- } cache_elem;
- *************** typedef struct {
- *** 194,200 ****
-
- /* The hash table directory from extendible hashing. See Fagin et al,
- ACM Trans on Database Systems, Vol 4, No 3. Sept 1979, 315-344 */
- ! int *dir;
-
- /* The bucket cache. */
- cache_elem bucket_cache [CACHE_SIZE];
- --- 224,230 ----
-
- /* The hash table directory from extendible hashing. See Fagin et al,
- ACM Trans on Database Systems, Vol 4, No 3. Sept 1979, 315-344 */
- ! LONG *dir;
-
- /* The bucket cache. */
- cache_elem bucket_cache [CACHE_SIZE];
- *************** typedef struct {
- *** 218,222 ****
- --- 248,294 ----
- char second_changed;
-
- } gdbm_file_info;
- +
- +
- + #ifdef __STDC__
- + extern void gdbm_close (gdbm_file_info *dbf);
- + extern int gdbm_delete (gdbm_file_info *dbf, datum key);
- + extern datum gdbm_fetch (gdbm_file_info *dbf, datum key);
- + extern gdbm_file_info *gdbm_open (char *file, int block_size, int read_write, int mode, void (*fatal_func)());
- + extern int gdbm_reorganize (gdbm_file_info *dbf);
- + extern datum gdbm_firstkey (gdbm_file_info *dbf);
- + extern datum gdbm_nextkey (gdbm_file_info *dbf, datum key);
- + extern int gdbm_store (gdbm_file_info *dbf, datum key, datum content, int flags);
- +
- + extern VOID _gdbm_new_bucket (gdbm_file_info *dbf, hash_bucket *bucket, int bits);
- + extern VOID _gdbm_get_bucket (gdbm_file_info *dbf, int dir_index);
- + extern VOID _gdbm_split_bucket (gdbm_file_info *dbf, LONG next_insert);
- + extern VOID _gdbm_write_bucket (gdbm_file_info *dbf, cache_elem *ca_entry);
- + extern LONG _gdbm_alloc (gdbm_file_info *dbf, int num_bytes);
- + extern int _gdbm_free (gdbm_file_info *dbf, LONG file_adr, int num_bytes);
- + extern int _gdbm_put_av_elem (avail_elem new_el, avail_elem *av_table, int *av_count);
- + extern char *_gdbm_read_entry (gdbm_file_info *dbf, int elem_loc);
- + extern int _gdbm_findkey (gdbm_file_info *dbf, datum key, char **dptr, LONG *new_hash_val);
- + extern LONG _gdbm_hash (datum key);
- + extern VOID _gdbm_end_update (gdbm_file_info *dbf);
- + extern VOID _gdbm_fatal (gdbm_file_info *dbf, char *val);
- +
- + extern int dbminit (char *file);
- + extern datum fetch(datum key);
- + extern int store (datum key, datum content);
- + extern int delete (datum key);
- + extern datum firstkey (void);
- + extern datum nextkey (datum key);
- +
- + extern gdbm_file_info *dbm_open (char *file, int flags, int mode);
- + extern void dbm_close (gdbm_file_info *dbf);
- + extern datum dbm_fetch (gdbm_file_info *dbf, datum key);
- + extern int dbm_store (gdbm_file_info *dbf, datum key, datum content, int flags);
- + extern int dbm_delete (gdbm_file_info *dbf, datum key);
- + extern datum dbm_firstkey (gdbm_file_info *dbf);
- + extern datum dbm_nextkey (gdbm_file_info *dbf);
- + extern int dbm_dirfno (gdbm_file_info *dbf);
- + extern int dbm_pagfno (gdbm_file_info *dbf);
- + #endif /* __STDC__ */
-
-
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmdele.c ./gdbmdele.c
- *** e:/gnu/gdbm/gnu/gdbmdele.c Thu Aug 16 10:49:34 1990
- --- ./gdbmdele.c Thu Aug 16 10:50:48 1990
- ***************
- *** 27,37 ****
-
- *************************************************************************/
-
- !
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/file.h>
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- --- 27,54 ----
-
- *************************************************************************/
-
- ! /*
- ! * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- ! *
- ! * To this port, the same copying conditions apply as to the
- ! * original release.
- ! *
- ! * IMPORTANT:
- ! * This file is not identical to the original GNU release!
- ! * You should have received this code as patch to the official
- ! * GNU release.
- ! *
- ! * MORE IMPORTANT:
- ! * This port comes with ABSOLUTELY NO WARRANTY.
- ! *
- ! * $Header: e:/gnu/gdbm/RCS/gdbmdele.c'v 1.4.0.1 90/08/16 09:22:26 tho Exp $
- ! */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** gdbm_delete (dbf, key)
- *** 52,59 ****
- int home; /* Home position of an item. */
- bucket_element elem; /* The element to be deleted. */
- char *find_data; /* Return pointer from findkey. */
- ! int hash_val; /* Returned by findkey. */
- ! int free_adr; /* Temporary stroage for address and size. */
- int free_size;
-
- /* First check to make sure this guy is a writer. */
- --- 69,76 ----
- int home; /* Home position of an item. */
- bucket_element elem; /* The element to be deleted. */
- char *find_data; /* Return pointer from findkey. */
- ! LONG hash_val; /* Returned by findkey. */
- ! LONG free_adr; /* Temporary stroage for address and size. */
- int free_size;
-
- /* First check to make sure this guy is a writer. */
- *************** gdbm_delete (dbf, key)
- *** 84,91 ****
- --- 101,113 ----
- while (elem_loc != last_loc
- && dbf->bucket->h_table[elem_loc].hash_value != -1)
- {
- + #ifdef MSDOS
- + home = (int) (dbf->bucket->h_table[elem_loc].hash_value
- + % dbf->header->bucket_elems);
- + #else /* not MSDOS */
- home = dbf->bucket->h_table[elem_loc].hash_value
- % dbf->header->bucket_elems;
- + #endif /* not MSDOS */
- if ( (last_loc < elem_loc && (home <= last_loc || home > elem_loc))
- || (last_loc > elem_loc && home <= last_loc && home > elem_loc))
-
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmfetc.c ./gdbmfetc.c
- *** e:/gnu/gdbm/gnu/gdbmfetc.c Thu Aug 16 10:49:36 1990
- --- ./gdbmfetc.c Thu Aug 16 10:50:54 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/gdbmfetc.c'v 1.4.0.1 90/08/16 09:22:27 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** gdbm_fetch (dbf, key)
- *** 49,55 ****
- datum return_val; /* The return value. */
- int elem_loc; /* The location in the bucket. */
- char *find_data; /* Returned from find_key. */
- ! int hash_val; /* Returned from find_key. */
-
- /* Set the default return value. */
- return_val.dptr = NULL;
- --- 67,73 ----
- datum return_val; /* The return value. */
- int elem_loc; /* The location in the bucket. */
- char *find_data; /* Returned from find_key. */
- ! LONG hash_val; /* Returned from find_key. */
-
- /* Set the default return value. */
- return_val.dptr = NULL;
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmopen.c ./gdbmopen.c
- *** e:/gnu/gdbm/gnu/gdbmopen.c Thu Aug 16 10:49:40 1990
- --- ./gdbmopen.c Thu Aug 16 10:50:56 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/gdbmopen.c'v 1.4.0.1 90/08/16 09:22:29 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** gdbm_open (file, block_size, read_write,
- *** 71,77 ****
- gdbm_file_info *dbf; /* The record to return. */
- struct stat file_stat; /* Space for the stat information. */
- int len; /* Length of the file name. */
- ! int num_bytes; /* Used in reading and writing. */
- int lock_val; /* Returned by the flock call. */
- int file_block_size; /* Block size to use for a new file. */
- int index; /* Used as a loop index. */
- --- 89,95 ----
- gdbm_file_info *dbf; /* The record to return. */
- struct stat file_stat; /* Space for the stat information. */
- int len; /* Length of the file name. */
- ! LONG num_bytes; /* Used in reading and writing. */
- int lock_val; /* Returned by the flock call. */
- int file_block_size; /* Block size to use for a new file. */
- int index; /* Used as a loop index. */
- *************** gdbm_open (file, block_size, read_write,
- *** 111,130 ****
- /* Open the file. */
- if (read_write == GDBM_READER)
- {
- ! dbf->desc = open (dbf->name, O_RDONLY, 0);
- }
- else if (read_write == GDBM_WRITER)
- {
- ! dbf->desc = open (dbf->name, O_RDWR, 0);
- }
- else if (read_write == GDBM_NEWDB)
- {
- ! dbf->desc = open (dbf->name, O_RDWR|O_CREAT|O_TRUNC, mode);
- read_write = GDBM_WRITER;
- }
- else
- {
- ! dbf->desc = open (dbf->name, O_RDWR|O_CREAT, mode);
- read_write = GDBM_WRITER;
- }
- if (dbf->desc < 0)
- --- 129,148 ----
- /* Open the file. */
- if (read_write == GDBM_READER)
- {
- ! dbf->desc = open (dbf->name, O_RDONLY|O_BINARY, 0);
- }
- else if (read_write == GDBM_WRITER)
- {
- ! dbf->desc = open (dbf->name, O_RDWR|O_BINARY, 0);
- }
- else if (read_write == GDBM_NEWDB)
- {
- ! dbf->desc = open (dbf->name, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, mode);
- read_write = GDBM_WRITER;
- }
- else
- {
- ! dbf->desc = open (dbf->name, O_RDWR|O_CREAT|O_BINARY, mode);
- read_write = GDBM_WRITER;
- }
- if (dbf->desc < 0)
- *************** gdbm_open (file, block_size, read_write,
- *** 198,204 ****
- dbf->header->block_size = file_block_size;
-
- /* Create the initial hash table directory. */
- ! dbf->header->dir_size = 8 * sizeof (int);
- dbf->header->dir_bits = 3;
- while (dbf->header->dir_size < dbf->header->block_size)
- {
- --- 216,222 ----
- dbf->header->block_size = file_block_size;
-
- /* Create the initial hash table directory. */
- ! dbf->header->dir_size = 8 * sizeof (LONG);
- dbf->header->dir_bits = 3;
- while (dbf->header->dir_size < dbf->header->block_size)
- {
- *************** gdbm_open (file, block_size, read_write,
- *** 215,221 ****
- }
-
- /* Allocate the space for the directory. */
- ! dbf->dir = (int *) malloc (dbf->header->dir_size);
- if (dbf->dir == NULL)
- {
- gdbm_close (dbf);
- --- 233,239 ----
- }
-
- /* Allocate the space for the directory. */
- ! dbf->dir = (LONG *) malloc (dbf->header->dir_size);
- if (dbf->dir == NULL)
- {
- gdbm_close (dbf);
- *************** gdbm_open (file, block_size, read_write,
- *** 242,248 ****
- dbf->bucket->bucket_avail[0].av_size = dbf->header->block_size;
-
- /* Set table entries to point to hash buckets. */
- ! for (index = 0; index < dbf->header->dir_size / sizeof (int); index++)
- dbf->dir[index] = 2*dbf->header->block_size;
-
- /* Initialize the active avail block. */
- --- 260,266 ----
- dbf->bucket->bucket_avail[0].av_size = dbf->header->block_size;
-
- /* Set table entries to point to hash buckets. */
- ! for (index = 0; index < dbf->header->dir_size / sizeof (LONG); index++)
- dbf->dir[index] = 2*dbf->header->block_size;
-
- /* Initialize the active avail block. */
- *************** gdbm_open (file, block_size, read_write,
- *** 255,261 ****
- --- 273,284 ----
-
- /* Write initial configuration to the file. */
- /* Block 0 is the file header and active avail block. */
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = write (dbf->desc,
- + (char *) dbf->header, dbf->header->block_size);
- + #else /* not MSDOS */
- num_bytes = write (dbf->desc, dbf->header, dbf->header->block_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->block_size)
- {
- gdbm_close (dbf);
- *************** gdbm_open (file, block_size, read_write,
- *** 264,270 ****
- --- 287,297 ----
- }
-
- /* Block 1 is the initial bucket directory. */
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = write (dbf->desc, (char *) dbf->dir, dbf->header->dir_size);
- + #else /* not MSDOS */
- num_bytes = write (dbf->desc, dbf->dir, dbf->header->dir_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->dir_size)
- {
- gdbm_close (dbf);
- *************** gdbm_open (file, block_size, read_write,
- *** 273,279 ****
- --- 300,311 ----
- }
-
- /* Block 2 is the only bucket. */
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = write (dbf->desc,
- + (char *) dbf->bucket, dbf->header->bucket_size);
- + #else /* not MSDOS */
- num_bytes = write (dbf->desc, dbf->bucket, dbf->header->bucket_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->bucket_size)
- {
- gdbm_close (dbf);
- *************** gdbm_open (file, block_size, read_write,
- *** 293,299 ****
- --- 325,336 ----
- gdbm_file_header partial_header; /* For the first part of it. */
-
- /* Read the partial file header. */
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = read (dbf->desc,
- + (char *)&partial_header, sizeof (gdbm_file_header));
- + #else /* not MSDOS */
- num_bytes = read (dbf->desc, &partial_header, sizeof (gdbm_file_header));
- + #endif /* not MSDOS */
- if (num_bytes != sizeof (gdbm_file_header))
- {
- gdbm_close (dbf);
- *************** gdbm_open (file, block_size, read_write,
- *** 302,308 ****
- --- 339,349 ----
- }
-
- /* Is the magic number good? */
- + #ifdef MSDOS
- + if (partial_header.header_magic != 0x13579aceL)
- + #else /* not MSDOS */
- if (partial_header.header_magic != 0x13579ace)
- + #endif /* not MSDOS */
- {
- gdbm_close (dbf);
- gdbm_errno = GDBM_BAD_MAGIC_NUMBER;
- *************** gdbm_open (file, block_size, read_write,
- *** 318,325 ****
- --- 359,371 ----
- return NULL;
- }
- bcopy (&partial_header, dbf->header, sizeof (gdbm_file_header));
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = read (dbf->desc, (char *) &dbf->header->avail.av_table[1],
- + dbf->header->block_size-sizeof (gdbm_file_header));
- + #else /* not MSDOS */
- num_bytes = read (dbf->desc, &dbf->header->avail.av_table[1],
- dbf->header->block_size-sizeof (gdbm_file_header));
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->block_size-sizeof (gdbm_file_header))
- {
- gdbm_close (dbf);
- *************** gdbm_open (file, block_size, read_write,
- *** 328,334 ****
- }
-
- /* Allocate space for the hash table directory. */
- ! dbf->dir = (int *) malloc (dbf->header->dir_size);
- if (dbf->dir == NULL)
- {
- gdbm_close (dbf);
- --- 374,380 ----
- }
-
- /* Allocate space for the hash table directory. */
- ! dbf->dir = (LONG *) malloc (dbf->header->dir_size);
- if (dbf->dir == NULL)
- {
- gdbm_close (dbf);
- *************** gdbm_open (file, block_size, read_write,
- *** 345,351 ****
- --- 391,401 ----
- return NULL;
- }
-
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = read (dbf->desc, (char *) dbf->dir, dbf->header->dir_size);
- + #else /* not MSDOS */
- num_bytes = read (dbf->desc, dbf->dir, dbf->header->dir_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->dir_size)
- {
- gdbm_close (dbf);
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmreor.c ./gdbmreor.c
- *** e:/gnu/gdbm/gnu/gdbmreor.c Thu Aug 16 10:49:40 1990
- --- ./gdbmreor.c Thu Aug 16 10:50:58 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- ************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/gdbmreor.c'v 1.4.0.1 90/08/16 09:22:31 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** gdbm_reorganize (dbf)
- *** 154,160 ****
- --- 172,185 ----
-
- /* Move the new file to old name. */
-
- + #ifdef MSDOS
- + if (close (new_dbf->desc)
- + || unlink (dbf->name)
- + || rename (new_name, dbf->name)
- + || (new_dbf->desc = open (dbf->name, O_RDWR|O_BINARY)) < 0)
- + #else /* not MSDOS */
- if (rename (new_name, dbf->name) != 0)
- + #endif /* not MSDOS */
- {
- gdbm_errno = GDBM_REORGANIZE_FAILED;
- gdbm_close (new_dbf);
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmseq.c ./gdbmseq.c
- *** e:/gnu/gdbm/gnu/gdbmseq.c Thu Aug 16 10:49:42 1990
- --- ./gdbmseq.c Thu Aug 16 10:51:02 1990
- ***************
- *** 27,40 ****
- --- 27,62 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/gdbmseq.c'v 1.4.0.1 90/08/16 09:22:33 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
-
- + #ifdef __STDC__
- + static void get_next_key (gdbm_file_info *dbf, int elem_loc, datum *return_val);
- + #endif /* not __STDC__ */
- +
- /* Special extern for this file. */
- extern char *_gdbm_read_entry ();
-
- *************** get_next_key (dbf, elem_loc, return_val)
- *** 65,76 ****
-
- /* Find the next bucket. It is possible several entries in
- the bucket directory point to the same bucket. */
- ! while (dbf->bucket_dir < dbf->header->dir_size / sizeof (int)
- && dbf->cache_entry->ca_adr == dbf->dir[dbf->bucket_dir])
- dbf->bucket_dir++;
-
- /* Check to see if there was a next bucket. */
- ! if (dbf->bucket_dir < dbf->header->dir_size / sizeof (int))
- _gdbm_get_bucket (dbf, dbf->bucket_dir);
- else
- /* No next key, just return. */
- --- 87,98 ----
-
- /* Find the next bucket. It is possible several entries in
- the bucket directory point to the same bucket. */
- ! while (dbf->bucket_dir < dbf->header->dir_size / sizeof (LONG)
- && dbf->cache_entry->ca_adr == dbf->dir[dbf->bucket_dir])
- dbf->bucket_dir++;
-
- /* Check to see if there was a next bucket. */
- ! if (dbf->bucket_dir < dbf->header->dir_size / sizeof (LONG))
- _gdbm_get_bucket (dbf, dbf->bucket_dir);
- else
- /* No next key, just return. */
- *************** gdbm_nextkey (dbf, key)
- *** 120,126 ****
- datum return_val; /* The return value. */
- int elem_loc; /* The location in the bucket. */
- char *find_data; /* Data pointer returned by _gdbm_findkey. */
- ! int hash_val; /* Returned by _gdbm_findkey. */
-
- /* Set the default return value for no next entry. */
- return_val.dptr = NULL;
- --- 142,148 ----
- datum return_val; /* The return value. */
- int elem_loc; /* The location in the bucket. */
- char *find_data; /* Data pointer returned by _gdbm_findkey. */
- ! LONG hash_val; /* Returned by _gdbm_findkey. */
-
- /* Set the default return value for no next entry. */
- return_val.dptr = NULL;
- diff -cBdNp e:/gnu/gdbm/gnu/gdbmstor.c ./gdbmstor.c
- *** e:/gnu/gdbm/gnu/gdbmstor.c Thu Aug 16 10:49:44 1990
- --- ./gdbmstor.c Thu Aug 16 10:51:04 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/gdbmstor.c'v 1.4.0.1 90/08/16 09:22:35 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** gdbm_store (dbf, key, content, flags)
- *** 58,68 ****
- datum content;
- int flags;
- {
- ! int new_hash_val; /* The new hash value. */
- int elem_loc; /* The location in hash bucket. */
- ! int file_adr; /* The address of new space in the file. */
- ! int num_bytes; /* Used for error detection. */
- ! int free_adr; /* For keeping track of a freed section. */
- int free_size;
-
- char *write_data; /* To write both key and data in 1 call. */
- --- 76,86 ----
- datum content;
- int flags;
- {
- ! LONG new_hash_val; /* The new hash value. */
- int elem_loc; /* The location in hash bucket. */
- ! LONG file_adr; /* The address of new space in the file. */
- ! LONG num_bytes; /* Used for error detection. */
- ! LONG free_adr; /* For keeping track of a freed section. */
- int free_size;
-
- char *write_data; /* To write both key and data in 1 call. */
- *************** gdbm_store (dbf, key, content, flags)
- *** 119,125 ****
- --- 137,147 ----
- }
-
- /* Find space to insert into bucket and set elem_loc to that place. */
- + #ifdef MSDOS
- + elem_loc = (int) (new_hash_val % dbf->header->bucket_elems);
- + #else /* not MSDOS */
- elem_loc = new_hash_val % dbf->header->bucket_elems;
- + #endif /* not MSDOS */
- while (dbf->bucket->h_table[elem_loc].hash_value != -1)
- { elem_loc = (elem_loc + 1) % dbf->header->bucket_elems; }
-
- *************** gdbm_store (dbf, key, content, flags)
- *** 138,143 ****
- --- 161,173 ----
-
- /* Prepare write_data. The key is written first. */
- write_data = (char *) alloca (key.dsize+content.dsize);
- + #ifdef MSDOS
- + if (write_data == (char *) 0)
- + {
- + fprintf (stderr, "alloca failed.\n");
- + exit (-2);
- + }
- + #endif /* MSDOS */
- dst = write_data;
- src = key.dptr;
- for (cnt=0; cnt < key.dsize; cnt++)
- diff -cBdNp e:/gnu/gdbm/gnu/global.c ./global.c
- *** e:/gnu/gdbm/gnu/global.c Thu Aug 16 10:49:46 1990
- --- ./global.c Thu Aug 16 10:51:08 1990
- ***************
- *** 28,33 ****
- --- 28,49 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/global.c'v 1.4.0.1 90/08/16 09:22:36 tho Exp $
- + */
-
- #include <stdio.h>
- #include "gdbmdefs.h"
- *************** datum _gdbm_memory = {NULL, 0}; /* Used
- *** 42,45 ****
- --- 58,65 ----
- char *_gdbm_fetch_val = NULL; /* Used by fetch. */
-
- /* The dbm error number is placed in the variable GDBM_ERRNO. */
- + #ifdef MSDOS /* won't go into library if not initialized! */
- + gdbm_error gdbm_errno = GDBM_NO_ERROR;
- + #else /* not MSDOS */
- gdbm_error gdbm_errno;
- + #endif /* not MSDOS */
- diff -cBdNp e:/gnu/gdbm/gnu/hash.c ./hash.c
- *** e:/gnu/gdbm/gnu/hash.c Thu Aug 16 10:49:48 1990
- --- ./hash.c Thu Aug 16 10:51:10 1990
- ***************
- *** 27,37 ****
-
- *************************************************************************/
-
- !
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/file.h>
- #include <sys/stat.h>
- #include "gdbmdefs.h"
-
- --- 27,54 ----
-
- *************************************************************************/
-
- ! /*
- ! * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- ! *
- ! * To this port, the same copying conditions apply as to the
- ! * original release.
- ! *
- ! * IMPORTANT:
- ! * This file is not identical to the original GNU release!
- ! * You should have received this code as patch to the official
- ! * GNU release.
- ! *
- ! * MORE IMPORTANT:
- ! * This port comes with ABSOLUTELY NO WARRANTY.
- ! *
- ! * $Header: e:/gnu/gdbm/RCS/hash.c'v 1.4.0.1 90/08/16 09:22:38 tho Exp $
- ! */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
-
- ***************
- *** 41,51 ****
- to find the home position of the element by taking the value modulo the
- bucket hash table size. */
-
- ! int
- _gdbm_hash (key)
- datum key;
- {
- ! int value; /* Used to compute the hash value. */
- int index; /* Used to cycle through random values. */
-
-
- --- 58,68 ----
- to find the home position of the element by taking the value modulo the
- bucket hash table size. */
-
- ! LONG
- _gdbm_hash (key)
- datum key;
- {
- ! LONG value; /* Used to compute the hash value. */
- int index; /* Used to cycle through random values. */
-
-
- diff -cBdNp e:/gnu/gdbm/gnu/makefile ./makefile
- *** e:/gnu/gdbm/gnu/makefile Thu Aug 16 10:51:54 1990
- --- ./makefile Thu Aug 16 10:51:40 1990
- ***************
- *** 0 ****
- --- 1,153 ----
- + # Makefile for gdbm.
- +
- + # MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + #
- + # To this port, the same copying conditions apply as to the
- + # original release.
- + #
- + # IMPORTANT:
- + # This file is not identical to the original GNU release!
- + # You should have received this code as patch to the official
- + # GNU release.
- + #
- + # MORE IMPORTANT:
- + # This port comes with ABSOLUTELY NO WARRANTY.
- + #
- + # $Header: e:/gnu/gdbm/RCS/makefile.'v 1.4.0.2 90/08/16 10:40:52 tho Exp $
- +
- + BINDIR = c:/bin
- + LIBDIR = d:/usr/lib
- + INCDIR = d:/usr/include
- +
- + INSTALL = cp -v
- + DISK = b:
- + ZIPFILE = gdbm.zip
- +
- + MODEL = L
- + CFLAGS = -Ox -W4 -A$(MODEL) -DSYSV -Za
- + LDFLAGS = /st:0x8000 /e
- + AR = lib
- + ARFLAGS = -+
- +
- + GDBMLIB = $(MODEL)gdbm.lib
- +
- +
- + DBM_CF = dbminit.c delete.c fetch.c store.c seq.c
- + NDBM_CF = dbmopen.c dbmdelet.c dbmfetch.c dbmstore.c dbmseq.c \
- + dbmclose.c dbmdirfn.c dbmpagfn.c
- + GDBM_CF = gdbmopen.c gdbmdele.c gdbmfetc.c gdbmstor.c gdbmclos.c \
- + gdbmreor.c gdbmseq.c \
- + bucket.c falloc.c findkey.c global.c hash.c update.c version.c
- +
- + HFILES = gdbmdefs.h extern.h gdbmerrn.h systems.h dbm.h ndbm.h
- +
- + MSCFILES = copying changelo makefile readme gdbm.pro conv2gdb.c
- +
- + TESTFILES = testdbm.c testndbm.c testgdbm.c
- +
- +
- + RCSFILES= $(patsubst %, RCS/%'v, $(DBM_CF) $(NBM_CF) $(GBM_CF)) \
- + RCS/makefile.'v
- + MISC = RCS/readme'v changelo RCS/changelo.'v makepat mkpatch
- +
- + DBM_OF = dbminit.obj delete.obj fetch.obj store.obj seq.obj
- + NDBM_OF = dbmopen.obj dbmdelet.obj dbmfetch.obj dbmstore.obj dbmseq.obj \
- + dbmclose.obj dbmdirfn.obj dbmpagfn.obj
- + GDBM_OF = gdbmopen.obj gdbmdele.obj gdbmfetc.obj gdbmstor.obj gdbmclos.obj \
- + gdbmreor.obj gdbmseq.obj \
- + bucket.obj falloc.obj findkey.obj global.obj hash.obj update.obj
- +
- +
- + .PHONY: allgdbm
- + allgdbm: $(GDBMLIB) testgdbm.exe testdbm.exe testndbm.exe
- +
- + .PHONY: install
- + install: $(GDBMLIB) gdbmdefs.h
- + cp $(GDBMLIB) $(LIBDIR)
- + cp gdbmdefs.h $(INCDIR)
- +
- + $(GDBMLIB): version.c $(GDBM_OF) $(NDBM_OF) $(DBM_OF)
- + $(CC) $(CFLAGS) -c version.c
- + $(AR) $@ $(ARFLAGS) version $(subst version.c,,$?);
- +
- + gdbm.h: gdbm.pro gdbmerrn.h
- + cp gdbm.pro gdbm.h
- + grep _ gdbmerrn.h >> gdbm.h
- +
- + gdbm.pro: RCS/gdbm.p'v
- + $(CO) $(COFLAGS) $@
- +
- + testgdbm.exe: testgdbm.obj $(GDBMLIB)
- + $(LINK) $(LDFLAGS) testgdbm, $@,, $(GDBMLIB);
- +
- + testdbm.exe: testdbm.obj $(GDBMLIB)
- + $(LINK) $(LDFLAGS) testdbm, $@,, $(GDBMLIB);
- +
- + testndbm.obj: testndbm.c
- + $(CC) -c $(CFLAGS) -DGNU testndbm.c
- +
- + testndbm.exe: testndbm.obj $(GDBMLIB)
- + $(LINK) $(LDFLAGS) testndbm, $@,, $(GDBMLIB);
- +
- +
- + .PHONY: zip disk
- + zip: $(ZIPFILE)
- + disk: $(DISK)/$(ZIPFILE)
- +
- + $(ZIPFILE): $(RCSFILES) $(MISC)
- + pkzip -frp $@
- +
- + $(DISK)/$(ZIPFILE): $(ZIPFILE)
- + cp $< $@
- + pkunzip -t $@ | grep -vw OK
- +
- + .PHONY: clean
- + clean:
- + rm -f gdbm.h *.obj *.map *.bak tags
- + rcsclean *.c *.h *.pro makefile
- +
- + tags: $(GDBM_CF) $(HFILES) $(TESTFILES) $(NDBM_CF) $(DBM_CF)
- + etags -t *.c *.h
- +
- + # dbm files
- + dbminit.obj: gdbmdefs.h extern.h gdbmerrn.h systems.h
- + delete.obj: gdbmdefs.h extern.h
- + fetch.obj: gdbmdefs.h extern.h
- + store.obj: gdbmdefs.h extern.h
- + seq.obj: gdbmdefs.h extern.h
- +
- + # ndbm files
- + dbmopen.obj: gdbmdefs.h extern.h gdbmerrn.h systems.h
- + dbmdelet.obj: gdbmdefs.h extern.h
- + dbmfetch.obj: gdbmdefs.h extern.h
- + dbmstore.obj: gdbmdefs.h extern.h
- + dbmseq.obj: gdbmdefs.h extern.h
- + dbmclose.obj: gdbmdefs.h systems.h
- + dbmpagfn.obj: gdbmdefs.h extern.h
- + dbmdirfn.obj: gdbmdefs.h extern.h
- +
- +
- + # gdbm files
- + gdbmclos.obj: gdbmdefs.h systems.h
- + gdbmdele.obj: gdbmdefs.h gdbmerrn.h systems.h
- + gdbmfetc.obj: gdbmdefs.h gdbmerrn.h systems.h
- + gdbmopen.obj: gdbmdefs.h gdbmerrn.h systems.h
- + gdbmreor.obj: gdbmdefs.h gdbmerrn.h systems.h extern.h
- + gdbmseq.obj: gdbmdefs.h systems.h
- + gdbmstor.obj: gdbmdefs.h gdbmerrn.h systems.h
- +
- + # gdbm support files
- + bucket.obj: gdbmdefs.h systems.h
- + falloc.obj: gdbmdefs.h systems.h
- + findkey.obj: gdbmdefs.h systems.h
- + global.obj: gdbmdefs.h gdbmerrn.h
- + hash.obj: gdbmdefs.h
- + update.obj: gdbmdefs.h systems.h
- + version.obj:
- + extern.h:
- +
- + # other programs
- + testgdbm.obj: gdbmdefs.h extern.h gdbmerrn.h systems.h
- + testdbm.obj: dbm.h
- + testndbm.obj: ndbm.h
- + conv2gdb.obj: gdbm.h
- diff -cBdNp e:/gnu/gdbm/gnu/ndbm.h ./ndbm.h
- *** e:/gnu/gdbm/gnu/ndbm.h Thu Aug 16 10:49:50 1990
- --- ./ndbm.h Thu Aug 16 10:51:12 1990
- ***************
- *** 27,32 ****
- --- 27,49 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/ndbm.h'v 1.4.0.1 90/08/16 09:23:06 tho Exp $
- + */
- +
- /* Parameters to dbm_store for simple insertion or replacement. */
- #define DBM_INSERT 0
- #define DBM_REPLACE 1
- ***************
- *** 33,70 ****
-
-
- /* 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 ();
- -
- extern void dbm_close ();
- -
- extern datum dbm_fetch ();
- -
- extern int dbm_store ();
- -
- - extern int dbm_delete ();
- -
- extern int dbm_delete ();
- -
- extern datum dbm_firstkey ();
- -
- extern datum dbm_nextkey ();
-
- #define dbm_error(dbf) 0
- -
- #define dbm_clearerr(dbf)
-
- - extern int dbm_dirfno ();
-
- - extern int dbm_pagfno ();
- --- 50,96 ----
-
-
- /* The data and key structure. This structure is defined for compatibility. */
- + #ifdef __STDC__
- + #include "gdbmdefs.h"
- + #else /* not __STDC__ */
- typedef struct {
- char *dptr;
- int dsize;
- } datum;
- ! #endif /* not __STDC__ */
-
- /* The file information header. This is good enough for most applications. */
- + #ifdef __STDC__
- + #define DBM gdbm_file_info
- + #else /* not __STDC__ */
- typedef struct {int dummy[10];} DBM;
- ! #endif /* not __STDC__ */
-
- /* These are the routines (with some macros defining them!) */
-
- + #ifdef __STDC__
- + extern DBM *dbm_open (char *file, int flags, int mode);
- + extern void dbm_close (DBM *dbf);
- + extern datum dbm_fetch (DBM *dbf, datum key);
- + extern int dbm_store (DBM *dbf, datum key, datum content, int flags);
- + extern int dbm_delete (DBM *dbf, datum key);
- + extern datum dbm_firstkey (DBM *dbf);
- + extern datum dbm_nextkey (DBM *dbf);
- + extern int dbm_dirfno (DBM *dbf);
- + extern int dbm_pagfno (DBM *dbf);
- + #else /* not __STDC__ */
- extern DBM *dbm_open ();
- extern void dbm_close ();
- extern datum dbm_fetch ();
- extern int dbm_store ();
- extern int dbm_delete ();
- extern datum dbm_firstkey ();
- extern datum dbm_nextkey ();
- + extern int dbm_dirfno ();
- + extern int dbm_pagfno ();
- + #endif /* not __STDC__ */
-
- #define dbm_error(dbf) 0
- #define dbm_clearerr(dbf)
-
-
- diff -cBdNp e:/gnu/gdbm/gnu/seq.c ./seq.c
- *** e:/gnu/gdbm/gnu/seq.c Thu Aug 16 10:49:50 1990
- --- ./seq.c Thu Aug 16 10:51:16 1990
- ***************
- *** 28,37 ****
- --- 28,55 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/seq.c'v 1.4.0.1 90/08/16 09:22:39 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/store.c ./store.c
- *** e:/gnu/gdbm/gnu/store.c Thu Aug 16 10:49:52 1990
- --- ./store.c Thu Aug 16 10:51:18 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/store.c'v 1.4.0.1 90/08/16 09:22:40 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "extern.h"
- diff -cBdNp e:/gnu/gdbm/gnu/systems.h ./systems.h
- *** e:/gnu/gdbm/gnu/systems.h Thu Aug 16 10:49:54 1990
- --- ./systems.h Thu Aug 16 10:51:24 1990
- ***************
- *** 27,32 ****
- --- 27,48 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/systems.h'v 1.4.0.1 90/08/16 09:23:07 tho Exp $
- + */
-
- /* To use this file, you must have included <sys/types.h>. */
-
- ***************
- *** 37,47 ****
- --- 53,73 ----
- #ifdef SYSV
-
- /* File seeking needs L_SET defined .*/
- + #ifdef MSDOS
- + #include <malloc.h>
- + #include <io.h>
- + #else /* not MSDOS */
- #include <unistd.h>
- + #endif /* not MSDOS */
- #define L_SET SEEK_SET
-
- /* Some files need fcntl.h for locking. */
- #include <fcntl.h>
- + #ifdef MSDOS
- + #define UNLOCK_FILE(dbf) /* later !!! */
- + #define READLOCK_FILE(dbf) lock_val = 0;
- + #define WRITELOCK_FILE(dbf) lock_val = 0;
- + #else /* not MSDOS */
- #define UNLOCK_FILE(dbf) \
- { \
- struct flock flock; \
- ***************
- *** 66,71 ****
- --- 92,98 ----
- flock.l_start = flock.l_len = 0L; \
- lock_val = fcntl (dbf->desc, F_SETLK, &flock); \
- }
- + #endif /* not MSDOS */
-
- /* Send bcmp to the right place. */
- #include <memory.h>
- ***************
- *** 73,85 ****
- --- 100,118 ----
- #define bcopy(d1, d2, n) memcpy(d2, d1, n)
-
- /* Sys V does not have fsync. */
- + #ifdef MSDOS
- + #define fsync(f)
- + #else /* not MSDOS */
- #define fsync(f) sync(); sync()
- + #endif /* not MSDOS */
-
- /* Stat does not have a st_blksize field. */
- #define STATBLKSIZE 512
-
- /* Does not have rename(). */
- + #ifndef MSDOS
- #define NEED_RENAME
- + #endif /* not MSDOS */
- #endif
-
- /* End of System V changes and defines. */
- ***************
- *** 86,92 ****
- /**************************************************/
-
-
- !
- /* Alloca is builtin in gcc. Use the builtin alloca if compiled with gcc. */
- #ifdef __GNUC__
- #define BUILTIN_ALLOCA
- --- 119,125 ----
- /**************************************************/
-
-
- ! #ifndef MSDOS
- /* Alloca is builtin in gcc. Use the builtin alloca if compiled with gcc. */
- #ifdef __GNUC__
- #define BUILTIN_ALLOCA
- *************** extern char *alloca();
- *** 108,113 ****
- --- 141,147 ----
-
- /* Malloc definition. */
- extern char *malloc();
- + #endif /* not MSDOS */
-
-
- /* The BSD defines are the default defines. If something is not
- diff -cBdNp e:/gnu/gdbm/gnu/testdbm.c ./testdbm.c
- *** e:/gnu/gdbm/gnu/testdbm.c Thu Aug 16 10:49:56 1990
- --- ./testdbm.c Thu Aug 16 10:51:26 1990
- ***************
- *** 27,41 ****
- --- 27,64 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/testdbm.c'v 1.4.0.1 90/08/16 09:22:42 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
-
- #define TRUE 1
- #define FALSE 0
-
- + #ifdef __STDC__
- + #include <stdlib.h>
- + #include <string.h>
- + #include "dbm.h"
- + #else /* not __STDC__ */
- typedef struct {
- char *dptr;
- int dsize;
- *************** typedef struct {
- *** 44,49 ****
- --- 67,73 ----
- extern datum fetch ();
- extern datum firstkey ();
- extern datum nextkey ();
- + #endif /* not __STDC__ */
-
- /* The test program allows one to call all the routines plus the hash function.
- The commands are single letter commands. The user is prompted for all other
- diff -cBdNp e:/gnu/gdbm/gnu/testgdbm.c ./testgdbm.c
- *** e:/gnu/gdbm/gnu/testgdbm.c Thu Aug 16 10:49:58 1990
- --- ./testgdbm.c Thu Aug 16 10:51:30 1990
- ***************
- *** 28,37 ****
- --- 28,55 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/testgdbm.c'v 1.4.0.2 90/08/16 09:55:48 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #include "gdbmdefs.h"
- #include "systems.h"
- *************** extern char * gdbm_version;
- *** 44,50 ****
- --- 62,148 ----
-
- gdbm_file_info *gdbm_file;
-
- + #ifdef __STDC__
- + static void print_bucket (hash_bucket *bucket, char *mesg);
- + static void _gdbm_print_avail_list (gdbm_file_info *dbf);
- + extern void main (int argc, char **argv);
- + void gdbm_perror (char *msg);
- + #endif /* __STDC__ */
- +
- +
- + /* access GDBM_ERRNO. [tho] */
- +
- + void
- + gdbm_perror (char *msg)
- + {
- + char *err_msg;
- +
- + switch (gdbm_errno)
- + {
- + case GDBM_NO_ERROR:
- + err_msg = "no error";
- + break;
- + case GDBM_MALLOC_ERROR:
- + err_msg = "can't malloc";
- + break;
- + case GDBM_BLOCK_SIZE_ERROR:
- + err_msg = "bad block size";
- + break;
- + case GDBM_FILE_OPEN_ERROR:
- + err_msg = "can't open file";
- + break;
- + case GDBM_FILE_WRITE_ERROR:
- + err_msg = "can't write file";
- + break;
- + case GDBM_FILE_SEEK_ERROR:
- + err_msg = "can't seek file";
- + break;
- + case GDBM_FILE_READ_ERROR:
- + err_msg = "can't read file";
- + break;
- + case GDBM_BAD_MAGIC_NUMBER:
- + err_msg = "bad magic number";
- + break;
- + case GDBM_EMPTY_DATABASE:
- + err_msg = "empty database";
- + break;
- + case GDBM_CANT_BE_READER:
- + err_msg = "can't be reader";
- + break;
- + case GDBM_CANT_BE_WRITER:
- + err_msg = "can't be writer";
- + break;
- + case GDBM_READER_CANT_DELETE:
- + err_msg = "can't delete";
- + break;
- + case GDBM_READER_CANT_STORE:
- + err_msg = "can't store";
- + break;
- + case GDBM_READER_CANT_REORGANIZE:
- + err_msg = "can't reorganize";
- + break;
- + case GDBM_UNKNOWN_UPDATE:
- + err_msg = "unkown update";
- + break;
- + case GDBM_ITEM_NOT_FOUND:
- + err_msg = "item not found";
- + break;
- + case GDBM_REORGANIZE_FAILED:
- + err_msg = "reorganization failed";
- + break;
- + case GDBM_CANNOT_REPLACE:
- + err_msg = "can't replace";
- + break;
- + default:
- + err_msg = "unknown error";
- + }
- +
- + fprintf (stderr, "%s (GDBM error: %s)\n", msg, err_msg);
- + }
- +
- +
- /* Debug procedure to print the contents of the current hash bucket. */
- + VOID
- print_bucket (bucket, mesg)
- hash_bucket *bucket;
- char *mesg;
- *************** print_bucket (bucket, mesg)
- *** 55,60 ****
- --- 153,166 ----
- mesg, bucket->bucket_bits, bucket->count);
- printf (" # hash value key size data size data adr home\n");
- for (index = 0; index < gdbm_file->header->bucket_elems; index++)
- + #ifdef MSDOS
- + printf (" %4d %12lx %11d %11d %11ld %5d\n", index,
- + bucket->h_table[index].hash_value,
- + bucket->h_table[index].key_size,
- + bucket->h_table[index].data_size,
- + bucket->h_table[index].data_pointer,
- + (int) (bucket->h_table[index].hash_value % gdbm_file->header->bucket_elems));
- + #else /* not MSDOS */
- printf (" %4d %12x %11d %11d %11d %5d\n", index,
- bucket->h_table[index].hash_value,
- bucket->h_table[index].key_size,
- *************** print_bucket (bucket, mesg)
- *** 61,79 ****
- bucket->h_table[index].data_size,
- bucket->h_table[index].data_pointer,
- bucket->h_table[index].hash_value % gdbm_file->header->bucket_elems);
-
- printf ("\nAvail count = %1d\n", bucket->av_count);
- printf ("Avail adr size\n");
- for (index = 0; index < bucket->av_count; index++)
- printf ("%9d%9d\n", bucket->bucket_avail[index].av_adr,
- bucket->bucket_avail[index].av_size);
- }
-
-
- _gdbm_print_avail_list (dbf)
- gdbm_file_info *dbf;
- {
- ! int temp;
- int size;
- avail_block *av_stk;
-
- --- 167,191 ----
- bucket->h_table[index].data_size,
- bucket->h_table[index].data_pointer,
- bucket->h_table[index].hash_value % gdbm_file->header->bucket_elems);
- + #endif /* not MSDOS */
-
- printf ("\nAvail count = %1d\n", bucket->av_count);
- printf ("Avail adr size\n");
- for (index = 0; index < bucket->av_count; index++)
- + #ifdef MSDOS
- + printf ("%9ld%9d\n", bucket->bucket_avail[index].av_adr,
- + #else /* not MSDOS */
- printf ("%9d%9d\n", bucket->bucket_avail[index].av_adr,
- + #endif /* not MSDOS */
- bucket->bucket_avail[index].av_size);
- }
-
-
- + VOID
- _gdbm_print_avail_list (dbf)
- gdbm_file_info *dbf;
- {
- ! LONG temp;
- int size;
- avail_block *av_stk;
-
- *************** _gdbm_print_avail_list (dbf)
- *** 82,88 ****
- --- 194,204 ----
- dbf->header->avail.size, dbf->header->avail.count);
- for (temp = 0; temp < dbf->header->avail.count; temp++)
- {
- + #ifdef MSDOS
- + printf (" %15d %10ld \n", dbf->header->avail.av_table[temp].av_size,
- + #else /* not MSDOS */
- printf (" %15d %10d \n", dbf->header->avail.av_table[temp].av_size,
- + #endif /* not MSDOS */
- dbf->header->avail.av_table[temp].av_adr);
- }
-
- *************** _gdbm_print_avail_list (dbf)
- *** 91,102 ****
- --- 207,229 ----
- size = ( ( (dbf->header->avail.size * sizeof (avail_elem)) >> 1)
- + sizeof (avail_block));
- av_stk = (avail_block *) alloca (size);
- + #ifdef MSDOS
- + if (av_stk == (avail_block *) 0)
- + {
- + fprintf (stderr, "alloca failed.\n");
- + exit (-2);
- + }
- + #endif /* MSDOS */
-
- /* Print the stack. */
- while (FALSE)
- {
- lseek (dbf->desc, temp, L_SET);
- + #ifdef MSDOS
- + read (dbf->desc, (char *) av_stk, size);
- + #else /* not MSDOS */
- read (dbf->desc, av_stk, size);
- + #endif /* not MSDOS */
-
- /* Print the block! */
- printf ("\nblock = %d\nsize = %d\ncount = %d\n", temp,
- *************** _gdbm_print_avail_list (dbf)
- *** 103,109 ****
- --- 230,240 ----
- av_stk->size, av_stk->count);
- for (temp = 0; temp < av_stk->count; temp++)
- {
- + #ifdef MSDOS
- + printf (" %15d %10ld \n", av_stk->av_table[temp].av_size,
- + #else /* not MSDOS */
- printf (" %15d %10d \n", av_stk->av_table[temp].av_size,
- + #endif /* not MSDOS */
- av_stk->av_table[temp].av_adr);
- }
- temp = av_stk->next_block;
- *************** _gdbm_print_bucket_cache (dbf)
- *** 120,126 ****
- --- 251,261 ----
- for (index=0; index < CACHE_SIZE; index++)
- {
- changed = dbf->bucket_cache[index].ca_changed;
- + #ifdef MSDOS
- + printf (" %5d: %7ld %7s %lx\n",
- + #else /* not MSDOS */
- printf (" %5d: %7d %7s %x\n",
- + #endif /* not MSDOS */
- index,
- dbf->bucket_cache[index].ca_adr,
- (changed ? "True" : "False"),
- *************** _gdbm_print_bucket_cache (dbf)
- *** 133,138 ****
- --- 268,274 ----
- The commands are single letter commands. The user is prompted for all other
- information. See the help command (?) for a list of all commands. */
-
- + VOID
- main (argc, argv)
- int argc;
- char *argv[];
- *************** main (argc, argv)
- *** 176,185 ****
- gdbm_file = gdbm_open (file_name, 512, GDBM_WRCREAT, 00664, NULL);
- if (gdbm_file == NULL)
- {
- ! if (gdbm_errno != GDBM_CANT_BE_WRITER)
- ! printf ("gdbm_open failed.\n");
- ! else
- ! printf ("Can't open as a writer. \n");
- exit (2);
- }
-
- --- 312,318 ----
- gdbm_file = gdbm_open (file_name, 512, GDBM_WRCREAT, 00664, NULL);
- if (gdbm_file == NULL)
- {
- ! gdbm_perror ("gdbm_open failed");
- exit (2);
- }
-
- *************** main (argc, argv)
- *** 189,200 ****
- --- 322,341 ----
- while (!done)
- {
- printf ("com -> ");
- + #ifdef MSDOS /* shut up the compiler */
- + cmd_ch = (char) getchar ();
- + #else /* not MSDOS */
- cmd_ch = getchar ();
- + #endif /* not MSDOS */
- if (cmd_ch != '\n')
- {
- char temp;
- do
- + #ifdef MSDOS /* shut up the compiler */
- + temp = (char) getchar ();
- + #else /* not MSDOS */
- temp = getchar ();
- + #endif /* not MSDOS */
- while (temp != '\n' && temp != EOF);
- }
- if (cmd_ch == EOF) cmd_ch = 'q';
- *************** main (argc, argv)
- *** 230,236 ****
- key_data.dptr = key_line;
- key_data.dsize = strlen (key_line)+1;
- if (gdbm_delete (gdbm_file, key_data) != 0)
- ! printf ("Item not found or deleted\n");
- printf ("\n");
- key_data.dptr = NULL;
- break;
- --- 371,377 ----
- key_data.dptr = key_line;
- key_data.dsize = strlen (key_line)+1;
- if (gdbm_delete (gdbm_file, key_data) != 0)
- ! gdbm_perror ("Item not found or deleted");
- printf ("\n");
- key_data.dptr = NULL;
- break;
- *************** main (argc, argv)
- *** 269,275 ****
- }
- else
- {
- ! printf ("No such item found.\n\n");
- key_data.dptr = NULL;
- }
- break;
- --- 410,416 ----
- }
- else
- {
- ! gdbm_perror ("No such item found");
- key_data.dptr = NULL;
- }
- break;
- *************** main (argc, argv)
- *** 288,294 ****
- gets (data_line);
- data_data.dsize = strlen (data_line)+1;
- if (gdbm_store (gdbm_file, key_data, data_data, GDBM_REPLACE) != 0)
- ! printf ("Item not inserted. \n");
- printf ("\n");
- key_data.dptr = NULL;
- break;
- --- 429,435 ----
- gets (data_line);
- data_data.dsize = strlen (data_line)+1;
- if (gdbm_store (gdbm_file, key_data, data_data, GDBM_REPLACE) != 0)
- ! gdbm_perror ("Item not inserted");
- printf ("\n");
- key_data.dptr = NULL;
- break;
- *************** main (argc, argv)
- *** 304,310 ****
- free (return_data.dptr);
- }
- else
- ! printf ("No such item found.\n\n");
- break;
-
- case '2':
- --- 445,451 ----
- free (return_data.dptr);
- }
- else
- ! gdbm_perror ("No such item found");
- break;
-
- case '2':
- *************** main (argc, argv)
- *** 319,325 ****
- free (return_data.dptr);
- }
- else
- ! printf ("No such item found.\n\n");
- break;
-
-
- --- 460,466 ----
- free (return_data.dptr);
- }
- else
- ! gdbm_perror ("No such item found");
- break;
-
-
- *************** main (argc, argv)
- *** 327,333 ****
- case 'r':
- {
- if (gdbm_reorganize (gdbm_file))
- ! printf ("Reorganization failed. \n\n");
- else
- printf ("Reorganization succeeded. \n\n");
- }
- --- 468,474 ----
- case 'r':
- {
- if (gdbm_reorganize (gdbm_file))
- ! gdbm_perror ("Reorganization failed");
- else
- printf ("Reorganization succeeded. \n\n");
- }
- *************** main (argc, argv)
- *** 349,355 ****
-
- if (temp >= gdbm_file->header->dir_size /4)
- {
- ! printf ("Not a bucket. \n\n");
- break;
- }
- _gdbm_get_bucket (gdbm_file, temp);
- --- 490,496 ----
-
- if (temp >= gdbm_file->header->dir_size /4)
- {
- ! gdbm_perror ("Not a bucket");
- break;
- }
- _gdbm_get_bucket (gdbm_file, temp);
- *************** main (argc, argv)
- *** 359,365 ****
- --- 500,510 ----
- case 'C':
- print_bucket (gdbm_file->bucket, "Current bucket");
- printf ("\n current directory entry = %d.\n", gdbm_file->bucket_dir);
- + #ifdef MSDOS
- + printf (" current bucket address = %ld.\n\n",
- + #else /* not MSDOS */
- printf (" current bucket address = %d.\n\n",
- + #endif /* not MSDOS */
- gdbm_file->cache_entry->ca_adr);
- break;
-
- *************** main (argc, argv)
- *** 372,378 ****
- --- 517,527 ----
-
- for (temp = 0; temp < gdbm_file->header->dir_size / 4; temp++)
- {
- + #ifdef MSDOS
- + printf (" %10d: %12ld\n", temp, gdbm_file->dir[temp]);
- + #else /* not MSDOS */
- printf (" %10d: %12d\n", temp, gdbm_file->dir[temp]);
- + #endif /* not MSDOS */
- if ( (temp+1) % 20 == 0 && isatty (0))
- {
- printf ("*** CR to continue: ");
- *************** main (argc, argv)
- *** 385,400 ****
-
- case 'F':
- {
- ! int temp;
-
- printf ("\nFile Header: \n\n");
- printf (" table = %d\n", gdbm_file->header->dir);
- printf (" table size = %d\n", gdbm_file->header->dir_size);
- printf (" table bits = %d\n", gdbm_file->header->dir_bits);
- printf (" block size = %d\n", gdbm_file->header->block_size);
- printf (" bucket elems = %d\n", gdbm_file->header->bucket_elems);
- printf (" bucket size = %d\n", gdbm_file->header->bucket_size);
- printf (" header magic = %x\n", gdbm_file->header->header_magic);
- printf (" next block = %d\n", gdbm_file->header->next_block);
- printf (" avail size = %d\n", gdbm_file->header->avail.size);
- printf (" avail count = %d\n", gdbm_file->header->avail.count);
- --- 534,559 ----
-
- case 'F':
- {
- ! #ifndef MSDOS /* shut up the compiler */
- ! int temp;
- ! #endif /* not MSDOS */
-
- printf ("\nFile Header: \n\n");
- + #ifdef MSDOS
- + printf (" table = %ld\n", gdbm_file->header->dir);
- + #else /* not MSDOS */
- printf (" table = %d\n", gdbm_file->header->dir);
- + #endif /* not MSDOS */
- printf (" table size = %d\n", gdbm_file->header->dir_size);
- printf (" table bits = %d\n", gdbm_file->header->dir_bits);
- printf (" block size = %d\n", gdbm_file->header->block_size);
- printf (" bucket elems = %d\n", gdbm_file->header->bucket_elems);
- printf (" bucket size = %d\n", gdbm_file->header->bucket_size);
- + #ifdef MSDOS
- + printf (" header magic = %lx\n", gdbm_file->header->header_magic);
- + #else /* not MSDOS */
- printf (" header magic = %x\n", gdbm_file->header->header_magic);
- + #endif /* not MSDOS */
- printf (" next block = %d\n", gdbm_file->header->next_block);
- printf (" avail size = %d\n", gdbm_file->header->avail.size);
- printf (" avail count = %d\n", gdbm_file->header->avail.count);
- *************** main (argc, argv)
- *** 409,415 ****
- --- 568,578 ----
- gets (key_line);
- key_data.dptr = key_line;
- key_data.dsize = strlen (key_line)+1;
- + #ifdef MSDOS
- + printf ("hash value = %lx. \n\n", _gdbm_hash (key_data));
- + #else /* not MSDOS */
- printf ("hash value = %x. \n\n", _gdbm_hash (key_data));
- + #endif /* not MSDOS */
- key_data.dptr = NULL;
- break;
-
- diff -cBdNp e:/gnu/gdbm/gnu/testndbm.c ./testndbm.c
- *** e:/gnu/gdbm/gnu/testndbm.c Thu Aug 16 10:50:02 1990
- --- ./testndbm.c Thu Aug 16 10:51:32 1990
- ***************
- *** 27,36 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/testndbm.c'v 1.4.0.1 90/08/16 09:22:51 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include <sys/stat.h>
- #ifdef SYSV
- #include <fcntl.h>
- diff -cBdNp e:/gnu/gdbm/gnu/update.c ./update.c
- *** e:/gnu/gdbm/gnu/update.c Thu Aug 16 10:50:02 1990
- --- ./update.c Thu Aug 16 10:51:34 1990
- ***************
- *** 27,51 ****
-
- *************************************************************************/
-
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/file.h>
- #include "gdbmdefs.h"
- #include "systems.h"
-
-
- /* This procedure writes the header back to the file described by DBF. */
-
- ! static
- write_header (dbf)
- gdbm_file_info *dbf;
- {
- ! int num_bytes;
-
- ! num_bytes = lseek (dbf->desc, 0, L_SET);
- if (num_bytes != 0) _gdbm_fatal (dbf, "lseek error");
- num_bytes = write (dbf->desc, dbf->header, dbf->header->block_size);
- if (num_bytes != dbf->header->block_size)
- _gdbm_fatal (dbf, "write error");
-
- --- 27,76 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/update.c'v 1.4.0.1 90/08/16 09:22:53 tho Exp $
- + */
-
- #include <stdio.h>
- #include <sys/types.h>
- + #ifndef MSDOS
- #include <sys/file.h>
- + #endif /* not MSDOS */
- #include "gdbmdefs.h"
- #include "systems.h"
-
- + #ifdef __STDC__
- + static void write_header (gdbm_file_info *dbf);
- + #endif /* __STDC__ */
-
- /* This procedure writes the header back to the file described by DBF. */
-
- ! static VOID
- write_header (dbf)
- gdbm_file_info *dbf;
- {
- ! LONG num_bytes;
-
- ! num_bytes = lseek (dbf->desc, (LONG) 0, L_SET);
- if (num_bytes != 0) _gdbm_fatal (dbf, "lseek error");
- + #ifdef MSDOS
- + num_bytes = write (dbf->desc, (char *) dbf->header, dbf->header->block_size);
- + #else /* not MSDOS */
- num_bytes = write (dbf->desc, dbf->header, dbf->header->block_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->block_size)
- _gdbm_fatal (dbf, "write error");
-
- *************** write_header (dbf)
- *** 56,65 ****
-
- /* After all changes have been made in memory, we now write them
- all to disk. */
- _gdbm_end_update (dbf)
- gdbm_file_info *dbf;
- {
- ! int num_bytes; /* Return value for lseek and write. */
-
- /* Write the current bucket. */
- if (dbf->bucket_changed)
- --- 81,91 ----
-
- /* After all changes have been made in memory, we now write them
- all to disk. */
- + VOID
- _gdbm_end_update (dbf)
- gdbm_file_info *dbf;
- {
- ! LONG num_bytes; /* Return value for lseek and write. */
-
- /* Write the current bucket. */
- if (dbf->bucket_changed)
- *************** _gdbm_end_update (dbf)
- *** 86,92 ****
- --- 112,122 ----
- {
- num_bytes = lseek (dbf->desc, dbf->header->dir, L_SET);
- if (num_bytes != dbf->header->dir) _gdbm_fatal (dbf, "lseek error");
- + #ifdef MSDOS /* shut up the compiler! */
- + num_bytes = write (dbf->desc, (char *) dbf->dir, dbf->header->dir_size);
- + #else /* not MSDOS */
- num_bytes = write (dbf->desc, dbf->dir, dbf->header->dir_size);
- + #endif /* not MSDOS */
- if (num_bytes != dbf->header->dir_size)
- _gdbm_fatal (dbf, "write error");
- dbf->directory_changed = FALSE;
- *************** _gdbm_end_update (dbf)
- *** 104,109 ****
- --- 134,140 ----
-
- /* If a fatal error is detected, come here and exit. VAL tells which fatal
- error occured. */
- + VOID
- _gdbm_fatal (dbf, val)
- gdbm_file_info *dbf;
- char *val;
- diff -cBdNp e:/gnu/gdbm/gnu/version.c ./version.c
- *** e:/gnu/gdbm/gnu/version.c Thu Aug 16 10:50:04 1990
- --- ./version.c Thu Aug 16 10:51:36 1990
- ***************
- *** 27,32 ****
- --- 27,54 ----
-
- *************************************************************************/
-
- + /*
- + * MS-DOS port (c) 1990 by Thorsten Ohl, td12@@ddagsi3.bitnet
- + *
- + * To this port, the same copying conditions apply as to the
- + * original release.
- + *
- + * IMPORTANT:
- + * This file is not identical to the original GNU release!
- + * You should have received this code as patch to the official
- + * GNU release.
- + *
- + * MORE IMPORTANT:
- + * This port comes with ABSOLUTELY NO WARRANTY.
- + *
- + * $Header: e:/gnu/gdbm/RCS/version.c'v 1.4.0.1 90/08/16 09:28:34 tho Exp $
- + */
- +
- /* Keep a string with the version number in it! */
- + #ifdef MSDOS
- + char * gdbm_version = "This is GDBM version 1.4, as of August 14, 1990. "\
- + "(Compiled for MS-DOS: " __DATE__ " " __TIME__ ")";
- + #else /* not MSDOS */
- char * gdbm_version = "This is GDBM version 1.4, as of August 14, 1990.";
- + #endif /* not MSDOS */
-
-