2017-03-11  Sergey Poznyakoff  <gray@gnu.org>

	Version 1.13

2017-03-07  Sergey Poznyakoff  <gray@gnu.org>

	Fix parralel builds

	* src/Makefile.am: Add dependency for gram.h

	Reported by Petr Ovtchenkov <ptr@void-ptr.info>

2017-01-02  Sergey Poznyakoff  <gray@gnu.org>

	Happy GNU Year

2016-12-21  Sergey Poznyakoff  <gray@gnu.org>

	Minor fix

	* src/mmap.c (_gdbm_internal_remap): Avoid munmapping NULL pointer.
	Make sure mapped_region isn't a dangling pointer.

2016-08-06  Sergey Poznyakoff  <gray@gnu.org.ua>

	Fix typos

2016-07-27  Sergey Poznyakoff  <gray@gnu.org.ua>

	Remove obsolete error code.

	* doc/gdbm.texi: Remove description of GDBM_UNKNOWN_UPDATE.
	Document GDBM_DIR_OVERFLOW.
	* src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): Rename to GDBM_DIR_OVERFLOW.
	(GDBM_UNKNOWN_ERROR): New error code.
	(GDBM_UNKNOWN_UPDATE): Define to GDBM_UNKNOWN_ERROR for
	backward compatibility.
	* src/gdbmerrno.c (gdbm_strerror, gdbm_db_strerror): Simplify a bit

	Avoid range error when doubling directory size.

	* src/bucket.c (_gdbm_split_bucket): Avoid range error
	when doubling directory size.
	* src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): New error code.
	* src/gdbmerrno.c (gdbm_errlist): Describe GDBM_ERR_DIR_OVERFLOW.

2016-07-26  Sergey Poznyakoff  <gray@gnu.org.ua>

	Update gdbm.magic

	* src/gdbm.magic: Explicitly handle big- and little-endian databases.

	Minor changes

	* src/bucket.c (_gdbm_read_bucket_at): Remove unused variable.
	* src/debug.c: Include ctype.h
	(datbuf_format): Don't use sprintf; Precede each output line
	with data offset.

	Fix remaining uses of gdbm_set_errno function.

	Use the GDBM_SET_ERRNO and GDBM_SET_ERRNO2 macros to make
	sure the error gets reported in debug output.

	* src/fullio.c (_gdbm_full_read)
	(_gdbm_full_write): Return -1 and set gdbm_errno
	on error.
	* src/bucket.c: Use GDBM_SET_ERRNO(2?) or
	GDBM_DEBUG where necessary.
	* src/falloc.c: Likewise.
	* src/findkey.c: Likewise.
	* src/gdbmdefs.h: Likewise.
	* src/gdbmopen.c: Likewise.
	* src/gdbmstore.c: Likewise.
	* src/mmap.c: Likewise.
	* src/recover.c: Likewise.
	* src/update.c: Likewise.

2016-07-25  Sergey Poznyakoff  <gray@gnu.org.ua>

	Improve debugging and error tracing.

	* src/gdbmdefs.h (GDBM_SET_ERRNO)
	(GDBM_SET_ERRNO2): New macros.

	* src/base64.c: Use new macros to set error state.
	* src/bucket.c: Likewise.
	* src/falloc.c: Likewise.
	* src/findkey.c: Likewise.
	* src/gdbm_load.c: Likewise.
	* src/gdbmdelete.c: Likewise.
	* src/gdbmdump.c: Likewise.
	* src/gdbmexp.c: Likewise.
	* src/gdbmfetch.c: Likewise.
	* src/gdbmimp.c: Likewise.
	* src/gdbmload.c: Likewise.
	* src/gdbmopen.c: Likewise.
	* src/gdbmseq.c: Likewise.
	* src/gdbmsetopt.c: Likewise.
	* src/gdbmstore.c: Likewise.

	* src/gdbmtool.c: Fix preprocessor conditional.

	Fix distribution

	* src/Makefile.am: Mark gdbm.h as noinst
	* compat/Makefile.am (AM_CPPFLAGS): Make sure we pick up
	../src/gdbm.h

	Improve the "next" shortcut.

	* src/gdbmtool.c (open_handler): Close the previously
	opened database.
	(close_handler): Free the file name.
	(print_dir_handler): Print the number of buckets.
	(command_repeat_type): New enum.
	(command) <repeat>: Change type to enum command_repeat_type.
	(command_tab): Update accordingly. Mark "next" with REPEAT_NOARG.
	(run_last_command): Handle REPEAT_NOARG separately.
	* NEWS: Document the shortcut.
	* doc/gdbm.texi: Likewise.
	* src/debug.c (datbuf_format): Don't represent
	bytes after the end of datum as zeros.
	(gdbm_debug_datum): Print datum size.

	Add debug info.

	* configure.ac: Fix description wording.
	* src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Don't
	define GDBM_DEBUG_ENABLE.
	* tests/Makefile.am: Likewise.
	* src/debug.c (gdbm_debug_printer)
	(gdbm_debug_flags): New globals.
	(gdbm_debug_token, gdbm_debug_parse_state)
	(gdbm_debug_datum): New functions.
	* src/gdbm.h.in [@GDBM_DEBUG_ENABLE@]: Define GDBM_DEBUG_ENABLE.
	(gdbm_debug_printer_t): New typedef.
	(gdbm_debug_printer, gdbm_debug_flags): New externs.
	(GDBM_DEBUG_ERR,GDBM_DEBUG_OPEN)
	(GDBM_DEBUG_READ,GDBM_DEBUG_STORE)
	(GDBM_DEBUG_LOOKUP,GDBM_DEBUG_ALL): New defines.
	(gdbm_debug_token,gdbm_debug_parse_state)
	(gdbm_debug_datum): New protos.
	* src/gdbmdefs.h (GDBM_DEBUG,GDBM_DEBUG_DATUM): New macros.

	* src/findkey.c: Add debugging info.
	* src/gdbmfetch.c: Likewise.
	* src/gdbmopen.c: Likewise.
	* src/gdbmseq.c: Likewise.
	* src/gdbmstore.c: Likewise.
	* src/gdbmtool.c (open_handler): Allow the use of ~/
	(command) <repeat,variadic>: New members.
	(run_command): Handle variadic functions.
	(run_last_command): New command.  In interactive mode,
	repeats the last command if it was marked
	with repeat=1 (currently, only "next").
	New command: "debug".
	(all functions): Use terror instead of fprintf(stderr,...);
	* src/gdbmtool.h (handler_param) <vararg>: New member.
	(run_last_command): New proto.
	* src/gram.y: Call run_last_command) on empty input.
	* tests/gtload.c: New option: -debug=

