aboutsummaryrefslogtreecommitdiff
path: root/src/lex.l
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-08-12 08:19:07 +0300
committerSergey Poznyakoff <gray@gnu.org>2021-08-12 08:19:36 +0300
commitcc7051ae2ea384863937083a3a60a5a008d511a5 (patch)
tree59cc1fdd4bb35ca0afafaaa56372ef631c3d1b59 /src/lex.l
parentd19407eaa4b00a724c4ff3744c2f49269183da26 (diff)
downloadgdbm-cc7051ae2ea384863937083a3a60a5a008d511a5.tar.gz
gdbm-cc7051ae2ea384863937083a3a60a5a008d511a5.tar.bz2
gdbmshell: get rid of remaining globals
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.
Diffstat (limited to 'src/lex.l')
-rw-r--r--src/lex.l4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lex.l b/src/lex.l
index 1a57a3a..f35d2fc 100644
--- a/src/lex.l
+++ b/src/lex.l
@@ -503,7 +503,9 @@ lerror (struct locus *loc, const char *fmt, ...)
static struct slist *
pe_file_name (void)
{
- return file_name ? slist_new (file_name) : NULL;
+ char *name = NULL;
+ variable_get ("filename", VART_STRING, (void**) &name);
+ return name ? slist_new (name) : NULL;
}
static struct slist *

Return to:

Send suggestions and report system problems to the System administrator.