Age | Commit message (Collapse) | Author | Files |
|
Sources for the libgdbm library reside in src/.
Sources for building accompanying tools are moved to the tools/
subdirectory.
|
|
Trailing whitespace was erroneously recognized as argument.
* src/lex.l (string_end): Optionally return NULL if the collected
string is of zero length.
When leaving the SHELL condition, don't return T_WORD for trailing
whitespace.
* src/gdbmshell.c (shell_handler): Perror after failed execv.
|
|
* configure.ac: Don't use $YACC and $LEX (undefined since f4c143fbdf).
* src/gdbmshell.c (run_command): Free arglist if not saved to last_args.
* src/gdbmtool.c (gdbmtool_init): Correctly report unrecognized long
options.
* src/gdbmtool.h (YY_LOCATION_PRINT): Define to locus_print.
(locus_print): New proto.
* src/gram.y: Define destructors for various symbols.
* src/lex.l: Save source file names in a linked list. Don't free
source name in input_context_pop, because yypush might refer to it
via yyloc stack even after readinf eof (e.g. when printing location).
The collected list is freed at program exit.
(locus_print): New function.
* src/parseopt.c (parseopt_free): New function.
(parseopt_first): Call parseopt_free.
(parseopt_next): Call parseopt_free, depending on the result.
* src/var.c (variable) <freehook>: New member.
(errormask_freehook): New function. Set it as freehook for errorexit
and errormask.
(variables_free): Call freehook, if defined.
|
|
Boolean errorexit controls whether script terminates upon first
erroneous return from run_command or its derivatives. The variable
can be set only in non-interactive mode.
errormask is a comma-delimited list of GDBM error codes that are
masked, i.e. that won't trigger a diagnostic message if they occur.
* src/gdbmshell.c (all handlers): Return integer value indicating
success (0) or failure (!0).
* src/gdbmtool.h (input_context_drain): New function.
(run_last_command): Return integer.
* src/gram.y: abort if run_command returns error and "errorexit" is
set.
* src/input-argv.c (instream_argv_read): Bugfix.
* src/lex.l (input_context_drain): New function.
* src/var.c: New variables: errorexit and errormask.
|
|
* src/Makefile.am (libgdbmapp_a_SOURCES): Add input-std.c
* src/gdbmshell.c (input_history_begin): Improve diagnostic message.
* src/gdbmtool.c (instream_default_create): New define.
(gdbmtool_init): Use instream_default_create.
* src/gdbmtool.h [WITH_READLINE] (instream_readline_create_: New proto.
(input_stream_name): New proto.
* src/input-rl.c (instream_stdin_create): Rename to instream_readline_create.
Fall back to instream_stdin_create if stdin is not connected to a tty.
* src/lex.l (input_stream_name): New function.
|
|
Applications using gbdmshell don't need to link with libreadline,
unless they use instream_stdin_create with readline support.
* src/gdbmshell.c (input_history_begin)
(input_history_handler): New functions.
(gdbmshell_run): Remove calls to input_init()/input_done().
* src/gdbmtool.h (instream): New fields: in_history_size,
in_history_get.
(input_init,input_done): Remove.
(instream_history_size,instream_history_get): New functions.
(input_history_handler,input_history_begin): Remove.
* src/input-rl.c: Incorporate history handling into the stream
itself.
* src/input-std.c (input_init,input_done): Remove placeholders.
* src/lex.l (input_history_size,input_history_get): New functions.
|
|
Use gdbmshell variables instead
* src/gdbmshell.c (file_name, file_descr)
(open_mode, open_format): Remove globals.
(opendb,checkdb)
(open_handler,import_handler)
(status_handler): Use variables instead of globals.
(command_tab): Mark the "open" parameter as optional.
* src/gdbmtool.c (gdbmtool_init): Use variables instead of globals.
* src/gdbmtool.h (file_name, file_descr)
(open_mode, open_format): Remove globals.
* src/lex.l: Use variables instead of globals.
* src/var.c (variable): Rename hook to sethook.
New field: typeconv.
(vartab): New variables: "filename", "fd".
(variable_get): Use typeconv if provided.
* tests/gdbmtool/base.exp: Fix expected output.
* tests/gdbmtool00.at: Likewise.
* tests/gdbmtool01.at: Likewise.
|
|
* doc/gdbm.texi: Document manual crash recovery procedure.
Document the gdbmtool "shell" command.
Fix chapter headings (remove final point).
Replace headings with sections.
* src/gdbmopen.c (gdbm_header_avail): Remove const qualifier from
1st argument
* src/proto.h (gdbm_file_sync): New proto.
* src/gdbmsync.c (gdbm_file_sync): Moved from proto.h.
(gdbm_sync): Call _gdbm_end_update to be sure
all changes are written to disk.
* src/gdbmtool.c: Implement the shell command.
(command_lookup): Fix name prefix comparison.
* src/gram.y: New token T_SHELL.
* src/lex.l: Sub-lexers for shell arguments.
|
|
* src/hash.c (_gdbm_hash): Suppress address sanitizer errors.
* src/proto.h (gdbm_file_sync): Add missing return.
* src/lex.l (input_context_pop): Delete current buffer when tos
is reached.
|
|
|
|
|
|
|
|
The hooks were introduced as a temporary tool in de7834e9. They did
their job and are not necessary any more.
|
|
* src/input-std.c: Bugfix
* doc/gdbm.texi: Document changes.
* README: Update.
* configure.ac: New option --enable-gdbmtool-debug.
* src/Makefile.am: Conditionally augment AM_YFLAGS and
AM_LFLAGS with options that enable debugging.
* src/gdbmtool.c: Conditionally enable --lex-trace and
--gram-trace options.
* src/gram.y: Likewise.
* src/lex.l: Likewise.
* tests/Makefile.am: Remove architecure-dependent tests.
* tests/testsuite.at: Likewise.
|
|
Commands can be supplied to gdbmtool in three ways:
1. From a file, using the --file (-f) option:
gdbmtool -f comfile
2. From the command line, if first argument is the database name:
gdbmtool test.db count \; fetch mykey \; avail
Note the use of semicolon to delimit commands.
3. From the interactive shell, if neither of the above is used.
* src/Makefile.am: Add new sources.
* src/gdbmtool.c: Use new stream functions for input.
* src/gdbmtool.h (setsource): Remove proto.
(instream_t): New data type.
(instream_name, instream_read)
(instream_close, instream_interactive)
(instream_eq): New functions.
(instream_stdin_create)
(instream_argv_create)
(instream_file_create)
(interactive, input_context_push): New protos.
* src/gram.y: Accept ; in place of newline.
* src/input-argv.c: New file.
* src/input-file.c: New file.
* src/input-rl.c: Rewrite to provide instream_t API.
* src/input-std.c: Likewise.
* src/lex.l: Rewrite.
* tests/.gitignore: Update.
* tests/Makefile.am: Add new tests. Incorporate
DejaGNU tests.
* tests/config/default.exp: New file.
* tests/gdbmtool/base.exp: New file.
* tests/gdbmtool00.at: New file.
* tests/gdbmtool01.at: New file.
* tests/gdbmtool02.at: New file.
* tests/testsuite.at: Include new tests.
|
|
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
* src/lex.l (expand_char): Don't return any value.
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
* src/datconv.c (s_float): Use strtod.
(datum_scan_notag, datum_scan_tag): Made static.
(dsprint): New function.
* src/gdbmtool.c (status_handler): Print ket and
content definitions.
(slist_new): Bugfix (missing return statement).
* src/gdbmtool.h: Add new prototypes.
* src/lex.l: Remove unused variables, set option
nounput.
|
|
* 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.
|
|
* 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.
|
|
* src/var.c: New file.
* 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.
|
|
* 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.
|
|
* 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.
|