2016-07-20  Sergey Poznyakoff  <gray@gnu.org>

	Introduce debug hooks.

	* configure.ac: New option --enable-debug
	Print feature summary at the end of the run.

	* src/debug.c: New file.
	* src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Build debug.o
	Define GDBM_DEBUG_ENABLE.
	* src/gdbmdefs.h [GDBM_DEBUG_ENABLE] (_gdbm_debug_hook_install)
	(_gdbm_debug_hook_remove,_gdbm_debug_hook_check)
	(_gdbm_debug_hook_val): New protos.
	(GDBM_DEBUG_HOOK, GDBM_DEBUG_OVERRIDE)
	(GDBM_DEBUG_ALLOC): New defines.
	* src/gdbm.h.in (GDBM_RCVR_FORCE): New flag.
	* src/recover.c (gdbm_recover): Check database before attempting
	recovery, unless GDBM_RCVR_FORCE flag is set.
	* doc/gdbm.texi: Document GDBM_RCVR_FORCE
	* src/gdbmreorg.c (gdbm_reorganize): Use GDBM_RCVR_FORCE.

	* src/gdbmtool.c (main): Always allocate file_name.

	* src/bucket.c: Put GDBM_DEBUG_OVERRIDE and GDBM_DEBUG_ALLOC
	in critical places.
	* src/falloc.c: Likewise.
	* src/findkey.c: Likewise.
	* src/gdbmopen.c: Likewise.
	* src/gdbmstore.c: Likewise.
	* src/update.c: Likewise.

	* tests/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Define GDBM_DEBUG_ENABLE.
	* tests/gtload.c: New options -hook, -recover, -verbose,
	-backup, -max-failures, -max-failed-keys,
	and -max-failed-buckets.
	Attempt recovery after errors.

	Fix typo

