Mail Archives: djgpp/2017/07/29/21:08:28
This is a port of GNU dbm 1.13 to MSDOS/DJGPP.
GNU dbm (gdbm) is a set of database routines that use extendible hashing
and works similar to the standard UNIX dbm routines. The library provides
also an optional compatibility layer for UNIX-like dbm and ndbm calls.
These routines are provided to a programmer needing to create and manipulate
a hashed database. gdbm is NOT a complete database package for an end user.
DJGPP specific changes.
=======================
In this port the support for DJGPP 2.03 has been droped. This port version
is compiled using DJGPP 2.05 and will offer file locking support if the used
OS provides the locking capability. All other changes concern DOS specific
issues like the reading and writing in binary mode, the handling of mixed
slashes and backslashes in paths, the closing of destination and source files
before renaming them and the correct initialization of the hash table
directory for a new data base files. This initialization is very dependent
on the st_blksize value returned by fstat(). This value must always be an
integral multiple of 512 or the initialization will fail and no new data base
file will be created.
The dbm and ndbm specific functions have been moved into a separate library.
This means that there are two libraries:
- libgdbm.a containing all gdbm specific functions and
- libgdbm_compat.a containing all dbm specific functions
If you need to compile an application using the old unix dbm functions you
will have to put the compat lib before the gdbm lib like this:
gcc application.c -lgdbm_compat -lgdbm
Now you will have access to the dbm compatibility functions. Please note,
that these compatibility functions are mapped to the equivalent gdbm functions
so you must link both libraries in the order shown in the example above.
The port does neither support mmap() for I/O operations nor the close-on-exec
flag in gdbm_open (GDBM_CLOEXEC).
Apart from the standard config.bat options like nls, cache and no-dep, the
following option flags can be selected to configure and build the sources:
compat or no-compat, if not specified, "compat" is the default.
Build and install libgdbm_compat, a compatibility layer which provides
UNIX-like dbm and ndbm interfaces.
export or no-export, if not specified, "export" is the default.
Build and install gdbmexport with the specified gdbm 1.8 library.
If this option is specified, the configure script will get
--with-gdbm183-library=-lgdbm
passed as option and GDBM183_LIBDIR and GDBM183_INCLUDEDIR will be
set to /dev/env/DJDIR/lib and /dev/env/DJDIR/include repectively.
This means that you must have gdbm183b installed before you can
build gdbmexport.exe. gdbmexport.exe will be linked with the
library of gdbm183b.
The port can be configured with readline support enabled. This has NOT been
done. This means that you will have to install the readline libray that is
available as:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/rdln70b.zip
and then to reconfigure and recompile the sources from scratch if you
really want this feature. The zip file contains only the binaries build
without readline support.
The port has been configured and compiled with NLS support disabled.
This means that you will have to install the gettext, iconv and unistring
libraries that are available as:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/gtxt192b.zip
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/licv114br2.zip
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/luns093br2.zip
and then to reconfigure and recompile the sources from scratch if you
really want this feature.
The port has been tested by using it. I have used it on WinXP only.
It has worked flawlessly. I do not konw if this will ever be the case on
FreeDOS. I have never used/tested them in that environment.
The port has been configured and compiled on WinXP SP3 and Win98SE using
gcc346b and bnu228b. There is no guarantee that this may be possible
with any other DOS-like OS. Due to the massive use of long file names it
will not be possible to configure and compile without LFN support.
As usual, all djgpp specific files (diffs, README files, etc.) are stored in
the /djgpp directory. The sources have been configured to be build in the
/_build directory. If for some reason it does not work for you, delete its
contents and configure from scratch again.
For further information about GNU dbm please read the info docs and NEWS file.
This is a verbatim extract of the NEWS file:
-------------------------------------------------------------------------------
Version 1.13 - 2017-03-11
* gdbm_fetch, gdbm_firstkey, and gdbm_nextkey behavior
If the requested key was not found, these functions return datum with
dptr pointing to NULL and set gdbm_errno to GDBM_ITEM_NOT_FOUND (in
prior releases, gdbm_errno was set to GDBM_NO_ERROR),
If an error occurred, dptr is set to NULL, and gdbm_errno to
the error code.
In any case gdbm_errno is guaranteed to have meaningful value upon
return.
* Error handling
In previous versions of GDBM, fatal errors (such as write error while
storing the key/data pair or bucket) caused immediate termination of
the program via call to exit(3). This is no longer the case.
Starting from this version, if a fatal error occurrs while modifying
the database file, that database is marked as needing recovery and
gdbm_errno is set to GDBM_NEED_RECOVERY. Calls to any GDBM functions,
except gdbm_recover, will then return immediately with the same error
code.
The function gdbm_recover examines the database file and fixes
eventual inconsistencies. Upon successful return it clears the error
state and makes the database operational again.
For backward compatibility, the fatal_func argument to gdbm_open is
retained and its functionality is not changed. If it is not NULL, the
new error handling procedures are disabled, the function it points to
will be called upon fatal errors. When it returns, exit(1) will be
called.
* Per-database error codes
In addition to gdbm_error global variable, the most recent error state
is saved in the GDBM_FILE structure. This facilitates error handling
when operating multiple GDBM databases simultaneously.
The following new functions are implemented for manipulating error
states:
** gdbm_error gdbm_last_errno (GDBM_FILE dbf)
Returns the code of the most recent error that occurred in the given database.
** int gdbm_last_syserr (GDBM_FILE dbf)
Returns the value the system errno variable had when the most recent
error occurred. This provides additional information for such error
codes as GDBM_FILE_SEEK_ERROR, GDBM_FILE_WRITE_ERROR and the like.
** void gdbm_clear_error (GDBM_FILE dbf)
Clears the error state associated with the database file.
** char const *gdbm_db_strerror (GDBM_FILE dbf)
Returns textual description of the error.
** int gdbm_needs_recovery (GDBM_FILE dbf)
Returns true if the database file needs recovery.
* New gdbm_open flag: GDBM_BSEXACT
When creating a new database, the gdbm_open function will adjust the
requested block size so that the block can hold integer number of
directory entries. Thus, the resulting block size can be bigger than
the requested one. If the GDBM_BSEXACT flag is set, this behavior is
suppressed and gdbm_open will try to force exactly the requested block
size. If unable to do so, it will set the gdbm_errno variable to
GDBM_BLOCK_SIZE_ERROR and return NULL.
* New gdbm_setopt option: GDBM_GETBLOCKSIZE
Returns the block size in bytes. E.g.
int size;
if (gdbm_setopt (dbf, GDBM_GETBLOCKSIZE, &size, sizeof size))
abort ();
...
* New functions
** GDBM_FILE gdbm_fd_open (int fd, const char *file_name, int block_size,
int flags, void (*fatal_func) (const char *))
Alternative function for opening a GDBM database. The fd argument is
the file descriptor of the database file obtained by a call to
open(2), creat(2) or similar functions. The descriptor is not dup'ed, and
will be closed when the returned GDBM_FILE is closed. Use dup(2) if
that is not desirable.
** int gdbm_copy_meta (GDBM_FILE dst, GDBM_FILE src)
Copy meta-information (ownership and file permissions) from src to dst.
* gdbmtool
** Line editing in gdbmtool
The gdbmtool utility now offers the usual line-editing facilities (if
the package has been compiled with GNU Readline.
** Keyboard shortcuts
If the last entered command was "next", hitting the "Enter" key
repeats it without arguments.
* Magic file included
The magic file suitable for use with the file(1) command is
distributed with the package. Its name is src/gdbm.magic.
It is not installed by default, as its installation location differs
considerably between various distributions.
-------------------------------------------------------------------------------
The port consists of the usual three packages that have been produced
using djdev205 and can be downloaded from ftp.delorie.com and mirrors
as (time stamp 2017-07-27):
GNU dbm 1.13 binaries, headers, libraries, info and man
format documentation:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/gdbm113b.zip
GNU dbm 1.13 dvi, html, pdf and ps format documentation:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/gdbm113d.zip
GNU dbm 1.13 source:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/gdbm113s.zip
Send GNU dbm specific bug reports to <bug-gdbm AT gnu DOT org>.
Send suggestions and bug reports concerning the DJGPP port to
comp.os.msdos.djgpp or <djgpp AT delorie DOT com>.
Enjoy.
Guerrero, Juan Manuel <juan DOT guerrero AT gmx DOT de>
- Raw text -