2016-07-19  Sergey Poznyakoff  <gray@gnu.org>

	Improve docs. Minor changes.

	* NEWS: Document new features.
	* doc/gdbm.texi: Likewise.
	* src/gdbm.h.in (gdbm_last_errno): Fix return value.
	(gdbm_check_syserr): New proto.
	* src/gdbmdefs.h (gdbm_file_info) <last_error>: Fix data type.
	* src/gdbmerrno.c (gdbm_last_errno): Fix return value.
	(gdbm_check_syserr): New function.

	Implement gdbm_recover function

	* configure.ac: Don't check for rename.
	* src/Makefile.am (libgdbm_la_SOURCES): Add recover.c
	* src/recover.c: New file.
	* src/bucket.c (_gdbm_get_bucket): Remove extra space before [
	* src/err.c (prerror): Take additional argument
	(gdbm_perror): Print system errno if necessary.
	* src/gdbm.h.in (GDBM_CLOERROR): New flag.
	(gdbm_fd_open, gdbm_copy_meta): New proto.
	(gdbm_last_syserr,gdbm_db_strerror,gdbm_recover): New proto.
	(gdbm_syserr): New extern.
	(gdbm_recovery): New struct.
	(GDBM_RCVR_DEFAULT,GDBM_RCVR_ERRFUN)
	(GDBM_RCVR_MAX_FAILED_KEYS)
	(GDBM_RCVR_MAX_FAILED_BUCKETS)
	(GDBM_RCVR_MAX_FAILURES)
	(GDBM_RCVR_BACKUP): New flags.
	(GDBM_BACKUP_FAILED): New error code.
	* src/gdbmclose.c (gdbm_close): Work correctly if dbf->desc == -1.
	* src/gdbmcount.c (gdbm_count): Remove spurious sorting.
	Use _gdbm_next_bucket_dir for iterating over the buckets.
	* src/gdbmdefs.h (struct gdbm_file_info)<last_syserror>
	<last_errstr>: New members.
	* src/gdbmerrno.c (gdbm_set_errno): Set last_syserror as well.
	(gdbm_clear_error): Reset last_syserror.
	(gdbm_last_syserr): New function.
	(gdbm_errlist): New entry for GDBM_BACKUP_FAILED.
	(gdbm_db_strerror): New function.
	(gdbm_syserr): New global.
	* src/gdbmload.c (get_parms): Buffer can be NULL.
	* src/gdbmopen.c (gdbm_fd_open): New function.
	(gdbm_open): Rewrite as a wrapper over gdbm_fd_open.
	* src/gdbmreorg.c (gdbm_reorganize): Rewrite as a wrapper
	over gdbm_recover.
	* src/proto.h (_gdbm_next_bucket_dir): New proto.
	* src/gdbmtool.c: New command: recover.
	* tests/.gitignore: Add gtrecover
	* tests/gtrecover.c: New test program.
	* tests/Makefile.am: Build gtrecover

2016-07-16  Sergey Poznyakoff  <gray@gnu.org.ua>

	Bugfix

2016-07-15  Sergey Poznyakoff  <gray@gnu.org.ua>

	New gdbm_setopt option to get the actual block size value

	* src/gdbm.h.in (GDBM_GETBLOCKSIZE): New option.
	* src/gdbmcount.c (gdbm_count): Fix memory leak on
	error.
	* src/gdbmsetopt.c (gdbm_setopt): Rewrite.
	Handle GDBM_GETBLOCKSIZE.

	* NEWS: Document GDBM_GETBLOCKSIZE
	* doc/gdbm.texi: Likewise.

	* tests/gtload.c: New options -bsexact and -verbose.
	* tests/Makefile.am: Add new testcases.
	* tests/testsuite.at: Likewise.
	* tests/blocksize00.at: New testcase.
	* tests/blocksize01.at: Likewise.
	* tests/blocksize02.at: Likewise.

	gdbm_open adjusts requested block size to accomodate integer number of directory offsets.

	* src/gdbm.h.in (GDBM_BSEXACT): New flag.
	* src/gdbmopen.c (compute_directory_size): New function.
	(gdbm_open): When creating new database, adjust the requested
	block size so that the block holds integer number of directory
	indices.  Disable this behavior if GDBM_BSEXACT flag is set
	(this reverts to old behavior).  Always unset GDBM_BSEXACT if
	using block size returned by stat(2).  This makes sure gdbm_open
	succeeds on file systems reporting block sizes not divisible by
	512.
	* src/gdbmconst.h (GDBM_MIN_BLOCK_SIZE): New constant.
	* src/gdbmimp.c (gdbm_import_from_file): Use GDBM_MIN_BLOCK_SIZE
	instead of the hardcoded value.
	* NEWS: Document GDBM_BSEXACT.
	* doc/gdbm.texi: Likewise.

2016-07-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Don't use hardcoded constant

	* src/gdbmconst.h (GDBM_HASH_BITS): New constant.
	* src/bucket.c: Use GDBM_HASH_BITS instead of the
	hardcoded value.
	* src/findkey.c (_gdbm_findkey): Use _gdbm_hash_key.

	* src/gdbmtool.c (hash_handler): Use _gdbm_hash_key if the
	database is open.
	* src/hash.c (_gdbm_bucket_dir, _gdbm_hash_key): New functions.
	* src/proto.h (_gdbm_bucket_dir, _gdbm_hash_key): New protos.

	* src/systems.h (STATBLKSIZE): Take a struct stat as argument.
	* src/gdbmopen.c (STATBLKSIZE): Takes argument now.

	gdbmtool: improve bucket dump and hash calculator

	* src/gdbmtool.c (format_key_start): New function.
	(print_bucket): Take variadic arguments, use mesg
	as prinf-style format.
	Display first bytes of each non-empty key.
	(print_current_bucket_begin): Avoid coredump if
	gdbm_file is not initialized.
	(print_current_bucket_handler): Change header depending on the
	invoking command.
	(hash_handler): In presence of a database, print also the
	bucket number and offset within the bucket.

2016-07-13  Sergey Poznyakoff  <gray@gnu.org.ua>

	Bugfix

	Bugfix

	Update magic file

	* src/gdbm.magic: Recognize dumpfiles.

	Update NEWS

	Provide the gdbm.magic file for file(1).

	* src/gdbm.magic: New file.
	* README: Document existence of the magic file.
	* src/Makefile.am (EXTRA_DIST): Add gdbm.magic.

	gdbmtool: define macros for accessing typed handler arguments.

	* src/gdbmtool.h (PARAM_STRING, PARAM_DATUM)
	(PARAM_KVPAIR): New defines.
	* src/gdbmtool.c: Use above for accessing handler arguments.

2016-07-12  Sergey Poznyakoff  <gray@gnu.org.ua>

	Line-editing support in gdbmtool

	* configure.ac: Check if GNU Readline is available.
	* src/Makefile.am: Add new files.
	* src/input-rl.c: New file.
	* src/input-std.c: New file.
	* src/gdbmtool.c (handler_param): Move declaration to
	the header file.
	(quit_handler): Call input_done.
	(command_tab): Add the "history" command.
	(command_generator): New function.
	(slist_new_s, slist_new_l)
	(slist_insert): New functions.
	(main): Call input_init and input_done.
	* src/gdbmtool.h: New protos.
	* src/gram.y: Use slist_insert to construct string lists.
	* src/lex.l (read_input): Remove.  Use input_read instead.
	(print_prompt_at_bol): New function.
	(print_prompt): Remove.
	(make_prompt): New function.

	* NEWS: Document changes.
	* README: Document readline support.
	* doc/gdbm.texi: Document line editing in gdbmtool.
	* doc/gdbmtool.1: Likewise.

2016-07-09  Sergey Poznyakoff  <gray@gnu.org.ua>

	Don't bail out on fatal errors, unless the user defines the fatal_err function

	* src/bucket.c (_gdbm_get_bucket)
	(_gdbm_split_bucket, _gdbm_write_bucket): Return error code. All callers
	updated.
	* src/proto.h (_gdbm_get_bucket)
	(_gdbm_split_bucket, _gdbm_write_bucket): Update declarations
	* src/falloc.c (push_avail_block)
	(pop_avail_block): Return error code. All callers
	updated.
	* src/update.c (_gdbm_fatal): Exit only if the user defined
	fatal_err function.

	* src/gdbmerrno.c (gdbm_needs_recovery): New function.
	* src/gdbm.h.in (gdbm_needs_recovery): New proto.

	* compat/dbminit.c: Set gdbm_errno on fatal errors.
	* compat/dbmopen.c: Likewise.
	* src/findkey.c: Likewise.
	* src/gdbm_load.c: Likewise.
	* src/gdbmcount.c: Likewise.
	* src/gdbmdefs.h: Likewise.
	* src/gdbmdelete.c: Likewise.
	* src/gdbmdump.c: Likewise.
	* src/gdbmexists.c: Likewise.
	* src/gdbmexp.c: Likewise.
	* src/gdbmfetch.c: Likewise.
	* src/gdbmimp.c: Likewise.
	* src/gdbmload.c: Likewise.
	* src/gdbmopen.c: Likewise.
	* src/gdbmreorg.c: Likewise.
	* src/gdbmseq.c: Likewise.
	* src/gdbmsetopt.c: Likewise.
	* src/gdbmstore.c: Likewise.
	* src/gdbmsync.c: Likewise.
	* src/mmap.c: Likewise.

	All gdbm functions return immediately if the DB is in inconsistent sate (needs recovery).

	* src/gdbm.h.in (GDBM_NEED_RECOVERY): New error code.
	* src/gdbmdefs.h (GDBM_ASSERT_CONSISTENCY): New macro.
	* src/gdbmerrno.c: Update.
	* src/gdbmopen.c (gdbm_open): Initialize need_recovery
	and last_error.

	* src/gdbmcount.c (gdbm_count): Return immediately if the
	database needs recovery.
	* src/gdbmdelete.c (gdbm_delete): Likewise.
	* src/gdbmdump.c (gdbm_dump_to_file, gdbm_dump): Likewise.
	* src/gdbmexists.c (gdbm_exists): Likewise.
	* src/gdbmexp.c (gdbm_export_to_file): Likewise.
	* src/gdbmfetch.c (gdbm_fetch): Likewise.
	* src/gdbmimp.c (gdbm_import_from_file): Likewise.
	* src/gdbmreorg.c (gdbm_reorganize): Likewise.
	* src/gdbmseq.c (gdbm_firstkey): Likewise.
	* src/gdbmsetopt.c (gdbm_nextkey): Likewise.
	* src/gdbmstore.c (gdbm_store): Likewise.
	* src/gdbmsync.c (gdbm_sync): Likewise.

	Fix indentation

	Per-database error state.

	Last error code is stored in the database file structure as
	well as in the global gdbm_errno.  Special functions are provided
	for retrieving and clearing the last error state.

	* src/gdbmdefs.h (gdbm_file_info): New member: last_error
	* src/gdbm.h.in (gdbm_last_errno, gdbm_set_errno)
	(gdbm_clear_error): New protos.
	* src/gdbmerrno.c (gdbm_last_errno, gdbm_set_errno)
	(gdbm_clear_error): New functions

	* NEWS: Update.

	* compat/dbminit.c: Use gdbm_set_errno to set error state.
	* compat/dbmopen.c: Likewise.
	* src/bucket.c: Likewise.
	* src/findkey.c: Likewise.
	* src/gdbm_load.c: Likewise.
	* src/gdbmcount.c: Likewise.
	* src/gdbmdelete.c: Likewise.
	* src/gdbmdump.c: Likewise.
	* src/gdbmexists.c: Likewise.
	* src/gdbmexp.c: Likewise.
	* src/gdbmfetch.c: Likewise.
	* src/gdbmimp.c: Likewise.
	* src/gdbmload.c: Likewise.
	* src/gdbmopen.c: Likewise.
	* src/gdbmreorg.c: Likewise.
	* src/gdbmseq.c: Likewise.
	* src/gdbmsetopt.c: Likewise.
	* src/gdbmstore.c: Likewise.
	* src/gdbmsync.c: Likewise.
	* src/mmap.c: Likewise.

2016-07-07  Sergey Poznyakoff  <gray@gnu.org.ua>

	Switch to Git repository

	* .cvsignore: Rename to .gitignore
	* compat/.cvsignore: Likewise.
	* doc/.cvsignore: Likewise.
	* export/.cvsignore: Likewise.
	* po/.cvsignore: Likewise.
	* src/.cvsignore: Likewise.
	* tests/.cvsignore: Likewise.

	* doc/gdbm.texinfo: Rename to doc/gdbm.texi
	* doc/Makefile.am: Update

        Generate ChangeLog from Git log

	* ChangeLog: Rename to ChangeLog.cvs
	* Makefile.am: Recreate ChangeLog
	* bootstrap: Create a ChangeLog placeholder.
	* git2chg.awk: New file.

2016-07-06  Sergey Poznyakoff  <gray@gnu.org.ua>

	* doc/gdbm.texinfo: Normal installation prefix is /usr.
	* doc/gdbm.3: Spell fixes.

2016-05-16  Sergey Poznyakoff  <gray@gnu.org.ua>

	Version 1.12

2016-05-16  Sergey Poznyakoff  <gray@gnu.org.ua>

	* src/gdbmtool.c (_gdbm_print_bucket_cache): Use %zu to print
	size_t.
	* src/gdbmtool.h (variable_unset): New proto.
	(yyerror): Argument is char const *.
	* src/gram.y: Likewise.
	* src/lex.l: Add option noinput
	* src/parseopt.c (print_option_descr): Use fwrite instead of
	printf.
	* src/var.c: Fix initializers to suppress warnings.

2015-12-05  Sergey Poznyakoff  <gray@gnu.org.ua>

	* doc/gendocs_template: Add references to manpages.

2015-12-05  Harald Hoyer <harald@redhat.com>

	* doc/gdbmtool.1: Minor change.
	* doc/gdbm.3: Fix typo.

2015-11-02  Sergey Poznyakoff  <gray@gnu.org.ua>

	Tiny fix

	* var.c: Use ISO C99 initializers.  Thanks to
	Brad Forschinger <bnjf@bnjf.id.au>

2015-08-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Fix doc generation.

	* doc/Config: Rename to doc/html.init.
	* doc/gdbm.texinfo: Fix sectioning.

2015-08-13  Sergey Poznyakoff  <gray@gnu.org.ua>

	Minor fix in docs

	* doc/gdbm.texinfo: Fix direntry records.

2014-07-03  Sergey Poznyakoff  <gray@gnu.org.ua>

	Bugfix.

	* src/lex.l (expand_char): Don't return any value.

2014-02-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Optionally install compatibility headers into a separate directory.

	* configure.ac: Version 1.11.90
	(COMPATINCLUDEDIR): New substitution variable.
	* compat/Makefile.am (compatincludedir): New variable.
	(include_HEADERS): Rename to compatinclude_HEADERS.
	* NEWS: Document COMPATINCLUDEDIR.
	* README: Likewise.

2014-02-12  Sergey Poznyakoff  <gray@gnu.org.ua>

	* src/gdbmimp.c (gdbm_import_from_file): Read record sizes as
	unsigned long, as they are stored by gdbm_export_to_file.
	Improve error reporting.

2014-02-06  Sergey Poznyakoff  <gray@gnu.org.ua>

	* doc/Makefile.am: Use dist_man_MANS

2013-12-25  Sergey Poznyakoff  <gray@gnu.org.ua>

	Version 1.11

2013-12-25  Sergey Poznyakoff  <gray@gnu.org.ua>

	Minor changes.

	* src/gdbm_load.c: New options: --mmap, --cache-size and
	--block-size.

	* doc/gdbm.texinfo: Document new gdbm_load options.
	* doc/gdbm_load.1: Likewise.

	* src/gdbmdelete.c: Stylistic changes.
	* src/gdbmstore.c: Likewise.

2013-05-21  Sergey Poznyakoff  <gray@gnu.org.ua>

	New function gdbm_count.
	
	* configure.ac: Check for unsigned long long, define
	substitution variable GDBM_COUNT_T.
	* src/gdbmcount.c: New file.
	* src/Makefile.am (libgdbm_la_SOURCES): Add gdbmcount.c.
	* src/bucket.c (_gdbm_read_bucket_at): New function.
	* src/gdbm.h.in (gdbm_count_t): New typedef.
	(gdbm_count): New proto.
	* src/gdbmdefs.h (GDBM_DIR_COUNT): New define.
	* src/proto.h (_gdbm_read_bucket_at): New proto.
	* src/var.c: New variable "filemode".

	* src/gdbmtool.c: Use gdbm_count.  Various bugfixes.
	
	* NEWS: Update.
	* doc/gdbm.texinfo: Update.
	
2013-05-17  Sergey Poznyakoff  <gray@gnu.org.ua>

	Update the docs.
	
	* NEWS: Update.
	* doc/gdbm.texinfo: Update.
	* doc/gdbmtool.1: Document the "define" statement.
	* src/datconv.c: Rename string datatypes to reflect their
	meaning.
	(dsprint): Improve output presentation.
	
2013-05-16  Sergey Poznyakoff  <gray@gnu.org.ua>

	Provide support for a simplified "define" construct.

	* doc/gdbm.texinfo: Document the "define" statement.
	* src/datconv.c: Support short and ushort data types.
	* src/gdbmtool.c: Don't call checkdb prior to handling
	the "hash" command.
	* src/gram.y: Support simplified definition construct:
	"define key|content type".

2013-05-16  Sergey Poznyakoff  <gray@gnu.org.ua>

	Improve handling of the variables.

	* src/gdbmtool.c (opendb): Allow for unset variables.
	* src/gram.y: Improve error detection.
	* src/lex.l: Handle multiline strings.
	(pe_file_name): file_name can be NULL.
	* src/var.c (VARF_PROT): New flag. Protects the variable
	from being unset.
	(vartab): Use VARF_PROT if needed.
	(s2b): Fix return values.
	(variable_set, variable_unset): Return error if attempting
	to unset a variable marked with VARF_PROT.

	* doc/gdbm.info: Update.
	* doc/gdbmtool.1: Update.

2013-05-15  Sergey Poznyakoff  <gray@gnu.org.ua>

	Minor change

	* src/gdbmtool.c (command_tab): Change variable names
	in docstrings to uppercase.

2013-05-15  Sergey Poznyakoff  <gray@gnu.org.ua>

	Implement the "quiet" variable.

	* src/var.c (vartab) <quiet>: New variable.
	(variable_is_true): Return 0 if the value cannot be
	retrieved.
	* src/gdbmtool.c (optab): New option --file (-f).
	(main): Handle the --file option.
	Retrieve the "quiet" setting from the variable.
	* src/lex.l (context_pop): Clear both point.file
	and yylloc.

2013-05-15  Sergey Poznyakoff  <gray@gnu.org.ua>

	Add "pager" variable and "unset" command.

	* src/gdbmtool.c (command_tab) <unset>: New command.
	(run_command): Get pager value from the variable.
	* src/gdbmtool.h (VAR_ERR_NOTSET): New error code.
	(variable_is_true): New function. Replaces variable_is_set,
	which changed semantics.
	* src/gram.y: Implement the unset command.
	* src/var.c: Support the "unset variable" notion.
	(VARF_INIT): New flag.
	(VAR_IS_SET): New define.
	(vartab): Mark initialized variables with VARF_INIT.
	New variable "pager".
	(open_hook): v can be NULL.
	(variable_set): NULL value unsets the variable.
	(variable_unset): New function.
	(variable_get): Return VAR_ERR_NOTSET if the variable is
	not set.
	(variable_is_true): Renamed from variable_is_set.
	(variable_is_set): New function.
	
	* src/gdbmdefs.h: Fix some typos.

2013-05-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Change variable handling. 
	
	* src/util.c: New file.
	* src/Makefile.am: Add new files.
	* src/gdbmtool.c (open_mode): New variable.
	(terror): Remove.
	(mkfilename, tildexpand): Move to util.c
	(opendb): Use open_mode.
	(import_handler): Likewise.
	(optab): New option -N (--norc).

	* src/gdbmtool.h (vparse_error): Rename to vlerror.
	(parse_error): Rename to lerror.
	(syntax_error): Rename tp terror.
	All uses updated.
	(VAR_ERR_FAILURE): Remove.
	(VAR_ERR_BADVALUE): New error code.
	(variable_mode_name): Remove.
	(mkfilename, tildexpand)
	(vgetyn, getyn): New protos.
	* src/lex.l (initialized): New static.
	(setsource): Set initialized.
	(vlerror): Print locus only if the lexer has been
	initialized.
	* src/var.c: Rewrite.

2013-05-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Provide "open" and "close" commands; implement new variables.
	
	* src/datconv.c (datum_format): Don't print field delimiter
	after the last field.
	(dsprint): Bugfix.
	* src/gdbmload.c (gdbm_load_from_file): Return GDBM_NO_DBNAME 
	when loading from bdb dump and the database pointer is NULL.
	* src/gdbmtool.c (opendb, checkdb): New auxiliary functions.
	(begin handlers): call checkdb.
	(import_handler): Special handling for GDBM_NO_DBNAME.
	(status_handler): Print more info.
	(command_tab): Call checkdb prior to handlers that expect an
	open database.
	New commands: open, close
	(gdbmarg_string, gdbmarg_datum)
	(gdbmarg_kvpair): Take pointer to locus as the 2nd argument.
	All uses changed.
	(coerce): Include locus info in the diagnostic message.
	(main): Don't open database right away.
	* src/gdbmtool.h (GDBMTOOL_DEFFILE): New define.
	(gdbmarg) <loc>: New member.
	(VART_INT): New variable typ.e
	(VAR_ERR_FAILURE): New error code.
	(variable_is_set, varible_mode_name): New protos.
	* src/gram.y: Provide printable token names for error messages.
	Pass locus to gdbmarg initialization functions.
	* src/lex.l (vparse_error): Fix output.
	* src/var.c (variable) <v.num, hook, hook_data>: New members.
	(vartab): Define more variables.
	(variable_set): Accept value of any valid datatype. 
	(variable_mode_name, variable_is_set): New functions.

2013-05-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Cleanup.
	
	* src/datconv.c (s_float): Use strtod.
	(datum_scan_notag, datum_scan_tag): Made static.
	(dsprint): New function.
	* src/gdbmtool.c (status_handler): Print key and
	content definitions.
	(slist_new): Bugfix (missing return statement).
	* src/gdbmtool.h: Add new prototypes.
	* src/lex.l: Remove unused variables, set option
	nounput.

2013-05-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Implement rc files and "source" command; improve lexical analyzer.

	* src/gdbmtool.c (interactive): Move to lex.l;
	(mkfilename, tildexpand): New functions.
	(command_tab) <source>: New command.
	(main): Source rc file, if present.
	* src/gdbmtool.h (setsource): Change return type
	and signature.
	* src/lex.l: Implement context stack.
	Change DEF to be an exclusive state.

	* src/gdbmapp.h (estrdup): Argument is const.
	* src/mem.c: Likewise.

2013-05-14  Sergey Poznyakoff  <gray@gnu.org.ua>

	Add support for Berkeley dump format version 3 (read-only).

	* src/gdbmapp.h: Include gettext.h and locale.h.
	* src/gdbmload.c: Support for Berkeley dump format,
	version 3.

2013-05-13  Sergey Poznyakoff  <gray@gnu.org.ua>

	Remove the "read" command.  Use "import" instead.

2013-05-13  Sergey Poznyakoff  <gray@gnu.org.ua>

	Add "set" and "define" to the main command table.

	* src/gdbmtool.c: Include gram.h
	(command) <tok>: New member.
	(command_tab): List "define" and "set".
	(find_command): Rewrite as command_lookup, with different
	return type and signature.
	(run_command): Take struct command * as its first argument.
	* src/gdbmtool.h (command_lookup): New proto.
	(run_command): Change signature.
	(datadef_locate): Rename to datadef_lookup. All uses changed.
	* src/gram.y: Update.
	* src/lex.l: Change handling of IDENT rules.

2013-05-13  Sergey Poznyakoff  <gray@gnu.org.ua>

	Implement shell variables in gdbmtool.

	* src/var.c: New file.
	* src/Makefile.am: Add var.c
	* src/datconv.c (datum_format): Remove the "delim"
	parameter, use "delim1" and "delim2" shell variables
	instead.
	* src/gdbmtool.c: Remove "prompt" command. Use "set ps[12]"
	instead.
	(print_prompt): Move to lex.l
	* src/gdbmtool.h (variable_set)
	(variable_get, variable_print_all): New protos.
	* src/gram.y: Handle the "set" command.
	* src/lex.l: Update.

2013-05-13  Sergey Poznyakoff  <gray@gnu.org.ua>

	Handle structured key and content data in gdbmtool.

	* src/datconv.c: New file.
	* src/Makefile.am (gdbmtool_SOURCES): Add datconv.c.
	* src/gdbmtool.h (slist, kvpair): New structures.
	(gdbmarg): Keep various types of data depending on the
	value of the type member.
	(slist_new, slist_free)
	(kvpair_string, kvpair_list): New protos.
	(gdbmarg_new): Remove.
	(gdbmarg_string, gdbmarg_datum)
	(gdbmarg_kvpair, gdbmarg_free)
	(gdbmarg_destroy): New protos.
	(xd_expand, xd_store, datadef_locate): New protos.
	(field, dsegm): New structs.
	(dsegm_new, dsegm_new_field, dsegm_free_list): New protos.
	* src/gdbmtool.c: Rewrite.
	* src/gram.y: Change grammar to allow for defining key and
	content structure and for supplying structured data as arguments
	to fetch, store and similar functions.
	* src/lex.l: Handle new token types.

	* tests/dtload.c (main): Fix parser.
	* tests/gtload.c: Likewise.

2013-05-11  Sergey Poznyakoff  <gray@gnu.org.ua>

	Rewrite gdbmtool parser.

	* src/testgdbm.c: Remove.
	* src/gdbmtool.c: New file.
	* src/gdbmtool.h: New file.
	* src/gram.y: New file.
	* src/lex.l: New file.
	* src/Makefile.am: Update.

2013-05-09  Sergey Poznyakoff  <gray@gnu.org.ua>

	Add new prompt escapes.

	* src/testgdbm.c: New prompt escapes: %p, %P, %v, %_.
	Change default prompt to %p>%_.
	* doc/gdbmtool.1: Document new prompt escapes.

2013-05-08  Sergey Poznyakoff  <gray@gnu.org.ua>

	Rename testgdbm to gdbmtool. Improve documentation.

	* configure.ac: Fix a typo.
	* src/.cvsignore: Add gdbmtool
	* src/Makefile.am: Rename testgdbm to gdbmtool. Source
	file not renamed because of CVS deficiency.
	* src/gdbm_dump.c: Enable NLS.
	* src/gdbm_load.c: Likewise.
	* src/testgdbm.c: New option -q (--quiet).
	New command: prompt.
	* doc/Makefile.am (man_MANS): Add new manpages.
	* doc/gdbmtool.1: New file.
	* doc/gdbm_load.1: New file.
	* doc/gdbm_dump.1: New file.
	* doc/gdbm.3: Update.
	* doc/gdbm.texinfo: Update.

2013-05-08  Sergey Poznyakoff  <gray@gnu.org.ua>

	* configure.ac: (AC_INIT): Add webpage URL.

2013-05-08  Sergey Poznyakoff  <gray@gnu.org.ua>

	Improve testgdbm; install some more bugfixes.

	* src/gdbmdefs.h: Fix typo in a comment.
	* src/gdbmdump.c (gdbm_dump_to_file): Improve error
	checking.
	* src/testgdbm.c: Improve interactive usage.
	(command) <minlen>: Rename to len.
	(command_tab): Initialize len.
	(set_minimal_abbreviations): Remove.
	(sort_commands): New function.
	(find_command): Print possible alternatives in case of
	ambiguous input.
	(main): Reset param.argc after freeing previous arguments.
	Continue silently if find_command returns NULL.

2013-05-07  Sergey Poznyakoff  <gray@gnu.org.ua>

	Bugfix.

	* src/gdbmreorg.c: Call _gdbm_mapped_init when the database
	structure is fully initialized (Puszcza bug #171).

2013-05-07  Sergey Poznyakoff  <gray@gnu.org.ua>

	Minor change
	
	* configure.ac: Require autoconf 2.69 or newer (in response
	to Puszcza bug #171).

2012-03-21  Sergey Poznyakoff  <gray@gnu.org.ua>

	* tests/create00.at: Use cmp -s || diff -u instead of plain
	diff, because the latter produces extra output on some systems
	(notably Solaris).
	* tests/dbmcreate00.at: Likewise.
	* THANKS: Add Bill Jones

2011-11-16  Sergey Poznyakoff  <gray@gnu.org.ua>

	Improve testgdbm
	
	* src/mem.c (ealloc_die): Return EXIT_FATAL to the shell.
	* src/testgdbm.c: Use emalloc, erealloc and estrdup for memory
	allocation.
	(syntax_error): New function.
	(handler_param): New struct.
	(all handlers): Change signature.  Take a pointer to struct
	handler_param as argument.
	(export_handler,import_handler): Handle new formats.
	(main): Take first argument to be the file name.
	(optab): Remove -f argument.  Hide -g, but retain it for
	backward compatibility.

	* doc/gdbm.texinfo: Update.

2011-11-15  Sergey Poznyakoff  <gray@gnu.org.ua>

	Version 1.10.90

	Update the docs.  Improve dump/load utilities.
	
	* doc/gdbm.texinfo: Reorganize the material.  Document gdbm_load
	and gdbm_dump utilities.
	* src/gdbm.h.in (GDBM_META_MASK_MODE)
	(GDBM_META_MASK_OWNER): New constant.
	(gdbm_load,gdbm_load_from_file): Take an additional argument:
	meta_flags, which masks out restoring certain meta-data.
	* src/gdbm_dump.c: Remove -b option.  The -H option takes symbolic
	format names.  Use the standard exit codes.
	* src/gdbm_load.c: New options: --mode, --user and --no-meta.
	Use the standard exit codes.
	* src/gdbmapp.h (EXIT_OK, EXIT_FATAL, EXIT_MILD)
	(EXIT_USAGE): New constants.
	* src/gdbmload.c (gdbm_load,gdbm_load_from_file): Take an
	additional argument, which masks out restoring certain meta-data.
	
2011-11-15  Sergey Poznyakoff  <gray@gnu.org.ua>

	Return a meaningful error code if failed to restore file's metadata.
	
	* src/gdbm.h.in (GDBM_ERR_FILE_OWNER)
	(GDBM_ERR_FILE_MODE): New error codes.
	(_GDBM_MAX_ERRNO): Update.
	* src/gdbmerrno.c (gdbm_errlist): Add new error codes.
	* src/gdbmload.c (_set_gdbm_meta_info): Set gdbm_errno and
	return 1 in case of errors.
	(_gdbm_load_file): Propagate the return value from
	_set_gdbm_meta_info.
	
	* src/gdbm_load.c (main): Handle mild error conditions.
	* export/export.c (usage): Print the GDBM version the program is
	linked with.
	* doc/gdbm.texinfo: Document changes. 

2011-11-14  Sergey Poznyakoff  <gray@gnu.org.ua>
